Test Failed
Push — trunk ( b76cfb...dfde47 )
by SuperNova.WS
03:49
created
classes/debug.php 1 patch
Spacing   +39 added lines, -40 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * que esperabas!!! soy newbie!!! D':<
26 26
 */
27 27
 
28
-if(!defined('INSIDE')) {
28
+if (!defined('INSIDE')) {
29 29
   die("attemp hacking");
30 30
 }
31 31
 
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     $result = array();
85 85
     $transaction_id = SN::db_transaction_check(false) ? SN::$transaction_id : SN::$transaction_id++;
86 86
     $result[] = "tID {$transaction_id}";
87
-    foreach($backtrace as $a_trace) {
88
-      if(in_array($a_trace['function'], $exclude_functions)) {
87
+    foreach ($backtrace as $a_trace) {
88
+      if (in_array($a_trace['function'], $exclude_functions)) {
89 89
         continue;
90 90
       }
91 91
       $function =
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
       $line = !empty($a_trace['line']) ? $a_trace['line'] : '_UNDEFINED_';
103 103
       $result[] = "{$function} - '{$file}' Line {$line}";
104 104
 
105
-      if(!$long_comment) {
105
+      if (!$long_comment) {
106 106
         break;
107 107
       }
108 108
     }
@@ -111,26 +111,26 @@  discard block
 block discarded – undo
111 111
   }
112 112
 
113 113
   function dump($dump = false, $force_base = false, $deadlock = false) {
114
-    if($dump === false) {
114
+    if ($dump === false) {
115 115
       return [];
116 116
     }
117 117
 
118 118
     $error_backtrace = array();
119 119
     $base_dump = false;
120 120
 
121
-    if($force_base === true) {
121
+    if ($force_base === true) {
122 122
       $base_dump = true;
123 123
     }
124 124
 
125
-    if($dump === true) {
125
+    if ($dump === true) {
126 126
       $base_dump = true;
127 127
     } else {
128
-      if(!is_array($dump)) {
128
+      if (!is_array($dump)) {
129 129
         $dump = array('var' => $dump);
130 130
       }
131 131
 
132
-      foreach($dump as $dump_var_name => $dump_var) {
133
-        if($dump_var_name == 'base_dump') {
132
+      foreach ($dump as $dump_var_name => $dump_var) {
133
+        if ($dump_var_name == 'base_dump') {
134 134
           $base_dump = $dump_var;
135 135
         } else {
136 136
           $error_backtrace[$dump_var_name] = $dump_var;
@@ -138,22 +138,21 @@  discard block
 block discarded – undo
138 138
       }
139 139
     }
140 140
 
141
-    if($deadlock && ($q = SN::$db->mysql_get_innodb_status())) {
141
+    if ($deadlock && ($q = SN::$db->mysql_get_innodb_status())) {
142 142
       $error_backtrace['deadlock'] = explode("\n", $q['Status']);
143
-      foreach($error_backtrace['cSN_data'] as &$location) {
144
-        foreach($location as $location_id => &$location_data) //          $location_data = $location_id;
143
+      foreach ($error_backtrace['cSN_data'] as &$location) {
144
+        foreach ($location as $location_id => &$location_data) //          $location_data = $location_id;
145 145
         {
146
-          $location_data = isset($location_data['username']) ? $location_data['username'] :
147
-            (isset($location_data['name']) ? $location_data['name'] : $location_id);
146
+          $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id);
148 147
         }
149 148
       }
150 149
     }
151 150
 
152
-    if($base_dump) {
153
-      if(!is_array($this->log_array) || empty($this->log_array)) {
151
+    if ($base_dump) {
152
+      if (!is_array($this->log_array) || empty($this->log_array)) {
154 153
         $this->log_array = [];
155 154
       } else {
156
-        foreach($this->log_array as $log) {
155
+        foreach ($this->log_array as $log) {
157 156
           $error_backtrace['queries'][] = $log;
158 157
         }
159 158
       }
@@ -165,17 +164,17 @@  discard block
 block discarded – undo
165 164
       // Converting object instances to object names
166 165
 
167 166
       foreach ($error_backtrace['backtrace'] as &$backtrace) {
168
-        if(is_object($backtrace['object'])) {
167
+        if (is_object($backtrace['object'])) {
169 168
           $backtrace['object'] = get_class($backtrace['object']);
170 169
         }
171 170
 
172
-        if(empty($backtrace['args'])) {
171
+        if (empty($backtrace['args'])) {
173 172
           continue;
174 173
         }
175 174
 
176 175
         // Doing same conversion for backtrace params
177
-        foreach($backtrace['args'] as &$arg) {
178
-          if(is_object($arg)) {
176
+        foreach ($backtrace['args'] as &$arg) {
177
+          if (is_object($arg)) {
179 178
             $arg = 'object::' . get_class($arg);
180 179
           }
181 180
         }
@@ -204,14 +203,14 @@  discard block
 block discarded – undo
204 203
   function error($message = 'There is a error on page', $title = 'Internal Error', $httpCode = 500, $dump = true) {
205 204
     global $config, $sys_stop_log_hit, $lang, $sys_log_disabled, $user;
206 205
 
207
-    if(empty(SN::$db->connected)) {
206
+    if (empty(SN::$db->connected)) {
208 207
       // TODO - писать ошибку в файл
209 208
       die('SQL server currently unavailable. Please contact Administration...');
210 209
     }
211 210
 
212 211
     SN::db_transaction_rollback();
213 212
 
214
-    if(SN::$config->debug == 1) {
213
+    if (SN::$config->debug == 1) {
215 214
       /** @noinspection HtmlDeprecatedTag */
216 215
       /** @noinspection XmlDeprecatedElement */
217 216
       /** @noinspection HtmlDeprecatedAttribute */
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
     $error_text = SN::$db->db_escape($message);
225 224
     $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false);
226 225
 
227
-    if(!$sys_log_disabled) {
226
+    if (!$sys_log_disabled) {
228 227
       $this->_writeLogMessage($httpCode, $user, $title, $message, $error_backtrace, $fatal_error);
229 228
 
230 229
       $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>" . SN::$db->db_insert_id() . "</b>";
@@ -237,7 +236,7 @@  discard block
 block discarded – undo
237 236
       ob_start();
238 237
       print("<hr>User ID {$user['id']} raised error code {$httpCode} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}");
239 238
 
240
-      foreach($error_backtrace as $name => $value) {
239
+      foreach ($error_backtrace as $name => $value) {
241 240
         print('<hr>');
242 241
         pdump($value, $name);
243 242
       }
@@ -249,7 +248,7 @@  discard block
 block discarded – undo
249 248
   function warning($message, $title = 'System Message', $httpCode = 300, $dump = false) {
250 249
     global $user, $lang, $sys_log_disabled;
251 250
 
252
-    if(empty(SN::$db->connected)) {
251
+    if (empty(SN::$db->connected)) {
253 252
       // TODO - писать ошибку в файл
254 253
       die('SQL server currently unavailable. Please contact Administration...');
255 254
     }
@@ -258,7 +257,7 @@  discard block
 block discarded – undo
258 257
 
259 258
     $error_backtrace = $this->dump($dump, false);
260 259
 
261
-    if(empty($sys_log_disabled)) {
260
+    if (empty($sys_log_disabled)) {
262 261
       $this->_writeLogMessage($httpCode, $user, $title, $message, $error_backtrace, $fatal_error);
263 262
     } else {
264 263
 //        // TODO Здесь надо писать в файло
@@ -295,11 +294,11 @@  discard block
 block discarded – undo
295 294
 // Dump variables nicer then var_dump()
296 295
 
297 296
 function dump($value, $varname = null, $level = 0, $dumper = '') {
298
-  if(isset($varname)) {
297
+  if (isset($varname)) {
299 298
     $varname .= " = ";
300 299
   }
301 300
 
302
-  if($level == -1) {
301
+  if ($level == -1) {
303 302
     $trans[' '] = '&there4;';
304 303
     $trans["\t"] = '&rArr;';
305 304
     $trans["\n"] = '&para;;';
@@ -308,7 +307,7 @@  discard block
 block discarded – undo
308 307
 
309 308
     return strtr(htmlspecialchars($value), $trans);
310 309
   }
311
-  if($level == 0) {
310
+  if ($level == 0) {
312 311
 //    $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname;
313 312
     $dumper = mt_rand(10, 99) . '|' . $varname;
314 313
   }
@@ -316,22 +315,22 @@  discard block
 block discarded – undo
316 315
   $type = gettype($value);
317 316
   $dumper .= $type;
318 317
 
319
-  if($type == 'string') {
318
+  if ($type == 'string') {
320 319
     $dumper .= '(' . strlen($value) . ')';
321 320
     $value = dump($value, '', -1);
322
-  } elseif($type == 'boolean') {
321
+  } elseif ($type == 'boolean') {
323 322
     $value = ($value ? 'true' : 'false');
324
-  } elseif($type == 'object') {
323
+  } elseif ($type == 'object') {
325 324
     $props = get_class_vars(get_class($value));
326 325
     $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
327
-    foreach($props as $key => $val) {
326
+    foreach ($props as $key => $val) {
328 327
       $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => ';
329 328
       $dumper .= dump($value->$key, '', $level + 1);
330 329
     }
331 330
     $value = '';
332
-  } elseif($type == 'array') {
331
+  } elseif ($type == 'array') {
333 332
     $dumper .= '(' . count($value) . ')';
334
-    foreach($value as $key => $val) {
333
+    foreach ($value as $key => $val) {
335 334
       $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => ';
336 335
       $dumper .= dump($val, '', $level + 1);
337 336
     }
@@ -351,7 +350,7 @@  discard block
 block discarded – undo
351 350
 //  $backtrace = $backtrace[1];
352 351
 
353 352
   $caller = '';
354
-  if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
353
+  if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
355 354
     $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') .
356 355
       (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') .
357 356
       $backtrace[1]['function'] .
@@ -386,7 +385,7 @@  discard block
 block discarded – undo
386 385
 }
387 386
 
388 387
 function pr($prePrint = false) {
389
-  if($prePrint) {
388
+  if ($prePrint) {
390 389
     print("<br>");
391 390
   }
392 391
   print(mt_rand() . "<br>");
@@ -396,7 +395,7 @@  discard block
 block discarded – undo
396 395
   global $_PRINT_COUNT_VALUE;
397 396
   $_PRINT_COUNT_VALUE++;
398 397
 
399
-  if($prePrint) {
398
+  if ($prePrint) {
400 399
     print("<br>");
401 400
   }
402 401
   print($_PRINT_COUNT_VALUE . "<br>");
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.
tools/classes/Spritify.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     $sprite = new Sprite($images, $layout, $scaleToPx);
55 55
     $sprite->generate();
56
-    $sprite->saveOutput($dirOut, $outName, [$cssPrefix, $cssSuffix, $outName, $relativeUrl,]);
56
+    $sprite->saveOutput($dirOut, $outName, [$cssPrefix, $cssSuffix, $outName, $relativeUrl, ]);
57 57
 
58 58
     print "Folder/filter processed\n\n";
59 59
   }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     $images = [];
102 102
 
103 103
     foreach (scandir($dirRealPath) as $fileNameOnly) {
104
-      if (in_array($fileNameOnly, ['.', '..',]) || is_dir($fullPath = "$dirRealPath/$fileNameOnly")) {
104
+      if (in_array($fileNameOnly, ['.', '..', ]) || is_dir($fullPath = "$dirRealPath/$fileNameOnly")) {
105 105
         continue;
106 106
       }
107 107
       $images = self::tryReadFile($fullPath, $images);
Please login to merge, or discard this patch.