Passed
Push — trunk ( e5589f...062c60 )
by SuperNova.WS
06:16
created
includes/includes/flt_page3.inc 1 patch
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use Planet\DBStaticPlanet;
9 9
 use Unit\DBStaticUnit;
10 10
 
11
-if(SN_IN_FLEET !== true) {
11
+if (SN_IN_FLEET !== true) {
12 12
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
13 13
 }
14 14
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     $errorlist .= $lang['fl_limit_galaxy'];
28 28
   if (!$system || $system > $config->game_maxSystem || $system < 1)
29 29
     $errorlist .= $lang['fl_limit_system'];
30
-  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE ))
30
+  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE))
31 31
     $errorlist .= $lang['fl_limit_planet'];
32 32
   if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type)
33 33
     $errorlist .= $lang['fl_ownpl_err'];
@@ -54,35 +54,35 @@  discard block
 block discarded – undo
54 54
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
55 55
 
56 56
   if ($target_mission == MT_EXPLORE) {
57
-    if ($MaxExpeditions == 0 ) {
57
+    if ($MaxExpeditions == 0) {
58 58
       $errorlist .= $lang['fl_expe_notech'];
59
-    } elseif ($FlyingExpeditions >= $MaxExpeditions ) {
59
+    } elseif ($FlyingExpeditions >= $MaxExpeditions) {
60 60
       $errorlist .= $lang['fl_expe_max'];
61 61
     }
62 62
   } else {
63
-    if ($TargetPlanet['id_owner']){
63
+    if ($TargetPlanet['id_owner']) {
64 64
       if ($target_mission == MT_COLONIZE)
65 65
         $errorlist .= $lang['fl_colonized'];
66 66
 
67
-      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){
67
+      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) {
68 68
         if ($target_mission == MT_ATTACK)
69 69
           $errorlist .= $lang['fl_no_self_attack'];
70 70
 
71 71
         if ($target_mission == MT_SPY)
72 72
           $errorlist .= $lang['fl_no_self_spy'];
73
-      }else{
73
+      } else {
74 74
         if ($target_mission == MT_RELOCATE)
75 75
           $errorlist .= $lang['fl_only_stay_at_home'];
76 76
       }
77
-    }else{
78
-      if ($target_mission < MT_COLONIZE){
77
+    } else {
78
+      if ($target_mission < MT_COLONIZE) {
79 79
         $errorlist .= $lang['fl_unknow_target'];
80
-      }else{
80
+      } else {
81 81
         if ($target_mission == MT_DESTROY)
82 82
           $errorlist .= $lang['fl_nomoon'];
83 83
 
84
-        if ($target_mission == MT_RECYCLE){
85
-          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
84
+        if ($target_mission == MT_RECYCLE) {
85
+          if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
86 86
             $errorlist .= $lang['fl_nodebris'];
87 87
         }
88 88
       }
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
   }
91 91
 
92 92
 
93
-  if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) {
93
+  if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) {
94 94
     $captain = $captainModule->unit_captain_get($planetrow['id']);
95 95
 //      mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true);
96
-    if(!$captain) {
96
+    if (!$captain) {
97 97
       $errorlist .= $lang['module_unit_captain_error_no_captain'];
98
-    } elseif($captain['unit_location_type'] == LOC_PLANET) {
99
-      if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
98
+    } elseif ($captain['unit_location_type'] == LOC_PLANET) {
99
+      if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
100 100
         $errorlist .= $lang['module_unit_captain_error_captain_already_bound'];
101 101
       }
102 102
     } else {
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 
107 107
   if ($errorlist) {
108 108
     sn_db_transaction_rollback();
109
-    messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
109
+    messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
110 110
   }
111 111
 
112 112
   // On verifie s'il y a assez de vaisseaux sur la planete !
113 113
   foreach ($fleetarray as $Ship => $Count) {
114 114
     if ($Count > mrc_get_level($user, $planetrow, $Ship)) {
115
-      messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
115
+      messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
116 116
     }
117 117
   }
118 118
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
   $fleet_group = max(0, intval($_POST['fleet_group']));
121 121
   //But is it acs??
122 122
   //Well all acs fleets must have a fleet code.
123
-  if($fleet_group) {
123
+  if ($fleet_group) {
124 124
     //Also it must be mission type 2
125 125
     $target_mission = MT_AKS;
126 126
 
127 127
     //The co-ords must be the same as where the acs fleet is going.
128 128
     $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}";
129
-    if($_POST['acs_target_mr'] == $target) {
129
+    if ($_POST['acs_target_mr'] == $target) {
130 130
       //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!)
131 131
       $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true);
132 132
       if (!$aks) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
   }
144 144
   //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet.
145
-  if(!$fleet_group && $target_mission == MT_AKS) {
145
+  if (!$fleet_group && $target_mission == MT_AKS) {
146 146
     $target_mission = MT_ATTACK;
147 147
   }
148 148
 
@@ -152,22 +152,21 @@  discard block
 block discarded – undo
152 152
   $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded];
153 153
   $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options);
154 154
 
155
-  if($cant_attack !== ATTACK_ALLOWED) {
155
+  if ($cant_attack !== ATTACK_ALLOWED) {
156 156
     messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99);
157 157
   }
158 158
 
159 159
   $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
160 160
   if (!in_array($speed_percent, $speed_possible)) {
161
-    messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
161
+    messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
162 162
   }
163 163
 
164 164
   $fleet['start_time'] = $duration + SN_TIME_NOW;
165 165
 
166
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
167
-    ($target_mission == MT_HOLD ? 12 : 0);
168
-  if($max_duration) {
166
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0);
167
+  if ($max_duration) {
169 168
     $StayDuration = sys_get_param_id('missiontime');
170
-    if($StayDuration > $max_duration || $StayDuration < 1) {
169
+    if ($StayDuration > $max_duration || $StayDuration < 1) {
171 170
       $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true));
172 171
       die();
173 172
     }
@@ -177,11 +176,11 @@  discard block
 block discarded – undo
177 176
     $StayDuration = 0;
178 177
     $StayTime     = 0;
179 178
   }
180
-  $fleet['end_time']   = $StayDuration + (2 * $duration) + SN_TIME_NOW;
179
+  $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW;
181 180
 
182
-  if($aks && $target_mission == MT_AKS) {
183
-    if ($fleet['start_time']>$aks['ankunft']) {
184
-      messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']);
181
+  if ($aks && $target_mission == MT_AKS) {
182
+    if ($fleet['start_time'] > $aks['ankunft']) {
183
+      messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']);
185 184
     }
186 185
     $fleet['start_time'] = $aks['ankunft'];
187 186
     $fleet['end_time'] = $aks['ankunft'] + $duration;
@@ -191,21 +190,21 @@  discard block
 block discarded – undo
191 190
   $FleetShipCount      = 0;
192 191
   $db_changeset = array();
193 192
   foreach ($fleetarray as $Ship => $Count) {
194
-    $FleetStorage    += get_unit_param($Ship, P_CAPACITY) * $Count;
193
+    $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count;
195 194
     $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']);
196 195
   }
197 196
   $fleet_array = sys_unit_arr2str($fleetarray);
198
-  $FleetShipCount  += array_sum($fleetarray);
199
-  $FleetStorage        -= $consumption;
197
+  $FleetShipCount += array_sum($fleetarray);
198
+  $FleetStorage -= $consumption;
200 199
 
201
-  if ( $StorageNeeded > $FleetStorage) {
202
-    messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
200
+  if ($StorageNeeded > $FleetStorage) {
201
+    messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
203 202
   }
204 203
   if ($planetrow['deuterium'] < $TransDeuterium + $consumption) {
205
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
204
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
206 205
   }
207 206
   if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) {
208
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
207
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
209 208
   }
210 209
 
211 210
   $fleet_set = array(
@@ -247,7 +246,7 @@  discard block
 block discarded – undo
247 246
 //    ));
248 247
 //  }
249 248
 
250
-  if(is_array($captain)) {
249
+  if (is_array($captain)) {
251 250
     DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}");
252 251
   }
253 252
 
@@ -260,7 +259,7 @@  discard block
 block discarded – undo
260 259
     'START_LEFT'         => floor($fleet['end_time'] + 1 - SN_TIME_NOW),
261 260
   );
262 261
 
263
-  if(!empty($TargetPlanet)) {
262
+  if (!empty($TargetPlanet)) {
264 263
     $template_route += array(
265 264
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
266 265
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -273,8 +272,8 @@  discard block
 block discarded – undo
273 272
   $template->assign_block_vars('fleets', $template_route);
274 273
 
275 274
   $sn_groups_fleet = sn_get_groups('fleet');
276
-  foreach($fleetarray as $ship_id => $ship_count) {
277
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
275
+  foreach ($fleetarray as $ship_id => $ship_count) {
276
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
278 277
 //      $ship_base_data = get_ship_data($ship_id, $user);
279 278
       $template->assign_block_vars('fleets.ships', array(
280 279
         'ID'          => $ship_id,
Please login to merge, or discard this patch.
classes/classConfig.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
171 171
 
172 172
     // Alliance bonus calculations
173
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
173
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
174 174
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
175
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
175
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
176 176
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
177 177
     'ali_bonus_members'            => 10, // Minimum alliance size to start using bonus
178 178
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
     'eco_scale_storage'            => 1,
216 216
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
217
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
217
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
218 218
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
219 219
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
220 220
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
     'energy_basic_income'          => 0,
226 226
 
227 227
     // Bashing protection settings
228
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
229
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
230
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
231
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
232
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
228
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
229
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
230
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
231
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
232
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
233 233
 
234 234
     'Fleet_Cdr'   => 30,
235 235
     'fleet_speed' => 1,
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
     'fleet_update_interval' => 4,
238 238
     'fleet_update_lock'     => '', // SQL time when lock was acquired
239 239
 
240
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
241
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
240
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
241
+    'game_counter'          => 0, // Does built-in page hit counter is on?
242 242
     // Defaults
243 243
     'game_default_language' => 'ru',
244 244
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
     'game_maxSystem'      => 199,
253 253
     'game_maxPlanet'      => 15,
254 254
     // Game global settings
255
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
255
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
256 256
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
257 257
 
258 258
     'game_news_actual'        => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days
259
-    'game_news_overview'      => 3,    // How much last news to show in Overview page
260
-    'game_news_overview_show' => PERIOD_WEEK_2,    // How long news will be shown in Overview page in seconds. Default - 2 weeks
259
+    'game_news_overview'      => 3, // How much last news to show in Overview page
260
+    'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks
261 261
     // Noob protection
262
-    'game_noob_factor'        => 5,    // Multiplier to divide "stronger" and "weaker" users
262
+    'game_noob_factor'        => 5, // Multiplier to divide "stronger" and "weaker" users
263 263
     'game_noob_points'        => 5000, // Below this point user threated as noob. 0 to disable
264 264
 
265 265
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
     'payment_currency_exchange_wmu' => 30,
314 314
     'payment_currency_exchange_wmz' => 1,
315 315
 
316
-    'payment_lot_price' => 1,     // Lot price in default currency
317
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
316
+    'payment_lot_price' => 1, // Lot price in default currency
317
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
318 318
 
319 319
     'planet_capital_cost'          => 25000, // Cost in DM to move Capital to current planet
320
-    'planet_capital_mining_rate'   => 2.0,   // Capital Mining rates
321
-    'planet_capital_building_rate' => 2.0,   // Capital Building rates
320
+    'planet_capital_mining_rate'   => 2.0, // Capital Mining rates
321
+    'planet_capital_building_rate' => 2.0, // Capital Building rates
322 322
     'planet_teleport_cost'         => 50000, // Cost of planet teleportation
323 323
     'planet_teleport_timeout'      => 86400, // Timeout for next teleportation
324 324
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     'resource_multiplier'     => 1,
341 341
 
342 342
     //Roleplay system
343
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
343
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
344 344
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
345 345
 
346 346
     // Black Market - General
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
     'url_purchase_metamatter' => '',
406 406
     'url_rules'               => '',
407 407
 
408
-    'users_amount'              => 1,                // Total users count
408
+    'users_amount'              => 1, // Total users count
409 409
     'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should considered ONLINE for online counter
410
-    'game_users_update_online'  => 30,               // How often user online should be refreshed (seconds)
411
-    'var_online_user_time'      => 0,                // When last time user online was refreshed
412
-    'var_online_user_count'     => 0,                // Last calculated online user count
413
-    'server_log_online'         => 0,                // Log online user count
410
+    'game_users_update_online'  => 30, // How often user online should be refreshed (seconds)
411
+    'var_online_user_time'      => 0, // When last time user online was refreshed
412
+    'var_online_user_count'     => 0, // Last calculated online user count
413
+    'server_log_online'         => 0, // Log online user count
414 414
 
415 415
     'user_birthday_celebrate' => 0, // When last time celebrations (i.e. giftgiving) was made
416 416
     'user_birthday_gift'      => 0, // User birthday gift
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use Player\playerTimeDiff;
5 5
 
6 6
 // Защита от двойного инита
7
-if(defined('INIT')) {
7
+if (defined('INIT')) {
8 8
   return;
9 9
 }
10 10
 
@@ -124,48 +124,48 @@  discard block
 block discarded – undo
124 124
 // Но нужно, пока у нас есть не MVC-страницы
125 125
 $sn_page_data = $sn_mvc['pages'][$sn_page_name];
126 126
 $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
127
-if($sn_page_name) {
127
+if ($sn_page_name) {
128 128
   // Merging page options to global option pull
129
-  if(is_array($sn_page_data['options'])) {
129
+  if (is_array($sn_page_data['options'])) {
130 130
     SN::$options = array_merge(SN::$options, $sn_page_data['options']);
131 131
   }
132 132
 
133
-  if(isset($sn_page_data) && file_exists($sn_page_name_file)) {
133
+  if (isset($sn_page_data) && file_exists($sn_page_name_file)) {
134 134
     require_once($sn_page_name_file);
135 135
   }
136 136
 }
137 137
 
138
-if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
138
+if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
139 139
   SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true;
140 140
 }
141 141
 
142 142
 
143 143
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
144 144
 // TODO - костыль, что бы работали старые модули. Убрать!
145
-if(is_array($sn_data['pages'])) {
145
+if (is_array($sn_data['pages'])) {
146 146
   $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']);
147 147
 }
148
-if(!isset($sn_mvc['pages'][$sn_page_name])) {
148
+if (!isset($sn_mvc['pages'][$sn_page_name])) {
149 149
   $sn_page_name = '';
150 150
 }
151 151
 
152 152
 $lang->lng_switch(sys_get_param_str('lang'));
153 153
 
154 154
 
155
-if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
155
+if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
156 156
   \Common\Tools\VersionCheckerDeprecated::performCheckVersion();
157 157
 }
158 158
 
159
-if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
159
+if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
160 160
   require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php');
161 161
   sn_user_birthday_celebrate();
162 162
 }
163 163
 
164
-if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
164
+if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
165 165
   dbUpdateUsersCount(db_user_count());
166 166
   dbUpdateUsersOnline(db_user_count(true));
167 167
   SN::$config->pass()->var_online_user_time = SN_TIME_NOW;
168
-  if(SN::$config->server_log_online) {
168
+  if (SN::$config->server_log_online) {
169 169
     doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";");
170 170
   }
171 171
 }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
190 190
 
191
-if(!empty($user['id'])) {
191
+if (!empty($user['id'])) {
192 192
   SN::$user_options->user_change($user['id']);
193 193
 }
194 194
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         : false
202 202
       );
203 203
 
204
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
204
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
205 205
   $prohibited_characters = array_map(function($value) {
206 206
     return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
207 207
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 }
210 210
 
211 211
 
212
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
212
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
213 213
   pdump('Отключи отладку перед продакшном!');
214 214
 }
215 215
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 
224 224
 StatUpdateLauncher::unlock();
225 225
 
226
-if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
226
+if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
227 227
   $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br(
228 228
     SN::$config->game_disable == GAME_DISABLE_REASON
229 229
       ? SN::$config->game_disable_reason
230 230
       : $lang['sys_game_disable_reason'][SN::$config->game_disable]
231 231
   );
232
-  if(defined('IN_API')) {
232
+  if (defined('IN_API')) {
233 233
     return;
234 234
   }
235 235
 
236
-  if(
236
+  if (
237 237
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
238 238
     &&
239 239
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 
249 249
 // TODO ban
250 250
 // TODO $skip_ban_check
251
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
252
-  if(defined('IN_API')) {
251
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
252
+  if (defined('IN_API')) {
253 253
     return;
254 254
   }
255 255
 
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']);
264 264
 
265 265
 
266
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
266
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
267 267
   sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
268
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
269
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
268
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
269
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
270 270
   sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
271 271
 }
272 272
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
   'fleet_update_last',
290 290
   SN::$config->fleet_update_interval,
291 291
   // Promise
292
-  function () {SN::$gc->fleetDispatcher->dispatch();},
292
+  function() {SN::$gc->fleetDispatcher->dispatch(); },
293 293
   WATCHDOG_TIME_SQL,
294 294
   false
295 295
 );
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function sys_user_vacation($user) {
13 13
   global $config;
14 14
 
15
-  if(sys_get_param_str('vacation') == 'leave') {
15
+  if (sys_get_param_str('vacation') == 'leave') {
16 16
     if ($user['vacation'] < SN_TIME_NOW) {
17 17
       $user['vacation'] = 0;
18 18
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
   }
22 22
 
23
-  if($user['vacation']) {
23
+  if ($user['vacation']) {
24 24
     // sn_sys_logout(false, true);
25 25
     // core_auth::logout(false, true);
26 26
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
164 164
   $user_new = db_user_by_id(db_insert_id());
165 165
 
166
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
166
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
167 167
     $options['galaxy'] = SN::$config->LastSettedGalaxyPos;
168 168
     $options['system'] = SN::$config->LastSettedSystemPos;
169 169
     $segment_size = floor(SN::$config->game_maxPlanet / 3);
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
     $segment++;
172 172
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
173 173
 
174
-    while(true) {
175
-      if($options['planet'] > SN::$config->game_maxPlanet) {
174
+    while (true) {
175
+      if ($options['planet'] > SN::$config->game_maxPlanet) {
176 176
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
177 177
         $options['system']++;
178 178
       }
179
-      if($options['system'] > SN::$config->game_maxSystem) {
179
+      if ($options['system'] > SN::$config->game_maxSystem) {
180 180
         $options['system'] = 1;
181 181
         $options['galaxy']++;
182 182
       }
183 183
       $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
184 184
 
185 185
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
186
-      if(!$galaxy_row['id']) {
186
+      if (!$galaxy_row['id']) {
187 187
         SN::$config->db_saveItem(array(
188 188
           'LastSettedGalaxyPos' => $options['galaxy'],
189 189
           'LastSettedSystemPos' => $options['system'],
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
   $username_safe = db_escape($username_unsafe);
205 205
   doquery("REPLACE INTO `{{player_name_history}}` SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
206 206
 
207
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
207
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
208 208
     doquery("INSERT INTO `{{referrals}}` SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
209 209
   }
210 210
 
Please login to merge, or discard this patch.
includes/constants/constants_units.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 
155 155
 // === Artifacts
156 156
 define('UNIT_ARTIFACTS', 1000);
157
-define('ART_LHC', 1001);      // Additional moon chance
158
-define('ART_RCD_SMALL', 1002);   // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
159
-define('ART_RCD_MEDIUM', 1003);  // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
160
-define('ART_RCD_LARGE', 1004);   // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
157
+define('ART_LHC', 1001); // Additional moon chance
158
+define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
159
+define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
160
+define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
161 161
 define('ART_HEURISTIC_CHIP', 1005); // Speed up research
162 162
 define('ART_NANO_BUILDER', 1006); // Speed up building
163 163
 define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions
@@ -231,25 +231,25 @@  discard block
 block discarded – undo
231 231
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место
232 232
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место
233 233
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место
234
-define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
235
-define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_BEST', 2205);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2017 года
236
-define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_QUEEN', 2206);  // Медаль Королевы Весны за максимум полученной ММ/максимум полученных подарков от Мужчины во время ивента 8 марта 2017 года
234
+define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
235
+define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_BEST', 2205); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2017 года
236
+define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_QUEEN', 2206); // Медаль Королевы Весны за максимум полученной ММ/максимум полученных подарков от Мужчины во время ивента 8 марта 2017 года
237 237
 define('UNIT_AWARD_MEDAL_8_MARCH_BEST_CAVALIER_AMOUNT', 2207); // Медаль Лучшему Кавалеру за максимум потраченной ММ Женщине от Мужчины во время ивента 8 марта 2017 года
238 238
 define('UNIT_AWARD_MEDAL_8_MARCH_BEST_CAVALIER_COUNT', 2208); // Медаль Лучшему Кавалеру за максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2017 года
239 239
 define('UNIT_AWARD_MEDAL_8_MARCH_SPRING_QUEEN_AMOUNT', 2209); // Медаль Королевы Весны за максимум полученной ММ от Мужчины во время ивента 8 марта 2017 года
240 240
 define('UNIT_AWARD_MEDAL_8_MARCH_SPRING_QUEEN_COUNT', 2210); // Медаль Королевы Весны за максимум полученных подарков от Мужчины во время ивента 8 марта 2017 года
241 241
 
242 242
 define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд
243
-define('UNIT_AWARD_MEMORY_IMMORTAL', 2301);  // Бессмертный
244
-define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
243
+define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный
244
+define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
245 245
 define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда
246 246
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН
247 247
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН
248 248
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН
249 249
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН
250 250
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН
251
-define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
252
-define('UNIT_AWARD_MEMORY_2017_WOMEN_DAY', 2310);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2017 года
251
+define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
252
+define('UNIT_AWARD_MEMORY_2017_WOMEN_DAY', 2310); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2017 года
253 253
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_SIMPLE', 2311); // День Рождения СН - 2017
254 254
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_BRONZE', 2312); // День Рождения СН - 2017
255 255
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_SILVER', 2313); // День Рождения СН - 2017
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 const GROUP_UNIT_OBJECTS_IN_SPACE = 790002;
333 333
 
334 334
 
335
-define('GROUP_PART',         800000); // Зарезервировано для запчастей: 800.001 - 899.999
335
+define('GROUP_PART', 800000); // Зарезервировано для запчастей: 800.001 - 899.999
336 336
 // define('GROUP_PART_HULL',    801000); // Корпуса - 1000 штук
337 337
 // define('GROUP_PART_ARMOR',   802000); // Броня - 1000 штук
338 338
 // define('GROUP_PART_SHIELD',  803000); // Щиты - 1000 штук
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 
341 341
 
342 342
 define('UNIT_GROUP', 'groups'); // 900.000 // Зарезервировано для груп юнитов: 900.001 - 999.999
343
-define('GROUP_UNIT_USER', 1000000);// Зарезервировано для пользовательских юнитов: 1.000.001 - 1.999.999
344
-define('GROUP_ID_RESERVED', 2000000);// Зарезервировано для прочих нужд: 2.000.000 - 1.999.999.999
345
-define('GROUP_PARAMS', 1000000000);// Зарезервировано для параметров: 1.000.000.001 - 1.999.999.999
346
-define('GROUP_DEVELOPERS', 2000000000);// Пространство для разработчиков: 2.000.000.001 - 2.147.483.647
343
+define('GROUP_UNIT_USER', 1000000); // Зарезервировано для пользовательских юнитов: 1.000.001 - 1.999.999
344
+define('GROUP_ID_RESERVED', 2000000); // Зарезервировано для прочих нужд: 2.000.000 - 1.999.999.999
345
+define('GROUP_PARAMS', 1000000000); // Зарезервировано для параметров: 1.000.000.001 - 1.999.999.999
346
+define('GROUP_DEVELOPERS', 2000000000); // Пространство для разработчиков: 2.000.000.001 - 2.147.483.647
347 347
 
348 348
 define('UNIT_PLAYER_COLONIES_CURRENT', 'COLONIES_CURRENT');
349 349
 define('UNIT_PLAYER_COLONIES_MAX', 'COLONIES_MAX');
Please login to merge, or discard this patch.