Passed
Push — work-fleets ( 6f822b...6dcfe4 )
by SuperNova.WS
06:31 queued 16s
created
includes/includes/art_artifact.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
   $unit_level = $artifact_level_old = mrc_get_level($user, null, $unit_id, true);
20 20
   if ($unit_level > 0) {
21
-    switch($unit_id) {
21
+    switch ($unit_id) {
22 22
       case ART_LHC:
23 23
       case ART_HOOK_SMALL:
24 24
       case ART_HOOK_MEDIUM:
Please login to merge, or discard this patch.
includes/includes/flt_mission_relocate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function flt_mission_relocate($mission_data) {
13 13
   $objFleet = $mission_data->fleet;
14 14
   $destination_planet = &$mission_data->dst_planet;
15
-  if($objFleet->playerOwnerId != $destination_planet['id_owner']) {
15
+  if ($objFleet->playerOwnerId != $destination_planet['id_owner']) {
16 16
     $objFleet->markReturnedAndSave();
17 17
 
18 18
     return;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
       $fleet_resources[RES_CRYSTAL], classLocale::$lang['Crystal'],
27 27
       $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium']
28 28
     ) . '<br />' . classLocale::$lang['sys_relocate_mess_user'];
29
-  foreach($objFleet->shipsIterator() as $ship_id => $ship) {
29
+  foreach ($objFleet->shipsIterator() as $ship_id => $ship) {
30 30
     $Message .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship->count . '<br />';
31 31
   }
32 32
   DBStaticMessages::msg_send_simple_message(
Please login to merge, or discard this patch.
includes/includes/flt_mission_spy.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 // ----------------------------------------------------------------------------------------------------------------
17 17
 function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) {
18
-  foreach($unit_group as $unit_id) {
19
-    if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
18
+  foreach ($unit_group as $unit_id) {
19
+    if (($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
20 20
       $compress_data[$unit_id] = $unit_count;
21 21
     }
22 22
   }
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
   $classLocale = classLocale::$lang;
27 27
 
28 28
   $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>";
29
-  foreach(sn_get_groups($group_name) as $unit_id) {
30
-    if(($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
29
+  foreach (sn_get_groups($group_name) as $unit_id) {
30
+    if (($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
31 31
       $result .= "<tr><td align=\"left\" colspan=\"3\">{$classLocale['tech'][$unit_id]}</td><td align=\"right\">{$unit_amount}</td></tr>";
32 32
     }
33 33
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 
57 57
   $objFleet = $mission_data->fleet;
58 58
 
59
-  if(empty($target_user_row['id']) || empty($spying_user_row['id'])) {
59
+  if (empty($target_user_row['id']) || empty($spying_user_row['id'])) {
60 60
     $objFleet->markReturnedAndSave();
61 61
 
62 62
     return;
63 63
   }
64 64
 
65 65
   $spy_probes = $objFleet->shipsGetTotalById(SHIP_SPY);
66
-  if($spy_probes > 0) {
66
+  if ($spy_probes > 0) {
67 67
     $TargetSpyLvl = GetSpyLevel($target_user_row);
68 68
     $CurrentSpyLvl = GetSpyLevel($spying_user_row);
69 69
     $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl;
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
     $spy_message .= "<td width=220>{$classLocale['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>";
88 88
     $spy_message .= "<td width=220>{$classLocale['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>";
89 89
     $spy_message .= "</tr>";
90
-    if($spy_diff >= 2) {
90
+    if ($spy_diff >= 2) {
91 91
       $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', classLocale::$lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>";
92 92
       coe_compress_add_units(classSupernova::$gc->groupFleet, $target_planet_row, $combat_pack[0]);
93 93
     }
94
-    if($spy_diff >= 3) {
94
+    if ($spy_diff >= 3) {
95 95
       $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', classLocale::$lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>";
96 96
       coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]);
97 97
     }
98
-    if($spy_diff >= 5) {
98
+    if ($spy_diff >= 5) {
99 99
       $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', classLocale::$lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>";
100 100
     }
101 101
 
102
-    if($spy_diff_empire >= 0) {
102
+    if ($spy_diff_empire >= 0) {
103 103
       $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', classLocale::$lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>";
104 104
       coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row);
105 105
     }
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
     $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D');
109 109
 
110 110
     $target_unit_list = 0;
111
-    foreach(classSupernova::$gc->groupFleet as $unit_id) {
111
+    foreach (classSupernova::$gc->groupFleet as $unit_id) {
112 112
       $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true));
113 113
     }
114 114
 
115 115
     $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl);
116 116
 
117
-    if(mt_rand(0, 99) > $spy_detected) {
117
+    if (mt_rand(0, 99) > $spy_detected) {
118 118
       $spy_outcome_str = sprintf(classLocale::$lang['sys_mess_spy_detect_chance'], $spy_detected);
119 119
       $spy_detected = false;
120 120
     } else {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     $target_message = "{$classLocale['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3);
135 135
     $target_message .= " {$classLocale['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row);
136 136
 
137
-    if($spy_detected) {
137
+    if ($spy_detected) {
138 138
       $debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet'];
139 139
 
140 140
       $spy_cost = get_unit_param(SHIP_SPY, P_COST);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_mess_spy_control'], classLocale::$lang['sys_mess_spy_activity'], $target_message);
157 157
   }
158 158
 
159
-  if($spy_detected) {
159
+  if ($spy_detected) {
160 160
     $objFleet->dbDelete();
161 161
   } else {
162 162
     $objFleet->markReturnedAndSave();
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -22,6 +22,9 @@
 block discarded – undo
22 22
   }
23 23
 }
24 24
 
25
+/**
26
+ * @param string $group_name
27
+ */
25 28
 function flt_spy_scan($target_planet, $group_name, $section_title, $target_user = array()) {
26 29
   $classLocale = classLocale::$lang;
27 30
 
Please login to merge, or discard this patch.
includes/includes/flt_mission_explore.php 2 patches
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
   // TODO - Currently $ship_data is one for all players
24 24
   static $shipCostInMetalPerPiece, $rates;
25 25
 
26
-  if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
26
+  if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
27 27
     return;
28 28
   }
29 29
 
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
   $outcome_value = &$result['$outcome_value'];
49 49
   $outcome_list = &$result['$outcome_list'];
50 50
 
51
-  if(!$shipCostInMetalPerPiece) {
51
+  if (!$shipCostInMetalPerPiece) {
52 52
     $rates = get_resource_exchange();
53 53
 
54
-    foreach(classSupernova::$gc->groupFleet as $unit_id) {
54
+    foreach (classSupernova::$gc->groupFleet as $unit_id) {
55 55
       $unit_info = get_unit_param($unit_id);
56
-      if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
56
+      if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
57 57
         continue;
58 58
       }
59 59
       $shipCostInMetalPerPiece[$unit_id] = get_unit_cost_in($unit_info[P_COST], RES_METAL);
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
   $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7));
74 74
 
75 75
   $chance_max = 0;
76
-  foreach($outcome_list as $key => &$value) {
77
-    if(!$value['chance']) {
76
+  foreach ($outcome_list as $key => &$value) {
77
+    if (!$value['chance']) {
78 78
       unset($outcome_list[$key]);
79 79
       continue;
80 80
     }
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
   }
83 83
   $outcome_value = mt_rand(0, $chance_max);
84 84
   $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE];
85
-  foreach($outcome_list as $key => &$value) {
86
-    if(!$value['chance']) {
85
+  foreach ($outcome_list as $key => &$value) {
86
+    if (!$value['chance']) {
87 87
       continue;
88 88
     }
89 89
     $mission_outcome = $key;
90 90
     $outcome_description = $value;
91
-    if($outcome_value <= $outcome_description['value']) {
91
+    if ($outcome_value <= $outcome_description['value']) {
92 92
       break;
93 93
     }
94 94
   }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 //  $outcome_mission_sub = -1;
106 106
 
107 107
   $fleet_found = array();
108
-  switch($mission_outcome) {
108
+  switch ($mission_outcome) {
109 109
     case FLT_EXPEDITION_OUTCOME_LOST_FLEET:
110 110
       $objFleet->shipsCountApplyLossMultiplier(mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000);
111 111
     break;
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
       // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля
128 128
       $can_be_found = array();
129
-      foreach($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) {
130
-        if($shipMetalCost < $max_metal_cost) {
129
+      foreach ($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) {
130
+        if ($shipMetalCost < $max_metal_cost) {
131 131
           $can_be_found[$ship_id] = $shipMetalCost;
132 132
         }
133 133
       }
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
       unset($can_be_found[SHIP_COLONIZER]);
136 136
       unset($can_be_found[SHIP_SPY]);
137 137
 
138
-      while(count($can_be_found) && $found_in_metal >= max($can_be_found)) {
138
+      while (count($can_be_found) && $found_in_metal >= max($can_be_found)) {
139 139
         $found_index = mt_rand(1, count($can_be_found)) - 1;
140 140
         $found_ship = array_slice($can_be_found, $found_index, 1, true);
141 141
         $found_ship_cost = reset($found_ship);
142 142
         $found_ship_id = key($found_ship);
143 143
 
144
-        if($found_ship_cost > $found_in_metal) {
144
+        if ($found_ship_cost > $found_in_metal) {
145 145
           unset($can_be_found[$found_ship_id]);
146 146
         } else {
147 147
           $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost));
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
         }
151 151
       }
152 152
 
153
-      if(empty($fleet_found)) {
153
+      if (empty($fleet_found)) {
154 154
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
155 155
       } else {
156
-        foreach($fleet_found as $unit_id => $unit_amount) {
156
+        foreach ($fleet_found as $unit_id => $unit_amount) {
157 157
           $objFleet->shipAdjustCount($unit_id, $unit_amount);
158 158
         }
159 159
       }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
       $objFleet->resourcesAdjust($resources_found);
179 179
 
180
-      if(array_sum($resources_found) == 0) {
180
+      if (array_sum($resources_found) == 0) {
181 181
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
182 182
       }
183 183
     break;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
       // Рассчитываем количество найденной ТМ
189 189
       $found_dark_matter = floor(min($outcome_percent * $result['$fleet_metal_points'] / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000);
190 190
 
191
-      if(!$found_dark_matter) {
191
+      if (!$found_dark_matter) {
192 192
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
193 193
       }
194 194
     break;
@@ -202,40 +202,39 @@  discard block
 block discarded – undo
202 202
 
203 203
   mission_expedition_result_adjust($result);
204 204
 
205
-  if($found_dark_matter) {
205
+  if ($found_dark_matter) {
206 206
     rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus');
207 207
     $msg_text_addon = sprintf(classLocale::$lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter);
208 208
   }
209 209
 
210
-  if(!empty($fleet_lost)) {
210
+  if (!empty($fleet_lost)) {
211 211
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['lost_fleet'];
212
-    foreach($fleet_lost as $ship_id => $ship_amount) {
212
+    foreach ($fleet_lost as $ship_id => $ship_amount) {
213 213
       $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
214 214
     }
215 215
   }
216 216
 
217
-  if(!empty($fleet_found)) {
217
+  if (!empty($fleet_found)) {
218 218
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_fleet'];
219
-    foreach($fleet_found as $ship_id => $ship_amount) {
219
+    foreach ($fleet_found as $ship_id => $ship_amount) {
220 220
       $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
221 221
     }
222 222
   }
223 223
 
224
-  if(!empty($resources_found) && array_sum($resources_found) > 0) {
224
+  if (!empty($resources_found) && array_sum($resources_found) > 0) {
225 225
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_resources'];
226
-    foreach($resources_found as $resource_id => $resource_amount) {
226
+    foreach ($resources_found as $resource_id => $resource_amount) {
227 227
       $msg_text_addon .= classLocale::$lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n";
228 228
     }
229 229
   }
230 230
 
231
-  if(!$msg_text) {
231
+  if (!$msg_text) {
232 232
     $messages = &classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages'];
233
-    if($outcome_mission_sub >= 0 && is_array($messages)) {
233
+    if ($outcome_mission_sub >= 0 && is_array($messages)) {
234 234
       $messages = &$messages[$outcome_mission_sub];
235 235
     }
236 236
 
237
-    $msg_text = is_string($messages) ? $messages :
238
-      (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
237
+    $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
239 238
   }
240 239
 
241 240
   $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type();
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 /**
16 16
  * Fleet mission "Relocate"
17 17
  *
18
- * @param $mission_data Mission
18
+ * @param Mission $mission_data Mission
19 19
  *
20 20
  * @copyright 2008 by Gorlum for Project "SuperNova.WS"
21 21
  */
Please login to merge, or discard this patch.
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/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 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -269,9 +269,11 @@
 block discarded – undo
269 269
   }
270 270
 
271 271
   // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету
272
-  if(!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet']
272
+  if(!isset($planet_row['id'])) {
273
+    // || $planet_row['id'] != $user['current_planet']
273 274
   {
274 275
     $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id');
276
+  }
275 277
     // Если текущей планеты не существует - выставляем Столицу
276 278
     if(!isset($planet_row['id'])) {
277 279
       $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id');
Please login to merge, or discard this patch.