Test Failed
Push — trunk ( b76cfb...dfde47 )
by SuperNova.WS
03:49
created
admin/ajax_maintenance.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1));
6 6
 
7
-if($user['authlevel'] < 3)
7
+if ($user['authlevel'] < 3)
8 8
 {
9 9
   SnTemplate::messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']);
10 10
   die();
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
22
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23 23
   $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY);
24
-  while($row = db_fetch($query)) {
24
+  while ($row = db_fetch($query)) {
25 25
     $best_reports[] = $row['ube_report_id'];
26 26
   }
27 27
 }
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 
205 205
 function sn_maintenance_pack_user_list($user_list) {
206 206
   $user_list = explode(',', $user_list);
207
-  foreach($user_list as $key => $user_id) {
208
-    if(!is_numeric($user_id)) {
207
+  foreach ($user_list as $key => $user_id) {
208
+    if (!is_numeric($user_id)) {
209 209
       unset($user_list[$key]);
210 210
     }
211 211
   }
212 212
 
213 213
   $result = array();
214
-  if(!empty($user_list)) {
214
+  if (!empty($user_list)) {
215 215
     $query = doquery("SELECT `id` FROM `{{users}}` WHERE `id` in (" . implode(',', $user_list) . ")");
216
-    while($row = db_fetch($query)) {
216
+    while ($row = db_fetch($query)) {
217 217
       $result[] = $row['id'];
218 218
     }
219 219
   }
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 $old_server_status == GAME_DISABLE_NONE ? SN::$config->pass()->game_disable = GAME_DISABLE_MAINTENANCE : false;
229 229
 SN::db_transaction_commit();
230 230
 
231
-foreach($ques as $que_transaction) {
231
+foreach ($ques as $que_transaction) {
232 232
   SN::db_transaction_start();
233 233
 
234 234
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
235
-  foreach($que_transaction as $que) {
235
+  foreach ($que_transaction as $que) {
236 236
     set_time_limit(120);
237 237
     $QryResult = doquery($que);
238 238
     //$msg .= '<hr>' . $que . '<hr>';
Please login to merge, or discard this patch.
admin/adm_planet_list.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('INSIDE'  , true);
4
-define('INSTALL' , false);
3
+define('INSIDE', true);
4
+define('INSTALL', false);
5 5
 define('IN_ADMIN', true);
6 6
 
7 7
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
12 12
 
13 13
 $planet_active = sys_get_param_int('planet_active');
14
-if(!$planet_active) {
14
+if (!$planet_active) {
15 15
   $planet_type = sys_get_param_int('planet_type', 1);
16 16
   $planet_type = $planet_type == 3 ? 3 : 1;
17 17
 } else {
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $page_title =
42 42
   $lang['adm_planet_list_title'] . ': ' .
43
-  ($planet_active ? $lang['adm_planet_active'] :
44
-    ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
43
+  ($planet_active ? $lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
45 44
   );
46 45
 $template->assign_vars(array(
47 46
   'PAGE_TITLE' => $page_title,
Please login to merge, or discard this patch.
dark_matter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 include_once('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) {
5
+if (SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) {
6 6
   sys_redirect('metamatter.php');
7 7
 }
8 8
 
Please login to merge, or discard this patch.
classes/Fleet/FleetStatic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
    * @return DbMysqliResultIterator|EmptyCountableIterator
19 19
    */
20 20
   public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) {
21
-    if(empty($planetIds) || !is_array($planetIds)) {
21
+    if (empty($planetIds) || !is_array($planetIds)) {
22 22
       return new EmptyCountableIterator();
23 23
     }
24 24
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $speeds = array();
42 42
     if (!empty($fleet)) {
43 43
       foreach ($fleet as $ship_id => $amount) {
44
-        if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile',]))) {
44
+        if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile', ]))) {
45 45
           $single_ship_data = !empty($shipData[$ship_id]) ? $shipData[$ship_id] : get_ship_data($ship_id, $user);
46 46
           $speeds[]         = $single_ship_data['speed'];
47 47
         }
Please login to merge, or discard this patch.
classes/RequestInfo.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,15 +122,15 @@
 block discarded – undo
122 122
     SN::db_transaction_commit();
123 123
 
124 124
     $this->user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
125
-    $this->browser_id = db_get_set_unique_id_value('security_browser', 'browser_id', ['browser_user_agent' => $this->user_agent,]);
125
+    $this->browser_id = db_get_set_unique_id_value('security_browser', 'browser_id', ['browser_user_agent' => $this->user_agent, ]);
126 126
 
127 127
     $this->page_address    = substr($_SERVER['PHP_SELF'], strlen(SN_ROOT_RELATIVE));
128
-    $this->page_address_id = db_get_set_unique_id_value('security_url', 'url_id', ['url_string' => $this->page_address,]);
128
+    $this->page_address_id = db_get_set_unique_id_value('security_url', 'url_id', ['url_string' => $this->page_address, ]);
129 129
 
130 130
     // Not a simulator - because it can have loooooong string
131 131
     if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') !== 0 && !$skip_log_query) {
132 132
       $this->queryString = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
133
-      $this->queryStringId = db_get_set_unique_id_value('security_query_strings', 'id', ['query_string' => $this->queryString,]);
133
+      $this->queryStringId = db_get_set_unique_id_value('security_query_strings', 'id', ['query_string' => $this->queryString, ]);
134 134
     }
135 135
 
136 136
     $ip                      = sec_player_ip();
Please login to merge, or discard this patch.
classes/core_auth.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -192,18 +192,18 @@  discard block
 block discarded – undo
192 192
     // TODO Хотя тут может получится вечный цикл - ПОДУМАТЬ
193 193
     // TODO Тут же можно пробовать провести попытку слияния аккаунтов - хотя это и очень небезопасно
194 194
 
195
-    if(sys_get_param('login_player_register_logout')) {
195
+    if (sys_get_param('login_player_register_logout')) {
196 196
       $this->logout();
197 197
     }
198 198
 
199 199
     $original_suggest = '';
200 200
     // Смотрим - есть ли у нас данные от пользователя
201
-    if(($player_name_submitted = sys_get_param('submit_player_name'))) {
201
+    if (($player_name_submitted = sys_get_param('submit_player_name'))) {
202 202
       // Попытка регистрации нового игрока из данных, введенных пользователем
203 203
       $this->player_suggested_name = sys_get_param_str_unsafe('player_suggested_name');
204 204
     } else {
205
-      foreach($this->providers_authorised as $provider) {
206
-        if($this->player_suggested_name = $provider->player_name_suggest()) { // OK 4.5
205
+      foreach ($this->providers_authorised as $provider) {
206
+        if ($this->player_suggested_name = $provider->player_name_suggest()) { // OK 4.5
207 207
           $original_suggest = $provider->player_name_suggest();
208 208
           break;
209 209
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     }
212 212
 
213 213
     // Если у нас провайдеры не дают имени и пользователь не дал свой вариант - это у нас первый логин в игру
214
-    if(!$this->player_suggested_name) {
214
+    if (!$this->player_suggested_name) {
215 215
       $max_user_id = db_player_get_max_id(); // 4.5
216 216
       // TODO - предлагать имя игрока по локали
217 217
 
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
         SN::db_transaction_rollback();
221 221
         $this->player_suggested_name = 'Emperor ' . mt_rand($max_user_id + 1, $max_user_id + 1000);
222 222
         SN::db_transaction_start();
223
-      } while(db_player_name_exists($this->player_suggested_name));
223
+      } while (db_player_name_exists($this->player_suggested_name));
224 224
 
225 225
     }
226 226
 
227
-    if($player_name_submitted) {
227
+    if ($player_name_submitted) {
228 228
       $this->register_player_db_create($this->player_suggested_name); // OK 4.5
229
-      if($this->register_status == LOGIN_SUCCESS) {
229
+      if ($this->register_status == LOGIN_SUCCESS) {
230 230
         sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
231
-      } elseif($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) {
231
+      } elseif ($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) {
232 232
         // self::$player_suggested_name .= ' ' . $this->account->account_id;
233 233
       }
234 234
 //      if(self::$login_status != LOGIN_SUCCESS) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         : false
253 253
       );
254 254
 
255
-    if($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
255
+    if ($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
256 256
       $prohibited_characters = array_map(function($value) {
257 257
         return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
258 258
       }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
@@ -285,18 +285,18 @@  discard block
 block discarded – undo
285 285
 
286 286
     // !self::$is_init ? self::init() : false;
287 287
 
288
-    if(!SN::$gc->modules->countModulesInGroup('auth')) {
288
+    if (!SN::$gc->modules->countModulesInGroup('auth')) {
289 289
       die('{Не обнаружено ни одного провайдера авторизации в core_auth::login()!}');
290 290
     }
291 291
 
292 292
     !empty($_POST) ? self::flog(dump($_POST, '$_POST')) : false;
293 293
     !empty($_GET) ? self::flog(dump($_GET, '$_GET')) : false;
294
-    !empty($_COOKIE) ? self::flog(dump($_COOKIE,'$_COOKIE')) : false;
294
+    !empty($_COOKIE) ? self::flog(dump($_COOKIE, '$_COOKIE')) : false;
295 295
 
296 296
     $this->auth_reset(); // OK v4.5
297 297
 
298 298
     $this->providers = array();
299
-    foreach(SN::$gc->modules->getModulesInGroup('auth', true) as $module_name => $module) {
299
+    foreach (SN::$gc->modules->getModulesInGroup('auth', true) as $module_name => $module) {
300 300
       /**
301 301
        * @var auth_abstract $module
302 302
        */
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 
306 306
     // $this->providers = array_reverse($this->providers, true); // НИНАДА! СН-аккаунт должен всегда авторизироваться первым!
307 307
 //pdump($this->providers);
308
-    foreach($this->providers as $provider_id => $provider) {
308
+    foreach ($this->providers as $provider_id => $provider) {
309 309
       $login_status = $provider->login(); // OK v4.5
310 310
       self::flog(($provider->manifest['name'] . '->' . 'login_try - ') . (empty($provider->account->account_id) ? $lang['sys_login_messages'][$provider->account_login_status] : dump($provider)));
311
-      if($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) {
311
+      if ($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) {
312 312
         $this->providers_authorised[$provider_id] = &$this->providers[$provider_id];
313 313
 
314 314
         $this->user_id_to_provider = array_replace_recursive(
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
           // static::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id) // OK 4.5
317 317
           PlayerToAccountTranslate::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id) // OK 4.5
318 318
         );
319
-      } elseif($login_status != LOGIN_UNDEFINED) {
319
+      } elseif ($login_status != LOGIN_UNDEFINED) {
320 320
         $this->provider_error_list[$provider_id] = $login_status;
321 321
       }
322 322
     }
323 323
 
324
-    if(empty($this->providers_authorised)) {
324
+    if (empty($this->providers_authorised)) {
325 325
       // Ни один аккаунт не авторизирован
326 326
       // Проверяем - есть ли у нас ошибки в аккаунтах?
327
-      if(!empty($this->provider_error_list)) {
327
+      if (!empty($this->provider_error_list)) {
328 328
         // Если есть - выводим их
329 329
         self::$login_status = reset($this->provider_error_list);
330 330
         $providerError = $this->providers[key($this->provider_error_list)]->account_login_message;
331 331
 
332
-        if(!empty($providerError)) {
332
+        if (!empty($providerError)) {
333 333
           self::$login_message = $providerError;
334 334
         }
335 335
       }
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
       // В self::$accessible_user_row_list - список доступных игроков для данных аккаунтов с соответствующими записями из таблицы `users`
345 345
 
346 346
       // Остались ли у нас в списке доступные игроки?
347
-      if(empty($this->accessible_user_row_list)) {
347
+      if (empty($this->accessible_user_row_list)) {
348 348
         // Нет ни одного игрока ни на одном авторизированном аккаунте
349 349
         // Надо регать нового игрока
350 350
 
351 351
         // Сейчас происходит процесс регистрации игрока?
352
-        if(!$this->is_player_register) {
352
+        if (!$this->is_player_register) {
353 353
           // Нет - отправляем на процесс регистрации
354 354
           $partner_id = sys_get_param_int('id_ref', sys_get_param_int('partner_id'));
355 355
           sys_redirect(SN_ROOT_VIRTUAL . 'index.php?page=player_register&player_register=1' . ($partner_id ? '&id_ref=' . $partner_id : ''));
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         // Да, есть доступные игроки, которые так же прописаны в базе
359 359
         $this->get_active_user(); // 4.5
360 360
 
361
-        if($this->is_impersonating = !empty($_COOKIE[SN_COOKIE_U_I]) ? $_COOKIE[SN_COOKIE_U_I] : 0) {
361
+        if ($this->is_impersonating = !empty($_COOKIE[SN_COOKIE_U_I]) ? $_COOKIE[SN_COOKIE_U_I] : 0) {
362 362
           $a_user = db_user_by_id($this->is_impersonating);
363 363
           $this->impersonator_username = $a_user['username'];
364 364
         }
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 
367 367
         //Прописываем текущего игрока на все авторизированные аккаунты
368 368
         // TODO - ИЛИ ВСЕХ ИГРОКОВ??
369
-        if(empty($this->is_impersonating)) {
370
-          foreach($this->providers_authorised as $provider_id => $provider) {
371
-            if(empty($this->user_id_to_provider[self::$user['id']][$provider_id])) {
369
+        if (empty($this->is_impersonating)) {
370
+          foreach ($this->providers_authorised as $provider_id => $provider) {
371
+            if (empty($this->user_id_to_provider[self::$user['id']][$provider_id])) {
372 372
               // self::db_translate_register_user($provider_id, $provider->account->account_id, self::$user['id']);
373 373
               PlayerToAccountTranslate::db_translate_register_user($provider_id, $provider->account->account_id, self::$user['id']);
374 374
               $this->user_id_to_provider[self::$user['id']][$provider_id][$provider->account->account_id] = true;
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
       }
379 379
     }
380 380
 
381
-    if(empty(self::$user['id'])) {
381
+    if (empty(self::$user['id'])) {
382 382
       self::cookie_set(''); // OK 4.5
383
-    } elseif(self::$user['id'] != $_COOKIE[SN_COOKIE_U]) {
383
+    } elseif (self::$user['id'] != $_COOKIE[SN_COOKIE_U]) {
384 384
       self::cookie_set(self::$user['id']); // OK 4.5
385 385
     }
386 386
 
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
    */
400 400
   // OK v4.7
401 401
   public function logout($redirect = true) {
402
-    if(!empty($_COOKIE[SN_COOKIE_U_I])) {
402
+    if (!empty($_COOKIE[SN_COOKIE_U_I])) {
403 403
       self::cookie_set($_COOKIE[SN_COOKIE_U_I]);
404 404
       self::cookie_set(0, true);
405 405
       self::$main_provider->logout();
406 406
     } else {
407
-      foreach($this->providers as $provider_name => $provider) {
407
+      foreach ($this->providers as $provider_name => $provider) {
408 408
         $provider->logout();
409 409
       }
410 410
 
411 411
       self::cookie_set(0);
412 412
     }
413 413
 
414
-    if($redirect === true) {
414
+    if ($redirect === true) {
415 415
       sys_redirect(SN_ROOT_RELATIVE . (empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php'));
416
-    } elseif($redirect !== false) {
416
+    } elseif ($redirect !== false) {
417 417
       sys_redirect($redirect);
418 418
     }
419 419
   }
@@ -424,15 +424,15 @@  discard block
 block discarded – undo
424 424
    * @param $user_selected
425 425
    */
426 426
   public function impersonate($user_selected) {
427
-    if($_COOKIE[SN_COOKIE_U_I]) {
427
+    if ($_COOKIE[SN_COOKIE_U_I]) {
428 428
       die('You already impersonating someone. Go back to living other\'s life! Or clear your cookies and try again'); // TODO: Log it
429 429
     }
430 430
 
431
-    if($this->auth_level_max_local < AUTH_LEVEL_ADMINISTRATOR) {
431
+    if ($this->auth_level_max_local < AUTH_LEVEL_ADMINISTRATOR) {
432 432
       die('You can\'t impersonate - too low level'); // TODO: Log it
433 433
     }
434 434
 
435
-    if($this->auth_level_max_local <= $user_selected['authlevel']) {
435
+    if ($this->auth_level_max_local <= $user_selected['authlevel']) {
436 436
       die('You can\'t impersonate this account - level is greater or equal to yours'); // TODO: Log it
437 437
     }
438 438
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     $account_translate = reset($account_translate[$user_selected['id']][self::$main_provider->provider_id]);
441 441
     $account_to_impersonate = new Account(self::$main_provider->db);
442 442
     $account_to_impersonate->db_get_by_id($account_translate['provider_account_id']);
443
-    if(!$account_to_impersonate->is_exists) {
443
+    if (!$account_to_impersonate->is_exists) {
444 444
       die('Какая-то ошибка - не могу найти аккаунт для имперсонации'); // TODO: Log it
445 445
     }
446 446
     self::$main_provider->impersonate($account_to_impersonate);
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
   public function password_check($password_unsafe) {
467 467
     $result = false;
468 468
 
469
-    if(empty($this->providers_authorised)) {
469
+    if (empty($this->providers_authorised)) {
470 470
       // TODO - такого быть не может!
471 471
       self::flog("password_check: Не найдено ни одного авторизированного провайдера в self::\$providers_authorised", true);
472 472
     } else {
473
-      foreach($this->providers_authorised as $provider_id => $provider) {
474
-        if($provider->is_feature_supported(AUTH_FEATURE_HAS_PASSWORD)) {
473
+      foreach ($this->providers_authorised as $provider_id => $provider) {
474
+        if ($provider->is_feature_supported(AUTH_FEATURE_HAS_PASSWORD)) {
475 475
           $result = $result || $provider->password_check($password_unsafe);
476 476
         }
477 477
       }
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
   public function password_change($old_password_unsafe, $new_password_unsafe) {
493 493
     global $lang;
494 494
 
495
-    if(empty($this->providers_authorised)) {
495
+    if (empty($this->providers_authorised)) {
496 496
       // TODO - такого быть не может!
497 497
       self::flog("Не найдено ни одного авторизированного провайдера в self::\$providers_authorised", true);
498 498
       return false;
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
     $salt_unsafe = self::password_salt_generate();
506 506
 
507 507
     $providers_changed_password = array();
508
-    foreach($this->providers_authorised as $provider_id => $provider) {
509
-      if(
508
+    foreach ($this->providers_authorised as $provider_id => $provider) {
509
+      if (
510 510
         !$provider->is_feature_supported(AUTH_FEATURE_PASSWORD_CHANGE)
511 511
         || !$provider->password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe)
512 512
       ) {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
       $account_translation = PlayerToAccountTranslate::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id);
519 519
 
520 520
       // Рассылаем уведомления о смене пароля в ЛС
521
-      foreach($account_translation as $user_id => $provider_info) {
521
+      foreach ($account_translation as $user_id => $provider_info) {
522 522
         // TODO - УКазывать тип аккаунта, на котором сменён пароль
523 523
         msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN,
524 524
           $lang['sys_administration'], $lang['sys_login_register_message_title'],
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
       SN::db_transaction_start();
566 566
       // Проверить наличие такого имени в истории имён
567 567
 
568
-      if(db_player_name_exists($player_name_unsafe)) {
568
+      if (db_player_name_exists($player_name_unsafe)) {
569 569
         throw new Exception(REGISTER_ERROR_PLAYER_NAME_EXISTS, ERR_ERROR);
570 570
       }
571 571
 
@@ -573,11 +573,11 @@  discard block
 block discarded – undo
573 573
       $player_language = '';
574 574
       $player_email = '';
575 575
       // TODO - порнография - работа должна происходить над списком аккаунтов, а не только на одном аккаунте...
576
-      foreach($this->providers_authorised as $provider) {
577
-        if(!$player_language && $provider->account->account_language) {
576
+      foreach ($this->providers_authorised as $provider) {
577
+        if (!$player_language && $provider->account->account_language) {
578 578
           $player_language = $provider->account->account_language;
579 579
         }
580
-        if(!$player_email && $provider->account->account_email) {
580
+        if (!$player_email && $provider->account->account_email) {
581 581
           $player_email = $provider->account->account_email;
582 582
         }
583 583
       }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
       ));
594 594
       // Зарегестрировать на него аккаунты из self::$accounts_authorised
595 595
       $a_user = self::$user;
596
-      foreach($this->providers_authorised as $provider) {
596
+      foreach ($this->providers_authorised as $provider) {
597 597
         // TODO - порнография. Должен быть отдельный класс трансляторов - в т.ч. и кэширующий транслятор
598 598
         // TODO - ну и работа должна происходить над списком аккаунтов, а не только на одном аккаунте...
599 599
         // self::db_translate_register_user($provider->provider_id, $provider->account->account_id, $a_user['id']);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
       SN::db_transaction_commit();
607 607
       $this->register_status = LOGIN_SUCCESS;
608
-    } catch(Exception $e) {
608
+    } catch (Exception $e) {
609 609
       SN::db_transaction_rollback();
610 610
 
611 611
       // Если старое имя занято
@@ -624,10 +624,10 @@  discard block
 block discarded – undo
624 624
     // Пробиваем все ИД игроков по базе - есть ли вообще такие записи
625 625
     // Вообще-то это не особо нужно - у нас по определению стоят констраинты
626 626
     // Зато так мы узнаем максимальный authlevel, проверим права имперсонейта и вытащим все записи юзеров
627
-    foreach($this->user_id_to_provider as $user_id => $cork) {
627
+    foreach ($this->user_id_to_provider as $user_id => $cork) {
628 628
       $user = db_user_by_id($user_id);
629 629
       // Если записи игрока в БД не существует?
630
-      if(empty($user['id'])) {
630
+      if (empty($user['id'])) {
631 631
         // Удаляем этого и переходим к следующему
632 632
         unset($this->user_id_to_provider[$user_id]);
633 633
         // Де-регистрируем игрока из таблицы трансляции игроков
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
   // OK v4.5
649 649
   protected function get_active_user() {
650 650
     // Проверяем куку "текущего игрока" из браузера
651
-    if(
651
+    if (
652 652
       // Кука не пустая
653 653
       ($_COOKIE[SN_COOKIE_U] = trim($_COOKIE[SN_COOKIE_U])) && !empty($_COOKIE[SN_COOKIE_U])
654 654
       // И в куке находится ID
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
     }
674 674
 
675 675
     // В куке нет валидного ИД записи игрока, доступной с текущих аккаунтов
676
-    if(empty(self::$user['id'])) {
676
+    if (empty(self::$user['id'])) {
677 677
       // Берем первого из доступных
678 678
       // TODO - default_user
679 679
       self::$user = reset($this->accessible_user_row_list);
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 
698 698
     $result = array();
699 699
 
700
-    if($user_id && empty($this->is_impersonating)) {
700
+    if ($user_id && empty($this->is_impersonating)) {
701 701
       // self::db_counter_insert();
702 702
       self::$device->db_counter_insert($user_id);
703 703
 
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 
706 706
       sys_user_options_unpack($user);
707 707
 
708
-      if($user['banaday'] && $user['banaday'] <= SN_TIME_NOW) {
708
+      if ($user['banaday'] && $user['banaday'] <= SN_TIME_NOW) {
709 709
         $user['banaday'] = 0;
710 710
         $user['vacation'] = SN_TIME_NOW;
711 711
       }
712 712
 
713
-      $user['user_lastip'] = self::$device->ip_v4_string;// $ip['ip'];
713
+      $user['user_lastip'] = self::$device->ip_v4_string; // $ip['ip'];
714 714
       $user['user_proxy'] = self::$device->ip_v4_proxy_chain; //$ip['proxy_chain'];
715 715
 
716 716
       $result[F_BANNED_STATUS] = $user['banaday'];
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
       );
725 725
     }
726 726
 
727
-    if($extra = $config->security_ban_extra) {
727
+    if ($extra = $config->security_ban_extra) {
728 728
       $extra = explode(',', $extra);
729
-      array_walk($extra,'trim');
729
+      array_walk($extra, 'trim');
730 730
       in_array(self::$device->device_id, $extra) and die();
731 731
     }
732 732
 
733
-    if(self::$login_message) {
733
+    if (self::$login_message) {
734 734
       $result[F_LOGIN_MESSAGE] = self::$login_message;
735 735
     }
736 736
 
@@ -766,21 +766,21 @@  discard block
 block discarded – undo
766 766
   protected function register_player_name_validate($player_name_unsafe) {
767 767
     // TODO - переделать под RAW-строки
768 768
     // Если имя игрока пустое - NO GO!
769
-    if(trim($player_name_unsafe) == '') {
769
+    if (trim($player_name_unsafe) == '') {
770 770
       throw new Exception(REGISTER_ERROR_PLAYER_NAME_EMPTY, ERR_ERROR);
771 771
     }
772 772
     // Проверяем, что бы в начале и конце не было пустых символов
773
-    if($player_name_unsafe != trim($player_name_unsafe)) {
773
+    if ($player_name_unsafe != trim($player_name_unsafe)) {
774 774
       throw new Exception(REGISTER_ERROR_PLAYER_NAME_TRIMMED, ERR_ERROR);
775 775
     }
776 776
     // Если логин имеет запрещенные символы - NO GO!
777
-    if(strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
777
+    if (strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
778 778
       // TODO - выдавать в сообщение об ошибке список запрещенных символов
779 779
       // TODO - заранее извещать игрока, какие символы являются запрещенными
780 780
       throw new Exception(REGISTER_ERROR_PLAYER_NAME_RESTRICTED_CHARACTERS, ERR_ERROR);
781 781
     }
782 782
     // Если логин меньше минимальной длины - NO GO!
783
-    if(strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) {
783
+    if (strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) {
784 784
       // TODO - выдавать в сообщение об ошибке минимальную длину имени игрока
785 785
       // TODO - заранее извещать игрока, какая минимальная и максимальная длина имени
786 786
       throw new Exception(REGISTER_ERROR_PLAYER_NAME_SHORT, ERR_ERROR);
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
   }
839 839
 
840 840
   protected static function flog($message, $die = false) {
841
-    if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
841
+    if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
842 842
       return;
843 843
     }
844 844
     list($called, $caller) = debug_backtrace(false);
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
     $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false;
852 852
 
853 853
     SN::log_file("$message - $caller_name");
854
-    if($die) {
854
+    if ($die) {
855 855
       $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
856 856
     }
857 857
   }
Please login to merge, or discard this patch.
classes/Template/TemplateMeta.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 //    var_dump($fallBackPath);
137 137
 //    var_dump($template);
138 138
 
139
-    if(empty($fallBackPath)) {
139
+    if (empty($fallBackPath)) {
140 140
       if (!$this->parent || empty($fallbackName = $this->parent->getName()) || !$this->isTemplateExists()) {
141 141
         // If no parent template - then using default template as fallback one
142 142
         $fallbackName = SnTemplate::SN_TEMPLATE_NAME_DEFAULT;
Please login to merge, or discard this patch.
classes/classPersistent.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $this->sql_index_field = "{$table_name}_name";
41 41
     $this->sql_value_field = "{$table_name}_value";
42 42
 
43
-    if(!$this->_DB_LOADED) {
43
+    if (!$this->_DB_LOADED) {
44 44
       $this->db_loadAll();
45 45
     }
46 46
   }
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
    */
61 61
   public function db_loadItem($index) {
62 62
     $result = null;
63
-    if($index) {
63
+    if ($index) {
64 64
       $index_safe = SN::$db->db_escape($index);
65 65
       $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true);
66
-      if(is_array($queryResult) && !empty($queryResult)) {
66
+      if (is_array($queryResult) && !empty($queryResult)) {
67 67
         $this->$index = $result = $queryResult[$this->sql_value_field];
68 68
       }
69 69
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     $this->loadDefaults();
76 76
 
77 77
     $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;");
78
-    while($row = db_fetch($query)) {
78
+    while ($row = db_fetch($query)) {
79 79
       $this[$row[$this->sql_index_field]] = $row[$this->sql_value_field];
80 80
     }
81 81
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
   }
84 84
 
85 85
   public function loadDefaults() {
86
-    foreach($this->defaults as $defName => $defValue) {
86
+    foreach ($this->defaults as $defName => $defValue) {
87 87
       $this->$defName = $defValue;
88 88
     }
89 89
   }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   public function db_saveItem($item_list, $value = NULL) {
96
-    if(empty($item_list)) {
96
+    if (empty($item_list)) {
97 97
       return;
98 98
     }
99 99
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 
102 102
     // Сначала записываем данные в базу - что бы поймать все блокировки
103 103
     $qry = array();
104
-    foreach($item_list as $item_name => $item_value) {
105
-      if($item_name) {
104
+    foreach ($item_list as $item_name => $item_value) {
105
+      if ($item_name) {
106 106
         $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value);
107 107
         $item_name = SN::$db->db_escape($item_name);
108 108
         $qry[] = "('{$item_name}', '{$item_value}')";
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
112 112
 
113 113
     // И только после взятия блокировок - меняем значения в кэше
114
-    foreach($item_list as $item_name => $item_value) {
115
-      if($item_name && $item_value !== null) {
114
+    foreach ($item_list as $item_name => $item_value) {
115
+      if ($item_name && $item_value !== null) {
116 116
         $this->__set($item_name, $item_value);
117 117
       }
118 118
     }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
   }
141 141
 
142 142
   public function __get($name) {
143
-    if($this->force) {
143
+    if ($this->force) {
144 144
       $this->force = false;
145 145
       $value = $this->db_loadItem($name);
146 146
     } else {
147 147
       $value = parent::__get($name);
148 148
     }
149 149
 
150
-    if(isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) {
150
+    if (isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) {
151 151
       $value = $this->defaults[$name];
152 152
     }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
   }
156 156
 
157 157
   public function __set($name, $value) {
158
-    if($this->force) {
158
+    if ($this->force) {
159 159
       $this->force = false;
160 160
       $this->db_saveItem($name, $value);
161 161
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     $this->db_saveItem(array_combine(array_keys($this->defaults), array_fill(0, count($this->defaults), null)));
93 93
   }
94 94
 
95
-  public function db_saveItem($item_list, $value = NULL) {
95
+  public function db_saveItem($item_list, $value = null) {
96 96
     if(empty($item_list)) {
97 97
       return;
98 98
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     $qry = array();
104 104
     foreach($item_list as $item_name => $item_value) {
105 105
       if($item_name) {
106
-        $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value);
106
+        $item_value = SN::$db->db_escape($item_value === null ? $this->$item_name : $item_value);
107 107
         $item_name = SN::$db->db_escape($item_name);
108 108
         $qry[] = "('{$item_name}', '{$item_value}')";
109 109
       }
Please login to merge, or discard this patch.
classes/DBAL/OldDbChangeSet.php 1 patch
Spacing   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -142,9 +142,7 @@
 block discarded – undo
142 142
           // Простое условие - $field_id = $field_value
143 143
           if (is_string($field_id)) {
144 144
             $field_value =
145
-              $field_value === null ? 'NULL' :
146
-                (is_string($field_value) ? "'" . SN::$db->db_escape($field_value) . "'" :
147
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
145
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . SN::$db->db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value));
148 146
             $the_conditions[] = "`{$field_id}` = {$field_value}";
149 147
           } else {
150 148
             die('Неподдерживаемый тип условия');
Please login to merge, or discard this patch.