Completed
Push — work-fleets ( a1656f...ab0e6c )
by SuperNova.WS
09:07 queued 03:10
created
includes/init_secondary.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,19 +4,19 @@  discard block
 block discarded – undo
4 4
 
5 5
 $classLocale = classLocale::$lang;
6 6
 
7
-if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
7
+if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
8 8
   include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX);
9 9
 }
10 10
 
11
-if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
11
+if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
12 12
   require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX);
13 13
   sn_user_birthday_celebrate();
14 14
 }
15 15
 
16
-if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
16
+if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
17 17
   classSupernova::$config->db_saveItem('var_online_user_count', DBStaticUser::db_user_count(true));
18 18
   classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW);
19
-  if(classSupernova::$config->server_log_online) {
19
+  if (classSupernova::$config->server_log_online) {
20 20
     db_log_online_insert();
21 21
   }
22 22
 }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
44 44
 //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die();
45 45
 
46
-if(!empty($user['id'])) {
46
+if (!empty($user['id'])) {
47 47
   classSupernova::$user_options->user_change($user['id']);
48 48
 }
49 49
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
     : false
57 57
   );
58 58
 
59
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
60
-  $prohibited_characters = array_map(function ($value) {
59
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
60
+  $prohibited_characters = array_map(function($value) {
61 61
     return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
62 62
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
63 63
   $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters);
64 64
 }
65 65
 
66 66
 
67
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
67
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
68 68
   pdump("Отключи отладку перед продакшном!");
69 69
 }
70 70
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
   ? define('INSTALL_MODE', GAME_DISABLE_INSTALL)
79 79
   : false;
80 80
 
81
-if(
81
+if (
82 82
   classSupernova::$config->game_disable == GAME_DISABLE_STAT
83 83
   &&
84 84
   SN_TIME_NOW - strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) > 600
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
   classSupernova::$debug->warning('Stat worked too long - watchdog unlocked', 'Stat WARNING');
92 92
 }
93 93
 
94
-if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
94
+if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
95 95
   $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse(
96 96
     classSupernova::$config->game_disable == GAME_DISABLE_REASON
97 97
       ? classSupernova::$config->game_disable_reason
98 98
       : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable]
99 99
   );
