Test Failed
Push — trunk ( b76cfb...dfde47 )
by SuperNova.WS
03:49
created
blitz_register.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@  discard block
 block discarded – undo
4 4
 
5 5
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
6 6
 
7
-if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
7
+if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
8 8
   $error_message = SN::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : (
9 9
     !SN::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : ''
10 10
   );
11 11
 
12
-  if($error_message) {
12
+  if ($error_message) {
13 13
     SnTemplate::messageBox($lang[$error_message], $lang['sys_error'], 'overview.php', 10);
14 14
     die();
15 15
   }
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 $current_round = intval(SN::$config->db_loadItem('game_blitz_register_round'));
20 20
 $current_price = intval(SN::$config->db_loadItem('game_blitz_register_price'));
21 21
 
22
-if(SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
22
+if (SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
23 23
   SN::db_transaction_start();
24 24
   $user = db_user_by_id($user['id'], true);
25 25
   $is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true);
26
-  if(sys_get_param_str('register_me')) {
27
-    if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
26
+  if (sys_get_param_str('register_me')) {
27
+    if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
28 28
       doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};");
29 29
       //mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
30 30
       SN::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 $blitz_players = 0;
46 46
 $blitz_prize_dark_matter = 0;
47 47
 $blitz_prize_places = 0;
48
-if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
49
-  if(sys_get_param_str('generate')) {
48
+if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
49
+  if (sys_get_param_str('generate')) {
50 50
     $next_id = 0;
51 51
     $query = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY RAND();");
52
-    while($row = db_fetch($query)) {
52
+    while ($row = db_fetch($query)) {
53 53
       $next_id++;
54 54
       $blitz_name = 'Игрок' . $next_id;
55 55
       $blitz_password = sys_random_string(8);
56 56
       doquery("UPDATE {{blitz_registrations}} SET blitz_name = '{$blitz_name}', blitz_password = '{$blitz_password}' WHERE `id` = {$row['id']} AND `round_number` = {$current_round};");
57 57
     }
58
-  } elseif(sys_get_param_str('import_generated')) {
58
+  } elseif (sys_get_param_str('import_generated')) {
59 59
     // ЭТО НА БЛИЦЕ!!!
60 60
     doquery("DELETE FROM {{users}} WHERE username like 'Игрок%';");
61 61
     doquery("DELETE FROM {{planets}} WHERE id_owner not in (SELECT `id` FROM {{users}});");
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     $system = $system_step;
78 78
     $planet = round(SN::$config->game_maxPlanet / 2);
79 79
 
80
-    foreach($imported_string as &$string_data) {
80
+    foreach ($imported_string as &$string_data) {
81 81
       $string_data = explode(',', $string_data);
82 82
       $username_safe = $string_data[0];
83 83
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
       $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], Universe::MOON_MAX_SIZE, false);
93 93
 
94
-      if(($system += $system_step) >= SN::$config->game_maxSystem) {
94
+      if (($system += $system_step) >= SN::$config->game_maxSystem) {
95 95
         $galaxy++;
96 96
         $system = $system_step;
97 97
       }
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 
101 101
     SN::$config->db_saveItem('users_amount', SN::$config->users_amount + $new_players);
102 102
     // generated_string
103
-  } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
103
+  } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
104 104
     $blitz_result = explode(';', $blitz_result_string);
105 105
     $blitz_last_update = $blitz_result[0]; // Пока не используется
106 106
     unset($blitz_result[0]);
107
-    foreach($blitz_result as $blitz_result_data) {
107
+    foreach ($blitz_result as $blitz_result_data) {
108 108
       $blitz_result_data = explode(',', $blitz_result_data);
109
-      if(count($blitz_result_data) == 5) {
109
+      if (count($blitz_result_data) == 5) {
110 110
         $blitz_result_data[1] = SN::$db->db_escape($blitz_result_data[1]);
111 111
         doquery(
112 112
           "UPDATE `{{blitz_registrations}}` SET
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
     $blitz_result = array();
121 121
   }
122 122
 
123
-  if(SN::$config->game_mode == GAME_BLITZ) {
123
+  if (SN::$config->game_mode == GAME_BLITZ) {
124 124
     $blitz_result = array(SN::$config->db_loadItem('var_stat_update'));
125 125
     $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;");
126
-    while($row = db_fetch($query)) {
126
+    while ($row = db_fetch($query)) {
127 127
       $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}";
128 128
     }
129 129
   } else {
130 130
     $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;");
131
-    while($row = db_fetch($query)) {
131
+    while ($row = db_fetch($query)) {
132 132
       $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
133 133
       $row['blitz_online'] ? $blitz_prize_players_active++ : false;
134 134
       $blitz_players++;
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
     'Игрок40'
144 144
     */
145 145
 
146
-    if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
146
+    if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
147 147
       // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
148 148
       $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
149 149
       SN::db_transaction_start();
150 150
       $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;");
151
-      while($row = db_fetch($query)) {
152
-        if(!$row['blitz_place']) {
151
+      while ($row = db_fetch($query)) {
152
+        if (!$row['blitz_place']) {
153 153
           continue;
154 154
         }
155 155
 
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
         $blitz_prize_places_actual--;
158 158
 
159 159
         $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
160
-pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']);
161
-        if($reward) {
160
+pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
161
+        if ($reward) {
162 162
           rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf(
163 163
             $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']
164 164
           ));
165 165
           doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};");
166 166
         }
167 167
 
168
-        if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
168
+        if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
169 169
           break;
170 170
         }
171 171
       }
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
     JOIN {{users}} AS u ON u.id = br.user_id
186 186
   WHERE br.`round_number` = {$current_round}
187 187
   order by `blitz_place`, `timestamp`;");
188
-while($row = db_fetch($query)) {
188
+while ($row = db_fetch($query)) {
189 189
   $tpl_player_data = array(
190 190
     'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)),
191 191
   );
192 192
 
193
-  if(SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
193
+  if (SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
194 194
     // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда
195 195
     $tpl_player_data = array_merge($tpl_player_data, array(
196 196
       'ID' => $row['id'],
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
   }
204 204
 
205 205
   $template->assign_block_vars('registrations', $tpl_player_data);
206
-  if($row['id'] == $user['id']) {
206
+  if ($row['id'] == $user['id']) {
207 207
     $player_registered = $row;
208 208
   }
209 209
 }
Please login to merge, or discard this patch.
classes/SN.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -452,11 +452,13 @@  discard block
 block discarded – undo
452 452
     $location_info = &static::$location_info[$location_type];
453 453
     $id_field = $location_info[P_ID];
454 454
     $table_name = $location_info[P_TABLE_NAME];
455
-    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
455
+    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
456
+      // TODO Как-то вернуть может быть LIMIT 1 ?
456 457
     {
457 458
       if (static::$db->db_affected_rows()) {
458 459
         // Обновляем данные только если ряд был затронут
459 460
         DBStaticUnit::cache_clear();
461
+    }
460 462
       }
461 463
     }
462 464
 
@@ -486,9 +488,11 @@  discard block
 block discarded – undo
486 488
     $set = trim($set);
487 489
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
488 490
     if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
489
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
491
+      if (static::$db->db_affected_rows()) {
492
+        // Обновляем данные только если ряд был затронут
490 493
       {
491 494
         $record_id = SN::$db->db_insert_id();
495
+      }
492 496
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
493 497
         $result = static::db_get_record_by_id($location_type, $record_id);
494 498
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -508,10 +512,12 @@  discard block
 block discarded – undo
508 512
     $id_field = $location_info[P_ID];
509 513
     $table_name = $location_info[P_TABLE_NAME];
510 514
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) {
511
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
515
+      if (static::$db->db_affected_rows()) {
516
+        // Обновляем данные только если ряд был затронут
512 517
       {
513 518
         DBStaticUnit::cache_clear();
514 519
       }
520
+      }
515 521
     }
516 522
 
517 523
     return $result;
@@ -525,11 +531,13 @@  discard block
 block discarded – undo
525 531
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
526 532
 
527 533
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) {
528
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
534
+      if (static::$db->db_affected_rows()) {
535
+        // Обновляем данные только если ряд был затронут
529 536
       {
530 537
         // Обнуление кэша, потому что непонятно, что поменялось
531 538
         DBStaticUnit::cache_clear();
532 539
       }
540
+      }
533 541
     }
534 542
 
535 543
     return $result;
Please login to merge, or discard this patch.
classes/Unit/DBStaticUnit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     $unit_snid = intval($unit_snid);
46 46
 
47
-    $resultOld = $unit_snid ? (isset($allUnits[$unit_snid]) ? $allUnits[$unit_snid] : null ) : $allUnits;
47
+    $resultOld = $unit_snid ? (isset($allUnits[$unit_snid]) ? $allUnits[$unit_snid] : null) : $allUnits;
48 48
 
49 49
     return $resultOld;
50 50
   }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
   }
88 88
 
89 89
   public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) {
90
-    $query  = doquery(
90
+    $query = doquery(
91 91
       "SELECT unit_snid, sum(unit_level) as `qty`  FROM {{unit}} WHERE `unit_player_id` = {$user_id} " .
92 92
       ($unit_type ? "AND `unit_type` = {$unit_type} " : '') .
93 93
       ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') .
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
    * @return bool
237 237
    */
238 238
   protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) {
239
-    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR,]))) {
239
+    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR, ]))) {
240 240
       return false;
241 241
     }
242 242
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 //        'unit_level'         => $level,
270 270
 //      ]);
271 271
 
272
-      $fields     += [
272
+      $fields += [
273 273
         'unit_type'  => get_unit_param($unitSnId, P_UNIT_TYPE),
274 274
         'unit_level' => $amount,
275 275
       ];
Please login to merge, or discard this patch.
classes/classConfig.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
238 238
 
239 239
     // Alliance bonus calculations
240
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
240
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
241 241
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
242
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
242
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
243 243
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
244 244
     'ali_bonus_members'            => 10, // Minimum alliance size to start using bonus
245 245
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
     'eco_scale_storage'            => 1,
283 283
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
284
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
284
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
285 285
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
286 286
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
287 287
 
@@ -292,21 +292,21 @@  discard block
 block discarded – undo
292 292
     'energy_basic_income'          => 0,
293 293
 
294 294
     // Bashing protection settings
295
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
296
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
297
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
298
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
299
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
295
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
296
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
297
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
298
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
299
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
300 300
 
301 301
     'Fleet_Cdr'   => 30,
302 302
     'fleet_speed' => 1,
303 303
 
304
-    self::FLEET_UPDATE_MAX_RUN_TIME => 30,     // Maximum length in seconds for single fleet dispatch run
304
+    self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run
305 305
     'fleet_update_interval'         => 4,
306 306
     'fleet_update_lock'             => '', // SQL time when lock was acquired
307 307
 
308
-    'game_adminEmail'       => 'root@localhost',    // Admin email to show to users
309
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
308
+    'game_adminEmail'       => 'root@localhost', // Admin email to show to users
309
+    'game_counter'          => 0, // Does built-in page hit counter is on?
310 310
     // Defaults
311 311
     'game_default_language' => 'ru',
312 312
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
     'game_maxSystem'      => 199,
321 321
     'game_maxPlanet'      => 15,
322 322
     // Game global settings
323
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
323
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
324 324
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
325 325
 
326 326
     'game_news_actual'        => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days
327
-    'game_news_overview'      => 3,    // How much last news to show in Overview page
328
-    'game_news_overview_show' => PERIOD_WEEK_2,    // How long news will be shown in Overview page in seconds. Default - 2 weeks
327
+    'game_news_overview'      => 3, // How much last news to show in Overview page
328
+    'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks
329 329
     // Noob protection
330
-    'game_noob_factor'        => 5,    // Multiplier to divide "stronger" and "weaker" users
330
+    'game_noob_factor'        => 5, // Multiplier to divide "stronger" and "weaker" users
331 331
     'game_noob_points'        => 5000, // Below this point user treated as noob. 0 to disable
332 332
 
333 333
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccount)
@@ -382,12 +382,12 @@  discard block
 block discarded – undo
382 382
     'payment_currency_exchange_wmz' => 1,
383 383
     'payment_currency_exchange_pln' => 3.86,
384 384
 
385
-    'payment_lot_price' => 1,     // Lot's price in default currency
386
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
385
+    'payment_lot_price' => 1, // Lot's price in default currency
386
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
387 387
 
388 388
     'planet_capital_cost'          => 25000, // Cost in DM to move Capital to current planet
389
-    'planet_capital_mining_rate'   => 2.0,   // Capital Mining rates
390
-    'planet_capital_building_rate' => 2.0,   // Capital Building rates
389
+    'planet_capital_mining_rate'   => 2.0, // Capital Mining rates
390
+    'planet_capital_building_rate' => 2.0, // Capital Building rates
391 391
     'planet_teleport_cost'         => 50000, // Cost of planet teleportation
392 392
     'planet_teleport_timeout'      => 86400, // Timeout for next teleportation
393 393
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     'resource_multiplier'     => 1,
410 410
 
411 411
     //Role play system
412
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral should get for partner have 1 DM bonus
412
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral should get for partner have 1 DM bonus
413 413
     'rpg_bonus_minimum'       => 10000, // Minimum DM amount for starting paying bonuses to affiliate
414 414
 
415 415
     // Black Market - General
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
     'url_purchase_metamatter' => '',
475 475
     'url_rules'               => '',
476 476
 
477
-    'users_amount'              => 1,                // Total users count
477
+    'users_amount'              => 1, // Total users count
478 478
     'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should consider ONLINE for online counter
479
-    'game_users_update_online'  => 30,               // How often user online should be refreshed (seconds)
480
-    'var_online_user_time'      => 0,                // When last time user online was refreshed
481
-    'var_online_user_count'     => 0,                // Last calculated online user count
482
-    'server_log_online'         => 0,                // Log online user count
479
+    'game_users_update_online'  => 30, // How often user online should be refreshed (seconds)
480
+    'var_online_user_time'      => 0, // When last time user online was refreshed
481
+    'var_online_user_count'     => 0, // Last calculated online user count
482
+    'server_log_online'         => 0, // Log online user count
483 483
 
484 484
     'user_birthday_celebrate' => 0, // When last time celebrations (i.e. gift-giving) was made - timestamp
485 485
     'user_birthday_gift'      => 0, // User birthday gift - Dark Matter points
Please login to merge, or discard this patch.
classes/SnTemplate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $insert_position = $is_positioned == '-' ? 0 : count($menu);
129 129
       }
130 130
 
131
-      $insert_position     += $is_positioned == '+' ? 1 : 0;
131
+      $insert_position += $is_positioned == '+' ? 1 : 0;
132 132
       $spliced             = array_splice($menu, $insert_position, count($menu) - $insert_position);
133 133
       $menu[$menu_item_id] = $menu_item;
134 134
 
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
    * @return array
542 542
    */
543 543
   public static function addFileName($fileNames, $anArray, $ext = '.css') {
544
-    if(!is_array($fileNames)) {
544
+    if (!is_array($fileNames)) {
545 545
       $fileNames = [$fileNames];
546 546
     }
547 547
 
548
-    foreach($fileNames as $fileName) {
548
+    foreach ($fileNames as $fileName) {
549 549
       if (file_exists(SN_ROOT_PHYSICAL . $fileName . '.min' . $ext)) {
550 550
         $anArray[$fileName . '.min' . $ext] = '';
551 551
       } elseif (file_exists(SN_ROOT_PHYSICAL . $fileName . '.css' . $ext)) {
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
       'LANG'     => $language ? $language : '',
677 677
       'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
678 678
 
679
-      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
679
+      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
680 680
       'FILENAME'       => basename($_SERVER['PHP_SELF']),
681 681
     ));
682 682
 
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
       'QUE_ID'   => QUE_RESEARCH,
910 910
       'QUE_HTML' => 'topnav',
911 911
 
912
-      'RESEARCH_ONGOING' => (boolean)$user['que'],
912
+      'RESEARCH_ONGOING' => (boolean) $user['que'],
913 913
 
914 914
       'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
915 915
         $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
       SnTemplate::renderFooter($page, $template_result);
1200 1200
     }
1201 1201
 
1202
-    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
1202
+    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
1203 1203
 
1204 1204
     SN::$db->db_disconnect();
1205 1205
 
Please login to merge, or discard this patch.
tools/classes/ImageContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
   }
55 55
 
56 56
   public function __get($property) {
57
-    if (in_array($property, ['height', 'width',]) && ($this->$property === -1)) {
57
+    if (in_array($property, ['height', 'width', ]) && ($this->$property === -1)) {
58 58
       if (isset($this->image)) {
59 59
         $this->width  = imagesx($this->image);
60 60
         $this->height = imagesy($this->image);
Please login to merge, or discard this patch.
tools/classes/ImageFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
   }
51 51
 
52 52
   public function __get($property) {
53
-    if (in_array($property, ['height', 'width',])) {
53
+    if (in_array($property, ['height', 'width', ])) {
54 54
       return $this->getImageContainer() ? $this->getImageContainer()->$property : 0;
55 55
     }
56 56
 
Please login to merge, or discard this patch.
includes/functions/_news.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @param int      $query_limit
10 10
  */
11 11
 function nws_render(&$user, &$template, $query_where = '', $query_limit = 20) {
12
-  if($user['authlevel'] < AUTH_LEVEL_ADMINISTRATOR) {
12
+  if ($user['authlevel'] < AUTH_LEVEL_ADMINISTRATOR) {
13 13
     $query_where .= (!empty($query_where) ? ' AND ' : '')
14 14
       . '`tsTimeStamp` <= (NOW())';
15 15
   }
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +31 added lines, -32 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Player\playerTimeDiff;
10 10
 
11 11
 // Защита от двойного инита
12
-if(defined('INIT')) {
12
+if (defined('INIT')) {
13 13
   return;
14 14
 }
15 15
 
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 !defined('INSTALL') && define('INSTALL', false);
25 25
 !defined('IN_PHPBB') && define('IN_PHPBB', true);
26 26
 
27
-call_user_func(function () {
27
+call_user_func(function() {
28 28
   if (file_exists($fileName = realpath(__DIR__ . '/../.env.ini'))) {
29 29
     define('SN_ENV_PROD', 'production');
30 30
     define('SN_ENV_DEV', 'development');
31 31
 
32 32
     if (($ini = @parse_ini_file($fileName)) !== false) {
33
-      if (!empty($ini['SN_ENV']) && in_array($envName = $ini['SN_ENV'], [SN_ENV_DEV, SN_ENV_PROD,])) {
33
+      if (!empty($ini['SN_ENV']) && in_array($envName = $ini['SN_ENV'], [SN_ENV_DEV, SN_ENV_PROD, ])) {
34 34
         define('SN_ENV', $envName);
35 35
       } else {
36 36
         define('SN_ENV', SN_ENV_PROD);
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 // Detecting if we are under Google's eye - domain is prefixed with `google.`
64 64
 $_server_server_name =
65
-  isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] :
66
-    (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
65
+  isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
67 66
 if (substr(strtolower($_server_server_name), 0, 7) === 'google.') {
68 67
   define('SN_GOOGLE', true);
69 68
 } else {
@@ -73,7 +72,7 @@  discard block
 block discarded – undo
73 72
 // Instancing
74 73
 // If server name contains port - replacing : with _ - servers on different ports are different instances
75 74
 $instanceName = str_replace(':', '_', $_server_server_name);
76
-if(SN_GOOGLE) {
75
+if (SN_GOOGLE) {
77 76
   $instanceName = substr($instanceName, 7);
78 77
 }
79 78
 $instancePath = 'servers/' . $instanceName . '/';
@@ -207,40 +206,40 @@  discard block
 block discarded – undo
207 206
 // Но нужно, пока у нас есть не MVC-страницы
208 207
 $sn_page_data      = $sn_mvc['pages'][$sn_page_name];
209 208
 $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
210
-if($sn_page_name) {
209
+if ($sn_page_name) {
211 210
   // Merging page options to global option pull
212
-  if(is_array($sn_page_data['options'])) {
211
+  if (is_array($sn_page_data['options'])) {
213 212
     SN::$options = array_merge(SN::$options, $sn_page_data['options']);
214 213
   }
215 214
 
216
-  if(isset($sn_page_data) && file_exists($sn_page_name_file)) {
215
+  if (isset($sn_page_data) && file_exists($sn_page_name_file)) {
217 216
     require_once($sn_page_name_file);
218 217
   }
219 218
 }
220 219
 
221
-if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
220
+if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
222 221
   SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true;
223 222
 }
224 223
 
225 224
 
226 225
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
227 226
 // TODO - костыль, что бы работали старые модули. Убрать!
228
-if(is_array($sn_data['pages'])) {
227
+if (is_array($sn_data['pages'])) {
229 228
   $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']);
230 229
 }
231
-if(!isset($sn_mvc['pages'][$sn_page_name])) {
230
+if (!isset($sn_mvc['pages'][$sn_page_name])) {
232 231
   $sn_page_name = '';
233 232
 }
234 233
 
235 234
 $lang->lng_switch(sys_get_param_str('lang'));
236 235
 
237 236
 
238
-if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
237
+if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
239 238
   VersionCheckerDeprecated::performCheckVersion();
240 239
 }
241 240
 
242 241
 SN::$gc->watchdog->register(new TaskDispatchFleets(), TaskDispatchFleets::class);
243
-SN::$gc->worker->registerWorker('dispatchFleets', function () {
242
+SN::$gc->worker->registerWorker('dispatchFleets', function() {
244 243
   \Core\Worker::detachIncomingRequest();
245 244
 
246 245
   $result = SN::$gc->fleetDispatcher->flt_flying_fleet_handler();
@@ -263,16 +262,16 @@  discard block
 block discarded – undo
263 262
   die(json_encode($result));
264 263
 }
265 264
 
266
-if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
265
+if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
267 266
   require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php');
268 267
   sn_user_birthday_celebrate();
269 268
 }
270 269
 
271
-if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
270
+if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
272 271
   dbUpdateUsersCount(db_user_count());
273 272
   dbUpdateUsersOnline(db_user_count(true));
274 273
   SN::$config->pass()->var_online_user_time = SN_TIME_NOW;
275
-  if(SN::$config->server_log_online) {
274
+  if (SN::$config->server_log_online) {
276 275
     /** @noinspection SqlResolve */
277 276
     doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";");
278 277
   }
@@ -296,7 +295,7 @@  discard block
 block discarded – undo
296 295
 
297 296
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
298 297
 
299
-if(!empty($user['id'])) {
298
+if (!empty($user['id'])) {
300 299
   SN::$user_options->user_change($user['id']);
301 300
 }
302 301
 
@@ -309,7 +308,7 @@  discard block
 block discarded – undo
309 308
         : false
310 309
       );
311 310
 
312
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
311
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
313 312
   $prohibited_characters = array_map(function($value) {
314 313
     return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
315 314
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
@@ -317,7 +316,7 @@  discard block
 block discarded – undo
317 316
 }
318 317
 
319 318
 
320
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
319
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
321 320
   pdump('Отключи отладку перед продакшном!');
322 321
 }
323 322
 
@@ -332,7 +331,7 @@  discard block
 block discarded – undo
332 331
 // TODO - to scheduler
333 332
 StatUpdateLauncher::unlock();
334 333
 
335
-if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
334
+if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
336 335
   $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br(
337 336
     SN::$config->game_disable == GAME_DISABLE_REASON
338 337
       ? SN::$config->game_disable_reason
@@ -341,33 +340,33 @@  discard block
 block discarded – undo
341 340
 
342 341
   // For API - just skipping all checks
343 342
   // TODO: That is ideologically wrong and should be redone
344
-  if(defined('IN_API')) {
343
+  if (defined('IN_API')) {
345 344
     return;
346 345
   }
347 346
 
348 347
   // Actions for install mode
349
-  if(defined('INSTALL_MODE') && INSTALL_MODE) {
348
+  if (defined('INSTALL_MODE') && INSTALL_MODE) {
350 349
     // Handling log out - should work even in install mode
351
-    if(strtolower(INITIAL_PAGE) === 'logout') {
350
+    if (strtolower(INITIAL_PAGE) === 'logout') {
352 351
       SN::$auth->logout(true);
353 352
       die();
354 353
     }
355 354
 
356 355
     // If user not logged in AND we are not on login page - redirect user there
357
-    if(!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) {
356
+    if (!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) {
358 357
       header('Location: login.php');
359 358
       die();
360 359
     }
361 360
 
362 361
     // If user is type of admin AND in user pages - redirecting him to admin interface
363 362
     // You really shouldn't mess in user interface until game not configured!
364
-    if($user['authlevel'] >= 1 && !defined('IN_ADMIN')) {
363
+    if ($user['authlevel'] >= 1 && !defined('IN_ADMIN')) {
365 364
       header('Location: ' . SN_ROOT_VIRTUAL_PARENT . 'admin/overview.php');
366 365
       die();
367 366
     }
368 367
   }
369 368
 
370
-  if(
369
+  if (
371 370
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
372 371
     &&
373 372
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -383,8 +382,8 @@  discard block
 block discarded – undo
383 382
 // TODO ban
384 383
 // TODO $skip_ban_check
385 384
 global $skip_ban_check;
386
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
387
-  if(defined('IN_API')) {
385
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
386
+  if (defined('IN_API')) {
388 387
     return;
389 388
   }
390 389
 
@@ -398,10 +397,10 @@  discard block
 block discarded – undo
398 397
 $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']);
399 398
 
400 399
 
401
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
400
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
402 401
   sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
403
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
404
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
402
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
403
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
405 404
   sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
406 405
 }
407 406
 
Please login to merge, or discard this patch.