100
-  if(defined('IN_API')) {
100
+  if (defined('IN_API')) {
101 101
     return;
102 102
   }
103 103
 
104
-  if(
104
+  if (
105 105
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
106 106
     &&
107 107
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 
116 116
 // TODO ban
117 117
 // TODO $skip_ban_check
118
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
119
-  if(defined('IN_API')) {
118
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
119
+  if (defined('IN_API')) {
120 120
     return;
121 121
   }
122 122
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 // pdump($allow_anonymous, '$allow_anonymous');
135 135
 // pdump($sys_user_logged_in, '$sys_user_logged_in');
136 136
 
137
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
137
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
138 138
   sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
139
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
139
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
140 140
 //  pdump($sn_page_name);
141 141
 //  pdump(INITIAL_PAGE);
142 142
 //  die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}');
143
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
143
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
144 144
   // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
145 145
   sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
146 146
 }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 global $skip_fleet_update;
163 163
 $skip_fleet_update = $skip_fleet_update || classSupernova::$options['fleet_update_skip'] || defined('IN_ADMIN');
164
-if(
164
+if (
165 165
   !$skip_fleet_update
166 166
   && !(defined('IN_AJAX') && IN_AJAX === true)
167 167
   && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
   flt_flying_fleet_handler($skip_fleet_update);
171 171
 }
172 172
 
173
-if(!defined('IN_AJAX')) {
173
+if (!defined('IN_AJAX')) {
174 174
   pdump("Scheduled processes is disabled");
175 175
 }
176 176
 // scheduler_process();
Please login to merge, or discard this patch.
includes/functions/qst_quest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@
 block discarded – undo
298 298
 
299 299
         if (!empty($resourcesChange)) {
300 300
           $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id;
301
-          if($planet_id) {
301
+          if ($planet_id) {
302 302
             // update planet
303 303
             DBStaticPlanet::db_planet_update_resources($resourcesChange, $planet_id);
304 304
           } else {
Please login to merge, or discard this patch.
includes/functions/scheduler_process.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
   $ts_var_stat_update = strtotime(classSupernova::$config->db_loadItem('var_stat_update'));
10 10
   $ts_scheduled_update = sys_schedule_get_prev_run(classSupernova::$config->db_loadItem('stats_schedule'), classSupernova::$config->var_stat_update);
11 11
 
12
-  if(sys_get_param_int('admin_update')) {
12
+  if (sys_get_param_int('admin_update')) {
13 13
     define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1);
14
-    if(USER_LEVEL > 0) {
14
+    if (USER_LEVEL > 0) {
15 15
       $is_admin_request = true;
16 16
       $ts_scheduled_update = SN_TIME_NOW;
17 17
     }
18 18
   }
19 19
 
20
-  if($ts_scheduled_update > $ts_var_stat_update) {
20
+  if ($ts_scheduled_update > $ts_var_stat_update) {
21 21
     lng_include('admin');
22 22
     sn_db_transaction_start();
23 23
     $ts_var_stat_update_end = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end'));
24
-    if(SN_TIME_NOW > $ts_var_stat_update_end) {
24
+    if (SN_TIME_NOW > $ts_var_stat_update_end) {
25 25
       $old_server_status = classSupernova::$config->db_loadItem('game_disable');
26 26
       classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_STAT);
27 27
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
       classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_SQL);
57 57
       classSupernova::$config->db_saveItem('var_stat_update_end', SN_TIME_SQL);
58 58
 
59
-      if($old_server_status == GAME_DISABLE_STAT) {
59
+      if ($old_server_status == GAME_DISABLE_STAT) {
60 60
         $old_server_status = GAME_DISABLE_NONE;
61 61
       }
62 62
       classSupernova::$config->db_saveItem('game_disable', $old_server_status);
63
-    } elseif($ts_scheduled_update > $ts_var_stat_update) {
63
+    } elseif ($ts_scheduled_update > $ts_var_stat_update) {
64 64
       $timeout = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW;
65 65
       $msg = classSupernova::$config->db_loadItem('var_stat_update_msg');
66 66
       $msg = "{$msg} ETA {$timeout} seconds. Please wait...";
67 67
     }
68 68
     sn_db_transaction_rollback();
69
-  } elseif($is_admin_request) {
69
+  } elseif ($is_admin_request) {
70 70
     $msg = 'Stat is up to date';
71 71
   }
72 72
 
Please login to merge, or discard this patch.
includes/functions/tpl_helpers.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 use DBStatic\DBStaticFleetACS;
5 5
 
6 6
 function tpl_assign_fleet_compare($a, $b) {
7
-  if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
8
-    if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
7
+  if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
8
+    if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
9 9
       return 0;
10 10
     }
11 11
 
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  * @param string   $js_name
22 22
  */
23 23
 function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') {
24
-  if(!$fleets) {
24
+  if (!$fleets) {
25 25
     return;
26 26
   }
27 27
 
28 28
   usort($fleets, 'tpl_assign_fleet_compare');
29 29
 
30
-  foreach($fleets as $fleet_data) {
30
+  foreach ($fleets as $fleet_data) {
31 31
     $template->assign_block_vars($js_name, $fleet_data['fleet']);
32 32
 
33
-    if($fleet_data['ships']) {
34
-      foreach($fleet_data['ships'] as $ship_data) {
33
+    if ($fleet_data['ships']) {
34
+      foreach ($fleet_data['ships'] as $ship_data) {
35 35
         $template->assign_block_vars("{$js_name}.ships", $ship_data);
36 36
       }
37 37
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     'DEUTERIUM' => $fleet[RES_DEUTERIUM],
53 53
   );
54 54
 
55
-  foreach($fleet as $ship_id => $ship_amount) {
56
-    if(in_array($ship_id, classSupernova::$gc->groupFleet)) {
55
+  foreach ($fleet as $ship_id => $ship_amount) {
56
+    if (in_array($ship_id, classSupernova::$gc->groupFleet)) {
57 57
       $single_ship_data = get_ship_data($ship_id, $user_data);
58 58
       $return['ships'][$ship_id] = array(
59 59
         'ID'          => $ship_id,
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 
93 93
   $result = array();
94 94
 
95
-  if(!$user_data) {
95
+  if (!$user_data) {
96 96
     $user_data = $user;
97 97
   }
98 98
 
99
-  if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
99
+  if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
100 100
     $aks = DBStaticFleetACS::db_acs_get_by_group_id($objFleet->group_id);
101 101
   }
102 102
 
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
     'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW),
138 138
   );
139 139
 
140
-  if(property_exists($objFleet, 'fleet_start_name')) {
140
+  if (property_exists($objFleet, 'fleet_start_name')) {
141 141
     $result['START_NAME'] = $objFleet->fleet_start_name;
142 142
   }
143
-  if(property_exists($objFleet, 'fleet_end_name')) {
143
+  if (property_exists($objFleet, 'fleet_end_name')) {
144 144
     $result['END_NAME'] = $objFleet->fleet_end_name;
145 145
   }
146 146
 
147
-  if(property_exists($objFleet, 'event_time')) {
147
+  if (property_exists($objFleet, 'event_time')) {
148 148
     $result['fleet'] = array_merge($result['fleet'], array(
149 149
       'OV_LABEL'        => $objFleet->ov_label,
150 150
       'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '',
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 
156 156
   $ship_id = 0;
157 157
   $result['ships'] = array();
158
-  if($spy_level >= 6) {
159
-    foreach($objFleet->shipsIterator() as $ship_sn_id => $ship) {
160
-      if($spy_level >= 10) {
158
+  if ($spy_level >= 6) {
159
+    foreach ($objFleet->shipsIterator() as $ship_sn_id => $ship) {
160
+      if ($spy_level >= 10) {
161 161
         $single_ship_data = get_ship_data($ship_sn_id, $user_data);
162 162
         $result['ships'][$ship_sn_id] = array(
163 163
           'ID'          => $ship_sn_id,
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 function tpl_parse_planet_que($que, $planet, $que_id) {
191 191
   $hangar_que = array();
192 192
   $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']];
193
-  if(!empty($que_hangar)) {
194
-    foreach($que_hangar as $que_item) {
193
+  if (!empty($que_hangar)) {
194
+    foreach ($que_hangar as $que_item) {
195 195
       $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']);
196 196
       $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount'];
197 197
     }
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
     'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK),
252 252
   );
253 253
 
254
-  if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
254
+  if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
255 255
     $result['building_que'] = array();
256 256
     $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']];
257
-    foreach($building_que as $que_element) {
257
+    foreach ($building_que as $que_element) {
258 258
       $result['building_que'][] = que_tpl_parse_element($que_element);
259 259
     }
260 260
   }
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
   static $snGroupFleet;
274 274
   !$snGroupFleet ? $snGroupFleet = classSupernova::$gc->groupFleet : false;
275 275
 
276
-  if(empty($array_of_Fleet)) {
276
+  if (empty($array_of_Fleet)) {
277 277
     return false;
278 278
   }
279 279
 
280 280
   $fleet_list = array();
281
-  foreach($array_of_Fleet as $fleet) {
282
-    if($fleet->playerOwnerId == $user['id']) {
283
-      if($fleet->mission_type == MT_MISSILE) {
281
+  foreach ($array_of_Fleet as $fleet) {
282
+    if ($fleet->playerOwnerId == $user['id']) {
283
+      if ($fleet->mission_type == MT_MISSILE) {
284 284
         continue;
285 285
       }
286 286
       $fleet_ownage = 'own';
287 287
     } else {
288
-      switch($fleet->mission_type) {
288
+      switch ($fleet->mission_type) {
289 289
         case MT_ATTACK:
290 290
         case MT_ACS:
291 291
         case MT_DESTROY:
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 
303 303
     $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet;
304 304
 
305
-    if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
306
-      foreach($fleet->shipsIterator() as $ship_id => $ship) {
307
-        if(!empty($snGroupFleet[$ship_id])) {
305
+    if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
306
+      foreach ($fleet->shipsIterator() as $ship_id => $ship) {
307
+        if (!empty($snGroupFleet[$ship_id])) {
308 308
           $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship->count;
309 309
         }
310 310
       }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
   return $fleet_list;
322 322
 }
323 323
 
324
-function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) {
324
+function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) {
325 325
   $template->assign_vars(array(
326 326
     'RESOURCE_ROUNDING' => $round,
327 327
 
Please login to merge, or discard this patch.
includes/functions/flt_mission_missile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@
 block discarded – undo
83 83
     $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4;
84 84
   }
85 85
 
86
-  $return['structures'] = $structures;     // Structures left after attack
87
-  $return['metal'] = floor($metal);   // Metal scraps
86
+  $return['structures'] = $structures; // Structures left after attack
87
+  $return['metal'] = floor($metal); // Metal scraps
88 88
   $return['crystal'] = floor($crystal); // Crystal scraps
89 89
 
90 90
   return $return;
Please login to merge, or discard this patch.
includes/functions/uni_functions.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 
12 12
   $possible_cores = array();
13 13
   $probability = 0;
14
-  foreach($density_list as $possible_core_id => $core_data) {
15
-    if(!$core_data[UNIT_PLANET_DENSITY_RARITY]) {
14
+  foreach ($density_list as $possible_core_id => $core_data) {
15
+    if (!$core_data[UNIT_PLANET_DENSITY_RARITY]) {
16 16
       continue;
17 17
     }
18 18
 
19
-    if(
19
+    if (
20 20
       // Core type exists
21 21
       in_array($possible_core_id, $position_data['core_types'])
22 22
       // Limit core type with planet sector count
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
   $random = mt_rand(1, $probability);
39 39
   $selected_core = null;
40
-  foreach($possible_cores as $core_type => $core_info) {
41
-    if($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) {
40
+  foreach ($possible_cores as $core_type => $core_info) {
41
+    if ($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) {
42 42
       $selected_core = $core_info;
43 43
       break;
44 44
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 function uni_create_planet($Galaxy, $System, $Position, $PlanetOwnerID, $planet_name_unsafe = '', $HomeWorld = false, $options = array()) {
62 62
   $Position = intval($Position);
63 63
 
64
-  if(!isset($options['skip_check']) && DBStaticPlanet::db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) {
64
+  if (!isset($options['skip_check']) && DBStaticPlanet::db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) {
65 65
     return false;
66 66
   }
67 67
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 
71 71
   $planet_generator = sn_get_groups('planet_generator');
72 72
 
73
-  if($HomeWorld) {
73
+  if ($HomeWorld) {
74 74
     $position_data = $planet_generator[0];
75 75
   } else {
76 76
     $position_data = $planet_generator[$Position >= UNIVERSE_RANDOM_PLANET_START || $Position < 1 ? UNIVERSE_RANDOM_PLANET_START : $Position];
77
-    if($Position >= UNIVERSE_RANDOM_PLANET_START) {
77
+    if ($Position >= UNIVERSE_RANDOM_PLANET_START) {
78 78
       // Корректируем температуру для планеты-странника
79 79
       $position_data['t_max_max'] -= UNIVERSE_RANDOM_PLANET_TEMPERATURE_DECREASE * ($Position - UNIVERSE_RANDOM_PLANET_START);
80 80
     }
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
   $moon_name = '';
166 166
   $moon_row = array();
167 167
   $moon = DBStaticPlanet::db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_MOON, false, 'id');
168
-  if(!$moon['id']) {
168
+  if (!$moon['id']) {
169 169
     $moon_planet = DBStaticPlanet::db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_PLANET, true, '`id`, `temp_min`, `temp_max`, `name`, `debris_metal`, `debris_crystal`');
170 170
 
171
-    if($moon_planet['id']) {
171
+    if ($moon_planet['id']) {
172 172
       $base_storage_size = BASE_STORAGE_SIZE;
173 173
 
174
-      if(!$moon_chance) {
174
+      if (!$moon_chance) {
175 175
         $size = mt_rand(1100, 8999);
176
-      } elseif($moon_chance <= 100) {
176
+      } elseif ($moon_chance <= 100) {
177 177
         $size = mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999);
178 178
       } else {
179 179
         $size = $moon_chance;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
       $field_max = ceil($size / 1000);
190 190
 
191
-      if(isset($options['image']) && $options['image']) {
191
+      if (isset($options['image']) && $options['image']) {
192 192
         $moon_image = $options['image'];
193 193
       } else {
194 194
         $moon_image = 'mond';
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         'deuterium_max'     => $base_storage_size,
222 222
       ));
223 223
 
224
-      if($update_debris) {
224
+      if ($update_debris) {
225 225
         $debris_spent = $moon_chance * 1000000;
226 226
         $metal_spent = round(min($moon_planet['debris_metal'], $debris_spent * mt_rand(50, 75) / 100));
227 227
         $crystal_spent = min($moon_planet['debris_crystal'], $debris_spent - $metal_spent);
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
         DBStaticPlanet::db_planet_update_adjust_by_id(
230 230
           $moon_planet['id'],
231 231
           array(
232
-            'debris_metal'   => -$metal_spent,    // `debris_metal` = GREATEST(0, `debris_metal` - {$metal_spent})
233
-            'debris_crystal' => -$crystal_spent,  // `debris_crystal` = GREATEST(0, `debris_crystal` - {$crystal_spent})
232
+            'debris_metal'   => -$metal_spent, // `debris_metal` = GREATEST(0, `debris_metal` - {$metal_spent})
233
+            'debris_crystal' => -$crystal_spent, // `debris_crystal` = GREATEST(0, `debris_crystal` - {$crystal_spent})
234 234
           )
235 235
         );
236 236
       }
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
   $planet_row['id'] = $user['current_planet'];
263 263
 
264 264
   // Пытаемся переключить на новую планету
265
-  if(($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) {
265
+  if (($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) {
266 266
     $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($selected_planet, $user['id'], false, 'id');
267 267
   } else {
268 268
     $planet_row = DBStaticPlanet::db_planet_by_id($planet_row['id']);
269 269
   }
270 270
 
271 271
   // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету
272
-  if(!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet']
272
+  if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet']
273 273
   {
274 274
     $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id');
275 275
     // Если текущей планеты не существует - выставляем Столицу
276
-    if(!isset($planet_row['id'])) {
276
+    if (!isset($planet_row['id'])) {
277 277
       $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id');
278 278
       // Если и столицы не существует - значит что-то очень не так с записью пользователя
279
-      if(!isset($planet_row['id'])) {
279
+      if (!isset($planet_row['id'])) {
280 280
         classSupernova::$debug->error("User ID {$user['id']} has Capital planet {$user['id_planet']} but this planet does not exists", 'User record error', 502);
281 281
       }
282 282
     }
283 283
   }
284 284
 
285 285
   // Если производилось переключение планеты - делаем запись в юзере
286
-  if($user['current_planet'] != $planet_row['id']) {
286
+  if ($user['current_planet'] != $planet_row['id']) {
287 287
     $user['current_planet'] = $planet_row['id'];
288 288
     DBStaticUser::db_user_set_by_id(
289 289
       $user['id'],
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 }
314 314
 
315 315
 function uni_render_planet_full($from, $prefix = '', $html_safe = true, $include_id = false) {
316
-  if(!$from['id']) {
316
+  if (!$from['id']) {
317 317
     $result = classLocale::$lang['sys_planet_expedition'];
318 318
   } else {
319 319
     $from_planet_id = $include_id ? (
@@ -363,30 +363,30 @@  discard block
 block discarded – undo
363 363
   $coordinates["{$prefix}planet"] = intval($coordinates["{$prefix}planet"]);
364 364
 
365 365
   return
366
-    isset($coordinates["{$prefix}galaxy"]) && $coordinates["{$prefix}galaxy"] > 0 && $coordinates["{$prefix}galaxy"] <= Vector::$knownGalaxies&&
367
-    isset($coordinates["{$prefix}system"]) && $coordinates["{$prefix}system"] > 0 && $coordinates["{$prefix}system"] <= Vector::$knownSystems&&
366
+    isset($coordinates["{$prefix}galaxy"]) && $coordinates["{$prefix}galaxy"] > 0 && $coordinates["{$prefix}galaxy"] <= Vector::$knownGalaxies &&
367
+    isset($coordinates["{$prefix}system"]) && $coordinates["{$prefix}system"] > 0 && $coordinates["{$prefix}system"] <= Vector::$knownSystems &&
368 368
     isset($coordinates["{$prefix}planet"]) && $coordinates["{$prefix}planet"] > 0 && $coordinates["{$prefix}planet"] <= Vector::$knownPlanets;
369 369
 }
370 370
 
371 371
 function uni_planet_teleport_check($user, $planetrow, $new_coordinates = null) {
372 372
   try {
373
-    if($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) {
373
+    if ($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) {
374 374
       throw new exception(classLocale::$lang['ov_teleport_err_cooldown'], ERR_ERROR);
375 375
     }
376 376
 
377
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->planet_teleport_cost) {
377
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->planet_teleport_cost) {
378 378
       throw new exception(classLocale::$lang['ov_teleport_err_no_dark_matter'], ERR_ERROR);
379 379
     }
380 380
 
381 381
     // TODO: Replace quick-check with using gathered flying fleet data
382
-    if(FleetList::fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) {
382
+    if (FleetList::fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) {
383 383
       throw new exception(classLocale::$lang['ov_teleport_err_fleet'], ERR_ERROR);
384 384
     }
385 385
 
386
-    if(is_array($new_coordinates)) {
386
+    if (is_array($new_coordinates)) {
387 387
       $new_coordinates['planet_type'] = PT_PLANET;
388 388
       $incoming = DBStaticPlanet::db_planet_by_vector($new_coordinates, '', true, 'id');
389
-      if($incoming['id']) {
389
+      if ($incoming['id']) {
390 390
         throw new exception(classLocale::$lang['ov_teleport_err_destination_busy'], ERR_ERROR);
391 391
       }
392 392
     }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
       'result'  => ERR_NONE,
396 396
       'message' => '',
397 397
     );
398
-  } catch(exception $e) {
398
+  } catch (exception $e) {
399 399
     $response = array(
400 400
       'result'  => $e->getCode(),
401 401
       'message' => $e->getMessage(),
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Vector\Vector;
10 10
 
11 11
 function sys_user_vacation($user) {
12
-  if(sys_get_param_str('vacation') == 'leave') {
12
+  if (sys_get_param_str('vacation') == 'leave') {
13 13
     if ($user['vacation'] < SN_TIME_NOW) {
14 14
       $user['vacation'] = 0;
15 15
       $user['vacation_next'] = SN_TIME_NOW + classSupernova::$config->player_vacation_timeout;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     }
24 24
   }
25 25
 
26
-  if($user['vacation']) {
26
+  if ($user['vacation']) {
27 27
     // sn_sys_logout(false, true);
28 28
     // core_auth::logout(false, true);
29 29
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
   // TODO: Full rewrite
54 54
   sn_db_transaction_start();
55 55
   $TheUser = DBStaticUser::db_user_by_id($UserID);
56
-  if ( $TheUser['ally_id'] != 0 ) {
56
+  if ($TheUser['ally_id'] != 0) {
57 57
     $TheAlly = classSupernova::$db->doSelectFetchArray("SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';");
58 58
     $TheAlly['ally_members'] -= 1;
59
-    if ( $TheAlly['ally_members'] > 0 ) {
59
+    if ($TheAlly['ally_members'] > 0) {
60 60
       classSupernova::$db->doUpdateRowSet(
61 61
         TABLE_ALLIANCE,
62 62
         array(
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 
78 78
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_owner' => $UserID,));
79 79
   classSupernova::$gc->db->doDeleteWhere(TABLE_MESSAGES, array('message_sender' => $UserID,));
80
-  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID ,));
80
+  classSupernova::$gc->db->doDeleteWhere(TABLE_NOTES, array('owner' => $UserID,));
81 81
   FleetList::db_fleet_list_delete_by_owner($UserID);
82
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID ,));
83
-  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID ,));
82
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_SENDER_ID' => $UserID,));
83
+  classSupernova::$gc->db->doDeleteWhere(TABLE_BUDDY, array('BUDDY_OWNER_ID' => $UserID,));
84 84
 
85 85
 
86 86
   classSupernova::$gc->cacheOperator->db_del_record_by_id(LOC_USER, $UserID);
@@ -191,28 +191,28 @@  discard block
 block discarded – undo
191 191
   !empty($options['password_encoded_unsafe']) ? $field_set['password'] = $options['password_encoded_unsafe'] : false;
192 192
 
193 193
   $user_new = classSupernova::$gc->cacheOperator->db_ins_field_set(LOC_USER, $field_set);
194
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
194
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
195 195
     $options['galaxy'] = classSupernova::$config->LastSettedGalaxyPos;
196 196
     $options['system'] = classSupernova::$config->LastSettedSystemPos;
197
-    $segment_size = floor(Vector::$knownPlanets/ 3);
197
+    $segment_size = floor(Vector::$knownPlanets / 3);
198 198
     $segment = floor(classSupernova::$config->LastSettedPlanetPos / $segment_size);
199 199
     $segment++;
200 200
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
201 201
 
202 202
     // $new_planet_id = 0;
203
-    while(true) {
204
-      if($options['planet'] > Vector::$knownPlanets) {
203
+    while (true) {
204
+      if ($options['planet'] > Vector::$knownPlanets) {
205 205
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
206 206
         $options['system']++;
207 207
       }
208
-      if($options['system'] > Vector::$knownSystems) {
208
+      if ($options['system'] > Vector::$knownSystems) {
209 209
         $options['system'] = 1;
210 210
         $options['galaxy']++;
211 211
       }
212
-      $options['galaxy'] > Vector::$knownGalaxies? $options['galaxy'] = 1 : false;
212
+      $options['galaxy'] > Vector::$knownGalaxies ? $options['galaxy'] = 1 : false;
213 213
 
214 214
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
215
-      if(!$galaxy_row['id']) {
215
+      if (!$galaxy_row['id']) {
216 216
         classSupernova::$config->db_saveItem(array(
217 217
           'LastSettedGalaxyPos' => $options['galaxy'],
218 218
           'LastSettedSystemPos' => $options['system'],
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
   db_player_name_history_replace($user_new['id'], $username_unsafe);
242 242
 
243
-  if(!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
243
+  if (!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
244 244
     db_referral_insert($options['partner_id'], $user_new['id']);
245 245
   }
246 246
 
Please login to merge, or discard this patch.
includes/functions/eco_queue.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 
8 8
 function que_get_unit_que($unit_id) {
9 9
   $que_type = false;
10
-  foreach(sn_get_groups('ques') as $que_id => $que_data) {
11
-    if(in_array($unit_id, $que_data['unit_list'])) {
10
+  foreach (sn_get_groups('ques') as $que_id => $que_data) {
11
+    if (in_array($unit_id, $que_data['unit_list'])) {
12 12
       $que_type = $que_id;
13 13
       break;
14 14
     }
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 function que_get_max_que_length($user, $planet, $que_id, $que_data = null) {
22
-  if(empty($que_data)) {
22
+  if (empty($que_data)) {
23 23
     $que_data = sn_get_groups('ques');
24 24
     $que_data = $que_data[$que_id];
25 25
   }
26 26
 
27 27
 
28 28
   $que_length = 1;
29
-  switch($que_id) {
29
+  switch ($que_id) {
30 30
     case QUE_RESEARCH:
31 31
       $que_length = classSupernova::$config->server_que_length_research + mrc_get_level($user, null, UNIT_PREMIUM); // TODO - вынести в модуль
32 32
     break;
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 function eco_que_str2arr($que_str) {
42 42
   $que_arr = explode(';', $que_str);
43
-  foreach($que_arr as $que_index => &$que_item) {
44
-    if($que_item) {
43
+  foreach ($que_arr as $que_index => &$que_item) {
44
+    if ($que_item) {
45 45
       $que_item = explode(',', $que_item);
46 46
     } else {
47 47
       unset($que_arr[$que_index]);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 function eco_que_arr2str($que_arr) {
55
-  foreach($que_arr as &$que_item) {
55
+  foreach ($que_arr as &$que_item) {
56 56
     $que_item = implode(',', $que_item);
57 57
   }
58 58
 
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
   $classLocale = classLocale::$lang;
65 65
 
66 66
   $is_autoconvert = false;
67
-  if($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) {
67
+  if ($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) {
68 68
     $build_mode = BUILD_CREATE;
69 69
     $is_autoconvert = true;
70 70
   }
71 71
 
72 72
   $unit_amount_qued = 0;
73 73
   try {
74
-    if(!$user['id']) {
74
+    if (!$user['id']) {
75 75
       throw new exception('{Нет идентификатора пользователя - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION
76 76
     }
77 77
 
78 78
     $unit_id = sys_get_param_int('unit_id');
79
-    if(!$unit_id) {
79
+    if (!$unit_id) {
80 80
       throw new exception('{Нет идентификатора юнита - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION
81 81
     }
82 82
 
83 83
     $que_id = que_get_unit_que($unit_id);
84
-    if(!$que_id) {
84
+    if (!$que_id) {
85 85
       throw new exception('{Неправильный тип очереди - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION
86 86
     }
87 87
 
88
-    if($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) {
88
+    if ($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) {
89 89
       throw new exception('{Уничтожать можно только здания на планете}', ERR_ERROR); // TODO EXCEPTION
90 90
     }
91 91
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
     $que_data = $que_data[$que_id];
94 94
 
95 95
     // TODO Переделать под подочереди
96
-    if($que_id == QUE_STRUCTURES) {
96
+    if ($que_id == QUE_STRUCTURES) {
97 97
       $sn_groups_build_allow = sn_get_groups('build_allow');
98 98
       $que_data['unit_list'] = $sn_groups_build_allow[$planet['planet_type']];
99 99
 
100
-      if(!isset($que_data['unit_list'][$unit_id])) {
100
+      if (!isset($que_data['unit_list'][$unit_id])) {
101 101
         throw new exception('{Это здание нельзя строить на ' . ($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR); // TODO EXCEPTION
102 102
       }
103 103
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     // Это нужно, что бы заблокировать пользователя и работу с очередями
109 109
     $user = DBStaticUser::db_user_by_id($user['id']);
110 110
     // Это нужно, что бы заблокировать планету от списания ресурсов
111
-    if(isset($planet['id']) && $planet['id']) {
111
+    if (isset($planet['id']) && $planet['id']) {
112 112
       $planet = DBStaticPlanet::db_planet_by_id($planet['id'], true);
113 113
     } else {
114 114
       $planet['id'] = 0;
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
     $in_que = &$que['in_que'][$que_id][$user['id']][$planet_id];
121 121
     $que_max_length = que_get_max_que_length($user, $planet, $que_id, $que_data);
122 122
     // TODO Добавить вызовы функций проверок текущей и максимальной длин очередей
123
-    if(count($in_que) >= $que_max_length) {
123
+    if (count($in_que) >= $que_max_length) {
124 124
       throw new exception('{Все слоты очереди заняты}', ERR_ERROR); // TODO EXCEPTION
125 125
     }
126 126
 
127 127
     // TODO Отдельно посмотреть на уничтожение зданий - что бы можно было уничтожать их без планов
128
-    switch(eco_can_build_unit($user, $planet, $unit_id)) {
128
+    switch (eco_can_build_unit($user, $planet, $unit_id)) {
129 129
       case BUILD_ALLOWED:
130 130
       break;
131 131
       case BUILD_UNIT_BUSY:
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
       break; // TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading
134 134
       // case BUILD_REQUIRE_NOT_MEET:
135 135
       default:
136
-        if($build_mode == BUILD_CREATE) {
136
+        if ($build_mode == BUILD_CREATE) {
137 137
           throw new exception('{Требования не удовлетворены}', ERR_ERROR);
138 138
         }
139 139
       break; // TODO EXCEPTION eco_bld_msg_err_requirements_not_meet
@@ -143,33 +143,33 @@  discard block
 block discarded – undo
143 143
     $unit_amount_qued = $unit_amount;
144 144
     $units_qued = isset($in_que[$unit_id]) ? $in_que[$unit_id] : 0;
145 145
     $unit_level = mrc_get_level($user, $planet, $unit_id, true, true) + $units_qued;
146
-    if($unit_max = get_unit_param($unit_id, P_MAX_STACK)) {
147
-      if($unit_level >= $unit_max) {
146
+    if ($unit_max = get_unit_param($unit_id, P_MAX_STACK)) {
147
+      if ($unit_level >= $unit_max) {
148 148
         throw new exception('{Максимальное количество юнитов данного типа уже достигнуто или будет достигнуто по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION
149 149
       }
150 150
       $unit_amount = max(0, min($unit_amount, $unit_max - $unit_level));
151 151
     }
152 152
 
153
-    if($unit_amount < 1) {
153
+    if ($unit_amount < 1) {
154 154
       throw new exception('{Неправильное количество юнитов - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION
155 155
     }
156 156
 
157 157
     // TODO Переделать eco_unit_busy для всех типов зданий
158
-    if(get_unit_param($unit_id, P_STACKABLE)) {
158
+    if (get_unit_param($unit_id, P_STACKABLE)) {
159 159
       // TODO Поле 'max_Lot_size' для ограничения размера стэка в очереди - то ли в юниты, то ли в очередь
160
-      if(in_array($unit_id, $group_missile = sn_get_groups(GROUP_STR_MISSILES))) {
160
+      if (in_array($unit_id, $group_missile = sn_get_groups(GROUP_STR_MISSILES))) {
161 161
         // TODO Поле 'container' - указывает на родительску структуру, в которой хранится данный юнит и по вместительности которой нужно применять размер юнита
162 162
         $used_silo = 0;
163
-        foreach($group_missile as $missile_id) {
163
+        foreach ($group_missile as $missile_id) {
164 164
           $missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0;
165 165
           $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE);
166 166
         }
167 167
         $free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo;
168
-        if($free_silo <= 0) {
168
+        if ($free_silo <= 0) {
169 169
           throw new exception('{Ракетная шахта уже заполнена или будет заполнена по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION
170 170
         }
171 171
         $unit_size = get_unit_param($unit_id, P_UNIT_SIZE);
172
-        if($free_silo < $unit_size) {
172
+        if ($free_silo < $unit_size) {
173 173
           throw new exception("{В ракетной шахте нет места для {$classLocale['tech'][$unit_id]}}", ERR_ERROR); // TODO EXCEPTION
174 174
         }
175 175
         $unit_amount = max(0, min($unit_amount, floor($free_silo / $unit_size)));
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
       $unit_level = $new_unit_level = 0;
178 178
     } else {
179 179
       $unit_amount = 1;
180
-      if($que_id == QUE_STRUCTURES) {
180
+      if ($que_id == QUE_STRUCTURES) {
181 181
         $sectors_qued = is_array($in_que) ? array_sum($in_que) : 0;
182
-        if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) {
182
+        if ($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) {
183 183
           throw new exception('{Не хватает секторов на планете}', ERR_ERROR); // TODO EXCEPTION
184 184
         }
185 185
       }
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
     $exchange = array();
193 193
     $market_get_autoconvert_cost = market_get_autoconvert_cost();
194
-    if($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) {
194
+    if ($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) {
195 195
       $dark_matter = mrc_get_level($user, null, RES_DARK_MATTER);
196
-      if(mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) {
196
+      if (mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) {
197 197
         throw new exception("{Нет хватает " . ($market_get_autoconvert_cost - $dark_matter) . "ТМ на постройки с автоконвертацией ресурсов}", ERR_ERROR); // TODO EXCEPTION
198 198
       }
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
       $resource_exchange_rates = array();
204 204
       $resource_diff = array();
205 205
       $all_positive = true;
206
-      foreach($resources_loot as $resource_id) {
206
+      foreach ($resources_loot as $resource_id) {
207 207
         $resource_db_name = pname_resource_name($resource_id);
208 208
         $resource_got[$resource_id] = floor(mrc_get_level($user, $planet, $resource_id));
209 209
         $resource_exchange_rates[$resource_id] = classSupernova::$config->__get("rpg_exchange_{$resource_db_name}");
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
         $all_positive = $all_positive && ($resource_diff[$resource_id] > 0);
212 212
       }
213 213
       // Нужна автоконвертация
214
-      if($all_positive) {
214
+      if ($all_positive) {
215 215
         $is_autoconvert = false;
216 216
       } else {
217
-        foreach($resource_diff as $resource_diff_id => &$resource_diff_amount) {
218
-          if($resource_diff_amount >= 0) {
217
+        foreach ($resource_diff as $resource_diff_id => &$resource_diff_amount) {
218
+          if ($resource_diff_amount >= 0) {
219 219
             continue;
220 220
           }
221
-          foreach($resource_diff as $resource_got_id => &$resource_got_amount) {
222
-            if($resource_got_amount <= 0) {
221
+          foreach ($resource_diff as $resource_got_id => &$resource_got_amount) {
222
+            if ($resource_got_amount <= 0) {
223 223
               continue;
224 224
             }
225 225
             $current_exchange = $resource_exchange_rates[$resource_got_id] / $resource_exchange_rates[$resource_diff_id];
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
         }
236 236
 
237 237
         $is_autoconvert_ok = true;
238
-        foreach($resource_diff as $resource_diff_amount2) {
239
-          if($resource_diff_amount2 < 0) {
238
+        foreach ($resource_diff as $resource_diff_amount2) {
239
+          if ($resource_diff_amount2 < 0) {
240 240
             $is_autoconvert_ok = false;
241 241
             break;
242 242
           }
243 243
         }
244 244
 
245
-        if($is_autoconvert_ok) {
245
+        if ($is_autoconvert_ok) {
246 246
           $build_data['RESULT'][$build_mode] = BUILD_ALLOWED;
247 247
           $build_data['CAN'][$build_mode] = $unit_amount;
248 248
         } else {
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
       }
252 252
     }
253 253
     $unit_amount = min($build_data['CAN'][$build_mode], $unit_amount);
254
-    if($unit_amount <= 0) {
254
+    if ($unit_amount <= 0) {
255 255
       throw new exception('{Не хватает ресурсов}', ERR_ERROR); // TODO EXCEPTION
256 256
     }
257 257
 
258
-    if($new_unit_level < 0) {
258
+    if ($new_unit_level < 0) {
259 259
       throw new exception('{Нельзя уничтожить больше юнитов, чем есть}', ERR_ERROR); // TODO EXCEPTION
260 260
     }
261 261
 
262
-    if($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) {
262
+    if ($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) {
263 263
       throw new exception('{Строительство блокировано}', ERR_ERROR); // TODO EXCEPTION
264 264
     }
265 265
 
266
-    if($is_autoconvert) {
266
+    if ($is_autoconvert) {
267 267
       ksort($exchange);
268 268
       ksort($resource_got);
269 269
       db_change_resources(
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     }
283 283
 
284 284
     $unit_amount_qued = 0;
285
-    while($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) {
285
+    while ($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) {
286 286
       $place = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW);
287 287
       que_add_unit($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode);
288 288
       $unit_amount -= $place;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
     sn_db_transaction_commit();
294 294
 
295
-    if($redirect) {
295
+    if ($redirect) {
296 296
       sys_redirect("{$_SERVER['PHP_SELF']}?mode=" . sys_get_param_str('mode') . "&ally_id=" . sys_get_param_id('ally_id'));
297 297
       die();
298 298
     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
       'STATUS'  => ERR_NONE,
302 302
       'MESSAGE' => '{Строительство начато}',
303 303
     );
304
-  } catch(Exception $e) {
304
+  } catch (Exception $e) {
305 305
     sn_db_transaction_rollback();
306 306
     $operation_result = array(
307 307
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     );
310 310
   }
311 311
 
312
-  if(!empty($operation_result['MESSAGE'])) {
312
+  if (!empty($operation_result['MESSAGE'])) {
313 313
     $operation_result['MESSAGE'] .= ' ' . ($unit_amount_qued ? $unit_amount_qued : $unit_amount) . 'x[' . classLocale::$lang['tech'][$unit_id] . ']';
314 314
   }
315 315
 
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 function que_recalculate($old_que) {
321 321
   $new_que = array();
322 322
 
323
-  if(!is_array($old_que['items'])) {
323
+  if (!is_array($old_que['items'])) {
324 324
     return $new_que;
325 325
   }
326
-  foreach($old_que['items'] as $row) {
327
-    if(!isset($row) || !$row || $row['que_unit_amount'] <= 0) {
326
+  foreach ($old_que['items'] as $row) {
327
+    if (!isset($row) || !$row || $row['que_unit_amount'] <= 0) {
328 328
       continue;
329 329
     }
330 330
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 
336 336
     $last_id = count($new_que['items']) - 1;
337 337
 
338
-    if($row['que_planet_id']) {
338
+    if ($row['que_planet_id']) {
339 339
       $new_que['planets'][$row['que_planet_id']][$row['que_type']][] = &$new_que['items'][$last_id];
340
-    } elseif($row['que_type'] == QUE_RESEARCH) {
340
+    } elseif ($row['que_type'] == QUE_RESEARCH) {
341 341
       $new_que['players'][$row['que_player_id']][$row['que_type']][] = &$new_que['items'][$last_id];
342 342
     }
343 343
     $new_que['ques'][$row['que_type']][$row['que_player_id']][intval($row['que_planet_id'])][] = &$new_que['items'][$last_id];
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
   $que_type = que_get_unit_que($unit_id);
376 376
   $planet_id_origin = $planet['id'] ? $planet['id'] : 'NULL';
377 377
   $planet_id = $que_type == QUE_RESEARCH ? 'NULL' : $planet_id_origin;
378
-  if(is_numeric($planet_id)) {
378
+  if (is_numeric($planet_id)) {
379 379
     DBStaticPlanet::db_planet_update_set_by_id(
380 380
       $planet_id,
381 381
       array(
382 382
         'que_processed' => SN_TIME_NOW,
383 383
       )
384 384
     );
385
-  } elseif(is_numeric($user['id'])) {
385
+  } elseif (is_numeric($user['id'])) {
386 386
     DBStaticUser::db_user_set_by_id(
387 387
       $user['id'],
388 388
       array(
@@ -417,17 +417,17 @@  discard block
 block discarded – undo
417 417
   $planet['id'] = $planet['id'] && $que_type !== QUE_RESEARCH ? $planet['id'] : 0;
418 418
   $global_que = que_get($user['id'], $planet['id'], $que_type, true);
419 419
 
420
-  if(!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) {
420
+  if (!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) {
421 421
     $que = array_reverse($global_que['ques'][$que_type][$user['id']][$planet['id']]);
422 422
 
423
-    foreach($que as $que_item) {
423
+    foreach ($que as $que_item) {
424 424
       DBStaticQue::db_que_delete_by_id($que_item['que_id']);
425 425
 
426
-      if($que_item['que_planet_id_origin']) {
426
+      if ($que_item['que_planet_id_origin']) {
427 427
         $planet['id'] = $que_item['que_planet_id_origin'];
428 428
       }
429 429
 
430
-      if(!isset($planets_locked[$planet['id']])) {
430
+      if (!isset($planets_locked[$planet['id']])) {
431 431
         $planets_locked[$planet['id']] = $planet['id'] ? DBStaticPlanet::db_planet_by_id($planet['id'], true) : $planet;
432 432
       }
433 433
 
@@ -443,19 +443,19 @@  discard block
 block discarded – undo
443 443
         )
444 444
       );
445 445
 
446
-      if(!$clear) {
446
+      if (!$clear) {
447 447
         break;
448 448
       }
449 449
     }
450 450
 
451
-    if(is_numeric($planet['id'])) {
451
+    if (is_numeric($planet['id'])) {
452 452
       DBStaticPlanet::db_planet_update_set_by_id(
453 453
         $planet['id'],
454 454
         array(
455 455
           'que_processed' => SN_TIME_SQL,
456 456
         )
457 457
       );
458
-    } elseif(is_numeric($user['id'])) {
458
+    } elseif (is_numeric($user['id'])) {
459 459
       DBStaticUser::db_user_set_by_id(
460 460
         $user['id'],
461 461
         array(
@@ -507,21 +507,21 @@  discard block
 block discarded – undo
507 507
   // TODO: Переделать для $que_type === false
508 508
   $planet['id'] = $planet['id'] ? $planet['id'] : 0;
509 509
 
510
-  if(!is_array($que)) {
510
+  if (!is_array($que)) {
511 511
     $que = que_get($user['id'], $planet['id'], $que_type);
512 512
   }
513 513
 
514
-  if(is_array($que) && isset($que['items'])) {
514
+  if (is_array($que) && isset($que['items'])) {
515 515
     $que = $que['ques'][$que_type][$user['id']][$planet['id']];
516 516
   }
517 517
 
518
-  if($que) {
519
-    foreach($que as $que_element) {
518
+  if ($que) {
519
+    foreach ($que as $que_element) {
520 520
       $template->assign_block_vars('que', que_tpl_parse_element($que_element, $short_names));
521 521
     }
522 522
   }
523 523
 
524
-  if($que_type == QUE_RESEARCH) {
524
+  if ($que_type == QUE_RESEARCH) {
525 525
   }
526 526
 }
527 527
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
   $user = DBStaticUser::db_user_by_id($user['id'], true);
546 546
 
547 547
   $time_left[$user['id']][0] = max(0, $on_time - $user['que_processed']);
548
-  if($planet === null && !$time_left[$user['id']][0]) {
548
+  if ($planet === null && !$time_left[$user['id']][0]) {
549 549
     return $que;
550 550
   }
551 551
 
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
   $que_type_id = $planet === null ? QUE_RESEARCH : false;
554 554
   $planet = intval(is_array($planet) ? $planet['id'] : $planet); // В $planet у нас теперь только её ID или шаблон null/0/false
555 555
   $que = que_get($user['id'], $planet, $que_type_id, true);
556
-  if(empty($que['items'])) {
556
+  if (empty($que['items'])) {
557 557
     return $que;
558 558
   }
559 559
 
560 560
   $planet_list = array();
561
-  if($planet !== null) {
561
+  if ($planet !== null) {
562 562
     // Если нужно изменять данные на планетах - блокируем планеты и получаем данные о них
563 563
     // TODO - от них не надо ничего, кроме ID и que_processed
564 564
     $planet_row = DBStaticPlanet::db_planet_list_by_user_or_planet($user['id'], $planet);
@@ -567,20 +567,20 @@  discard block
 block discarded – undo
567 567
   }
568 568
 
569 569
   // Теперь в $time_left лежит время обсчета всех очередей по каждой из планеты
570
-  if(array_sum($time_left[$user['id']]) == 0) {
570
+  if (array_sum($time_left[$user['id']]) == 0) {
571 571
     return $que;
572 572
   }
573 573
 
574 574
   $unit_changes = array();
575
-  foreach($que['items'] as &$que_item) {
575
+  foreach ($que['items'] as &$que_item) {
576 576
     $que_player_id = &$que_item['que_player_id'];
577 577
     $que_planet_id = intval($que_item['que_planet_id']);
578 578
 
579 579
     $que_time_left = &$que['time_left'][$que_player_id][$que_planet_id][$que_item['que_type']];
580
-    if(!isset($que_time_left)) {
580
+    if (!isset($que_time_left)) {
581 581
       $que_time_left = $time_left[$que_player_id][$que_planet_id];
582 582
     }
583
-    if($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) {
583
+    if ($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) {
584 584
       continue;
585 585
     }
586 586
     // Дальше мы идем, если только осталось время в очереди И юниты к постройке
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     // Теперь работаем с остатком времени на юните. Оно не может быть равно или меньше нуля
594 594
 
595 595
     // Если времени в очереди осталось не меньше, чем время текущего юнита - значит мы достроили юнит
596
-    if($que_time_left >= $que_item['que_time_left']) {
596
+    if ($que_time_left >= $que_item['que_time_left']) {
597 597
       // Увеличиваем количество отстроенных юнитов
598 598
       $unit_processed++;
599 599
       // Вычитаем из времени очереди потраченное на постройку время
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
     $que_item['que_unit_amount'] -= $unit_processed;
607 607
 
608 608
     // Если еще остались юниты - значит ВСЁ оставшееся время приходится на достройку следующего юнита
609
-    if($que_item['que_unit_amount'] > 0) {
609
+    if ($que_item['que_unit_amount'] > 0) {
610 610
       $que_item['que_time_left'] = $que_item['que_time_left'] - $que_time_left;
611 611
       $que_time_left = 0;
612 612
     }
613 613
 
614
-    if($que_item['que_unit_amount'] <= 0) {
614
+    if ($que_item['que_unit_amount'] <= 0) {
615 615
       DBStaticQue::db_que_delete_by_id($que_item['que_id']);
616 616
     } else {
617 617
       classSupernova::$gc->cacheOperator->db_upd_record_by_id(
@@ -626,15 +626,15 @@  discard block
 block discarded – undo
626 626
       );
627 627
     }
628 628
 
629
-    if($unit_processed) {
629
+    if ($unit_processed) {
630 630
       $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1);
631 631
       $unit_changes[$que_player_id][$que_planet_id][$que_item['que_unit_id']] += $unit_processed_delta;
632 632
     }
633 633
   }
634 634
 
635
-  foreach($time_left as $player_id => $planet_data) {
636
-    foreach($planet_data as $planet_id => $time_on_planet) {
637
-      if($planet_id) {
635
+  foreach ($time_left as $player_id => $planet_data) {
636
+    foreach ($planet_data as $planet_id => $time_on_planet) {
637
+      if ($planet_id) {
638 638
         // update planet
639 639
         classSupernova::$gc->cacheOperator->db_upd_record_by_id(
640 640
           LOC_PLANET,
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
         );
657 657
       }
658 658
 
659
-      if(is_array($unit_changes[$player_id][$planet_id])) {
660
-        foreach($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) {
659
+      if (is_array($unit_changes[$player_id][$planet_id])) {
660
+        foreach ($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) {
661 661
           DBStaticUnit::dbUpdateOrInsertUnit($unit_id, $unit_amount, $user, $planet_id ? $planet_id : null);
662 662
         }
663 663
       }
@@ -667,38 +667,38 @@  discard block
 block discarded – undo
667 667
   $que = que_recalculate($que);
668 668
 
669 669
   // TODO: Re-enable quests for Alliances
670
-  if(!empty($unit_changes) && !$user['user_as_ally']) {
670
+  if (!empty($unit_changes) && !$user['user_as_ally']) {
671 671
     $quest_list = qst_get_quests($user['id']);
672 672
     $quest_triggers = qst_active_triggers($quest_list);
673 673
     $quest_rewards = array();
674 674
 
675 675
 
676 676
     $xp_incoming = array();
677
-    foreach($unit_changes as $user_id => $planet_changes) {
678
-      foreach($planet_changes as $planet_id => $changes) {
677
+    foreach ($unit_changes as $user_id => $planet_changes) {
678
+      foreach ($planet_changes as $planet_id => $changes) {
679 679
         $planet_this = $planet_id ? classSupernova::$gc->cacheOperator->db_get_record_by_id(LOC_PLANET, $planet_id) : array();
680
-        foreach($changes as $unit_id => $unit_value) {
680
+        foreach ($changes as $unit_id => $unit_value) {
681 681
           $que_id = que_get_unit_que($unit_id);
682 682
           $unit_level_new = mrc_get_level($user, $planet_this, $unit_id, false, true) + $unit_value;
683
-          if($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) {
683
+          if ($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) {
684 684
             $build_data = eco_get_build_data($user, $planet_this, $unit_id, $unit_level_new - 1);
685 685
             $build_data = $build_data[BUILD_CREATE];
686
-            foreach(sn_get_groups('resources_loot') as $resource_id) {
686
+            foreach (sn_get_groups('resources_loot') as $resource_id) {
687 687
               $xp_incoming[$que_id] += $build_data[$resource_id]; // TODO - добавить конверсию рейтов обмена
688 688
             }
689 689
           }
690 690
 
691
-          if(is_array($quest_triggers)) {
691
+          if (is_array($quest_triggers)) {
692 692
             // TODO: Check mutiply condition quests
693 693
             $quest_trigger_list = array_keys($quest_triggers, $unit_id);
694
-            if(is_array($quest_trigger_list)) {
695
-              foreach($quest_trigger_list as $quest_id) {
694
+            if (is_array($quest_trigger_list)) {
695
+              foreach ($quest_trigger_list as $quest_id) {
696 696
                 $quest_unit_level = $unit_level_new;
697
-                if(get_unit_param($unit_id, P_UNIT_TYPE) == UNIT_SHIPS) {
697
+                if (get_unit_param($unit_id, P_UNIT_TYPE) == UNIT_SHIPS) {
698 698
                   $quest_unit_level = DBStaticUnit::db_unit_count_by_user_and_type_and_snid($user_id, 0, $unit_id);
699 699
                   $quest_unit_level = $quest_unit_level[$unit_id]['qty'];
700 700
                 }
701
-                if($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE && $quest_list[$quest_id]['quest_unit_amount'] <= $quest_unit_level) {
701
+                if ($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE && $quest_list[$quest_id]['quest_unit_amount'] <= $quest_unit_level) {
702 702
                   $quest_rewards[$quest_id][$user_id][$planet_id] = $quest_list[$quest_id]['quest_rewards_list'];
703 703
                   $quest_list[$quest_id]['quest_status_status'] = QUEST_STATUS_COMPLETE;
704 704
                 }
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
     // TODO: Изменить начисление награды за квесты на ту планету, на которой происходил ресеч
712 712
     qst_reward($user, $quest_rewards, $quest_list);
713 713
 
714
-    foreach($xp_incoming as $que_id => $xp) {
714
+    foreach ($xp_incoming as $que_id => $xp) {
715 715
       rpg_level_up($user, $que_id == QUE_RESEARCH ? RPG_TECH : RPG_STRUCTURE, $xp / 1000);
716 716
     }
717 717
   }
Please login to merge, or discard this patch.
includes/functions/sys_bbcode.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,23 +103,23 @@
 block discarded – undo
103 103
 
104 104
   !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false;
105 105
 
106
-  foreach(classSupernova::$design['bbcodes'] as $auth_level => $replaces) {
107
-    if($auth_level > $author_auth) {
106
+  foreach (classSupernova::$design['bbcodes'] as $auth_level => $replaces) {
107
+    if ($auth_level > $author_auth) {
108 108
       continue;
109 109
     }
110 110
 
111
-    foreach($replaces as $key => $html) {
112
-      $msg = preg_replace(''.$key.'', $html, $msg);
111
+    foreach ($replaces as $key => $html) {
112
+      $msg = preg_replace('' . $key . '', $html, $msg);
113 113
     }
114 114
   }
115 115
 
116
-  foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) {
117
-    if($auth_level > $author_auth) {
116
+  foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) {
117
+    if ($auth_level > $author_auth) {
118 118
       continue;
119 119
     }
120 120
 
121
-    foreach($replaces as $key => $imgName) {
122
-      $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg);
121
+    foreach ($replaces as $key => $imgName) {
122
+      $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU", "<img src=\"design/images/smileys/" . $imgName . ".gif\" align=\"absmiddle\" title=\"" . $key . "\" alt=\"" . $key . "\">", $msg);
123 123
     }
124 124
   }
125 125
 
Please login to merge, or discard this patch.