@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @var array $user |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if( |
|
| 12 | +if ( |
|
| 13 | 13 | ($user['authlevel'] < 3) |
| 14 | 14 | && |
| 15 | 15 | (empty($config->admin_http_key) || empty($_GET['admin_http_key']) || $_GET['admin_http_key'] != $config->admin_http_key) |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // If we have already passed here through admin_http_key - then we can safely assume that it's admin |
| 23 | -if(empty($user['authlevel'])) { |
|
| 23 | +if (empty($user['authlevel'])) { |
|
| 24 | 24 | $user['authlevel'] = 3; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // [#] info_best_battles 1b0 |
| 35 | 35 | $best_reports = array(); |
| 36 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 36 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 37 | 37 | $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY); |
| 38 | - while($row = db_fetch($query)) { |
|
| 38 | + while ($row = db_fetch($query)) { |
|
| 39 | 39 | $best_reports[] = $row['ube_report_id']; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -218,16 +218,16 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | function sn_maintenance_pack_user_list($user_list) { |
| 220 | 220 | $user_list = explode(',', $user_list); |
| 221 | - foreach($user_list as $key => $user_id) { |
|
| 222 | - if(!is_numeric($user_id)) { |
|
| 221 | + foreach ($user_list as $key => $user_id) { |
|
| 222 | + if (!is_numeric($user_id)) { |
|
| 223 | 223 | unset($user_list[$key]); |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $result = array(); |
| 228 | - if(!empty($user_list)) { |
|
| 228 | + if (!empty($user_list)) { |
|
| 229 | 229 | $query = doquery("SELECT `id` FROM `{{users}}` WHERE `id` in (" . implode(',', $user_list) . ")"); |
| 230 | - while($row = db_fetch($query)) { |
|
| 230 | + while ($row = db_fetch($query)) { |
|
| 231 | 231 | $result[] = $row['id']; |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | $old_server_status == GAME_DISABLE_NONE ? SN::$config->pass()->game_disable = GAME_DISABLE_MAINTENANCE : false; |
| 243 | 243 | SN::db_transaction_commit(); |
| 244 | 244 | |
| 245 | -foreach($ques as $que_transaction) { |
|
| 245 | +foreach ($ques as $que_transaction) { |
|
| 246 | 246 | SN::db_transaction_start(); |
| 247 | 247 | |
| 248 | 248 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
| 249 | - foreach($que_transaction as $que) { |
|
| 249 | + foreach ($que_transaction as $que) { |
|
| 250 | 250 | set_time_limit(120); |
| 251 | 251 | $QryResult = doquery($que); |
| 252 | 252 | //$msg .= '<hr>' . $que . '<hr>'; |
@@ -386,8 +386,7 @@ |
||
| 386 | 386 | |
| 387 | 387 | if (!$this->is_register) { |
| 388 | 388 | $this->flog('Регистрация: не выставлен флаг регистрации - пропускаем'); |
| 389 | - } |
|
| 390 | - else |
|
| 389 | + } else |
|
| 391 | 390 | { |
| 392 | 391 | try { |
| 393 | 392 | |
@@ -192,18 +192,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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']; |
@@ -726,13 +726,13 @@ discard block |
||
| 726 | 726 | doquery("UNLOCK TABLES;"); |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - if($extra = $config->security_ban_extra) { |
|
| 729 | + if ($extra = $config->security_ban_extra) { |
|
| 730 | 730 | $extra = explode(',', $extra); |
| 731 | - array_walk($extra,'trim'); |
|
| 731 | + array_walk($extra, 'trim'); |
|
| 732 | 732 | in_array(self::$device->device_id, $extra) and die(); |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - if(self::$login_message) { |
|
| 735 | + if (self::$login_message) { |
|
| 736 | 736 | $result[F_LOGIN_MESSAGE] = self::$login_message; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -768,21 +768,21 @@ discard block |
||
| 768 | 768 | protected function register_player_name_validate($player_name_unsafe) { |
| 769 | 769 | // TODO - переделать под RAW-строки |
| 770 | 770 | // Если имя игрока пустое - NO GO! |
| 771 | - if(trim($player_name_unsafe) == '') { |
|
| 771 | + if (trim($player_name_unsafe) == '') { |
|
| 772 | 772 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_EMPTY, ERR_ERROR); |
| 773 | 773 | } |
| 774 | 774 | // Проверяем, что бы в начале и конце не было пустых символов |
| 775 | - if($player_name_unsafe != trim($player_name_unsafe)) { |
|
| 775 | + if ($player_name_unsafe != trim($player_name_unsafe)) { |
|
| 776 | 776 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_TRIMMED, ERR_ERROR); |
| 777 | 777 | } |
| 778 | 778 | // Если логин имеет запрещенные символы - NO GO! |
| 779 | - if(strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 779 | + if (strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 780 | 780 | // TODO - выдавать в сообщение об ошибке список запрещенных символов |
| 781 | 781 | // TODO - заранее извещать игрока, какие символы являются запрещенными |
| 782 | 782 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_RESTRICTED_CHARACTERS, ERR_ERROR); |
| 783 | 783 | } |
| 784 | 784 | // Если логин меньше минимальной длины - NO GO! |
| 785 | - if(strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 785 | + if (strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 786 | 786 | // TODO - выдавать в сообщение об ошибке минимальную длину имени игрока |
| 787 | 787 | // TODO - заранее извещать игрока, какая минимальная и максимальная длина имени |
| 788 | 788 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_SHORT, ERR_ERROR); |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | protected static function flog($message, $die = false) { |
| 843 | - if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 843 | + if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 844 | 844 | return; |
| 845 | 845 | } |
| 846 | 846 | list($called, $caller) = debug_backtrace(false); |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false; |
| 854 | 854 | |
| 855 | 855 | SN::log_file("$message - $caller_name"); |
| 856 | - if($die) { |
|
| 856 | + if ($die) { |
|
| 857 | 857 | $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
| 858 | 858 | } |
| 859 | 859 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,11 +331,11 @@ discard block |
||
| 332 | 331 | // TODO - to scheduler |
| 333 | 332 | StatUpdateLauncher::unlock(); |
| 334 | 333 | |
| 335 | -if(!empty($_GET['admin_http_key']) && $_GET['admin_http_key'] == $config->admin_http_key) { |
|
| 334 | +if (!empty($_GET['admin_http_key']) && $_GET['admin_http_key'] == $config->admin_http_key) { |
|
| 336 | 335 | define('IN_API', true); |
| 337 | 336 | } |
| 338 | 337 | |
| 339 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 338 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 340 | 339 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
| 341 | 340 | SN::$config->game_disable == GAME_DISABLE_REASON |
| 342 | 341 | ? SN::$config->game_disable_reason |
@@ -345,33 +344,33 @@ discard block |
||
| 345 | 344 | |
| 346 | 345 | // For API - just skipping all checks |
| 347 | 346 | // TODO: That is ideologically wrong and should be redone |
| 348 | - if(defined('IN_API')) { |
|
| 347 | + if (defined('IN_API')) { |
|
| 349 | 348 | return; |
| 350 | 349 | } |
| 351 | 350 | |
| 352 | 351 | // Actions for install mode |
| 353 | - if(defined('INSTALL_MODE') && INSTALL_MODE) { |
|
| 352 | + if (defined('INSTALL_MODE') && INSTALL_MODE) { |
|
| 354 | 353 | // Handling log out - should work even in install mode |
| 355 | - if(strtolower(INITIAL_PAGE) === 'logout') { |
|
| 354 | + if (strtolower(INITIAL_PAGE) === 'logout') { |
|
| 356 | 355 | SN::$auth->logout(true); |
| 357 | 356 | die(); |
| 358 | 357 | } |
| 359 | 358 | |
| 360 | 359 | // If user not logged in AND we are not on login page - redirect user there |
| 361 | - if(!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
| 360 | + if (!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
| 362 | 361 | header('Location: login.php'); |
| 363 | 362 | die(); |
| 364 | 363 | } |
| 365 | 364 | |
| 366 | 365 | // If user is type of admin AND in user pages - redirecting him to admin interface |
| 367 | 366 | // You really shouldn't mess in user interface until game not configured! |
| 368 | - if($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
| 367 | + if ($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
| 369 | 368 | header('Location: ' . SN_ROOT_VIRTUAL_PARENT . 'admin/overview.php'); |
| 370 | 369 | die(); |
| 371 | 370 | } |
| 372 | 371 | } |
| 373 | 372 | |
| 374 | - if( |
|
| 373 | + if ( |
|
| 375 | 374 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 376 | 375 | && |
| 377 | 376 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -387,8 +386,8 @@ discard block |
||
| 387 | 386 | // TODO ban |
| 388 | 387 | // TODO $skip_ban_check |
| 389 | 388 | global $skip_ban_check; |
| 390 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 391 | - if(defined('IN_API')) { |
|
| 389 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 390 | + if (defined('IN_API')) { |
|
| 392 | 391 | return; |
| 393 | 392 | } |
| 394 | 393 | |
@@ -403,10 +402,10 @@ discard block |
||
| 403 | 402 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
| 404 | 403 | |
| 405 | 404 | |
| 406 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 405 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 407 | 406 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 408 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 409 | -} elseif(!$allow_anonymous && !$sys_user_logged_in && !defined('IN_API')) { |
|
| 407 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 408 | +} elseif (!$allow_anonymous && !$sys_user_logged_in && !defined('IN_API')) { |
|
| 410 | 409 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
| 411 | 410 | } |
| 412 | 411 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $updater->upd_alter_table('users', ["DROP COLUMN `dpath`",], $updater->isFieldExists('users', 'dpath')); |
|
| 240 | + $updater->upd_alter_table('users', ["DROP COLUMN `dpath`", ], $updater->isFieldExists('users', 'dpath')); |
|
| 241 | 241 | |
| 242 | 242 | // 2017-06-12 13:47:36 42c1 |
| 243 | 243 | $updater->new_version = 42; |
@@ -250,14 +250,14 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // 2017-10-11 09:51:49 43a4.3 |
| 252 | 252 | $updater->upd_alter_table('messages', |
| 253 | - ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`",], |
|
| 253 | + ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`", ], |
|
| 254 | 254 | !$updater->isFieldExists('messages', 'message_json') |
| 255 | 255 | ); |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | // 2017-10-17 09:49:24 43a6.0 |
| 259 | 259 | // Removing old index i_user_id |
| 260 | - $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`',], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 260 | + $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`', ], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 261 | 261 | // Adding new index I_counter_user_id |
| 262 | 262 | $updater->upd_alter_table('counter', |
| 263 | 263 | [ |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | ); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $updater->updPatchApply(1, function () use ($updater) { |
|
| 314 | + $updater->updPatchApply(1, function() use ($updater) { |
|
| 315 | 315 | $q = $updater->upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true); |
| 316 | 316 | while ($row = db_fetch($q)) { |
| 317 | 317 | if (strpos($row['user'], 'a:') !== 0) { |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | }); |
| 334 | 334 | |
| 335 | 335 | // 2018-03-07 09:23:41 43a13.23 + 2018-03-07 12:00:47 43a13.24 |
| 336 | - $updater->updPatchApply(2, function () use ($updater) { |
|
| 336 | + $updater->updPatchApply(2, function() use ($updater) { |
|
| 337 | 337 | $updater->upd_alter_table('festival_gifts', [ |
| 338 | 338 | "ADD COLUMN `disclosure` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `amount`", |
| 339 | 339 | "ADD COLUMN `message` VARCHAR(4096) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' AFTER `disclosure`", |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | }); |
| 342 | 342 | |
| 343 | 343 | // 2018-03-12 13:23:10 43a13.33 |
| 344 | - $updater->updPatchApply(3, function () use ($updater) { |
|
| 344 | + $updater->updPatchApply(3, function() use ($updater) { |
|
| 345 | 345 | $updater->upd_alter_table('player_options', |
| 346 | 346 | [ |
| 347 | 347 | "MODIFY COLUMN `value` VARCHAR(16000) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''", |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | }); |
| 352 | 352 | |
| 353 | 353 | // 2018-03-24 21:31:51 43a16.16 - OiS |
| 354 | - $updater->updPatchApply(4, function () use ($updater) { |
|
| 354 | + $updater->updPatchApply(4, function() use ($updater) { |
|
| 355 | 355 | if (!$updater->isTableExists('festival_ois_player')) { |
| 356 | 356 | $updater->upd_create_table( |
| 357 | 357 | 'festival_ois_player', |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | }); |
| 371 | 371 | |
| 372 | 372 | // 2018-03-25 08:11:39 43a16.21 |
| 373 | - $updater->updPatchApply(5, function () use ($updater) { |
|
| 373 | + $updater->updPatchApply(5, function() use ($updater) { |
|
| 374 | 374 | $updater->upd_alter_table( |
| 375 | 375 | 'que', |
| 376 | 376 | "ADD COLUMN `que_unit_one_time_raw` DECIMAL(20,5) NOT NULL DEFAULT 0", |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $updater->upd_log_version_update(); |
| 388 | 388 | |
| 389 | 389 | // 2018-12-21 14:00:41 44a5 Module "ad_promo_code" support |
| 390 | - $updater->updPatchApply(6, function () use ($updater) { |
|
| 390 | + $updater->updPatchApply(6, function() use ($updater) { |
|
| 391 | 391 | if (!$updater->isTableExists('ad_promo_codes')) { |
| 392 | 392 | $updater->upd_create_table( |
| 393 | 393 | 'ad_promo_codes', |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | }); |
| 429 | 429 | |
| 430 | 430 | // 2018-12-22 11:42:20 44a12 |
| 431 | - $updater->updPatchApply(7, function () use ($updater) { |
|
| 431 | + $updater->updPatchApply(7, function() use ($updater) { |
|
| 432 | 432 | // Creating table for HTTP query strings |
| 433 | 433 | $updater->upd_create_table( |
| 434 | 434 | 'security_query_strings', |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $updater->upd_log_version_update(); |
| 571 | 571 | |
| 572 | 572 | // 2019-08-15 00:10:48 45a8 |
| 573 | - $updater->updPatchApply(8, function () use ($updater) { |
|
| 573 | + $updater->updPatchApply(8, function() use ($updater) { |
|
| 574 | 574 | if (!$updater->isTableExists('player_ignore')) { |
| 575 | 575 | $updater->upd_create_table( |
| 576 | 576 | 'player_ignore', |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | }, PATCH_REGISTER); |
| 592 | 592 | |
| 593 | 593 | // 2019-08-21 20:14:18 45a19 |
| 594 | - $updater->updPatchApply(9, function () use ($updater) { |
|
| 594 | + $updater->updPatchApply(9, function() use ($updater) { |
|
| 595 | 595 | $updater->upd_alter_table('payment', [ |
| 596 | 596 | 'ADD COLUMN `payment_method_id` smallint DEFAULT NULL AFTER `payment_module_name`', |
| 597 | 597 | 'ADD KEY `I_payment_method_id` (`payment_method_id`)', |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | }, PATCH_REGISTER); |
| 600 | 600 | |
| 601 | 601 | // 2020-02-18 21:00:19 45a71 |
| 602 | - $updater->updPatchApply(10, function () use ($updater) { |
|
| 602 | + $updater->updPatchApply(10, function() use ($updater) { |
|
| 603 | 603 | $name = classConfig::FLEET_UPDATE_MAX_RUN_TIME; |
| 604 | 604 | if (!SN::$gc->config->pass()->$name) { |
| 605 | 605 | SN::$gc->config->pass()->$name = 30; |
@@ -615,18 +615,18 @@ discard block |
||
| 615 | 615 | $updater->upd_log_version_update(); |
| 616 | 616 | |
| 617 | 617 | // 2021-03-03 13:41:05 46a13 |
| 618 | - $updater->updPatchApply(11, function () use ($updater) { |
|
| 618 | + $updater->updPatchApply(11, function() use ($updater) { |
|
| 619 | 619 | $updater->upd_alter_table('festival_gifts', [ |
| 620 | 620 | 'ADD COLUMN `gift_unit_id` bigint(20) NOT NULL DEFAULT 0 AFTER `amount`', |
| 621 | 621 | ], !$updater->isFieldExists('festival_gifts', 'gift_unit_id')); |
| 622 | 622 | }, PATCH_REGISTER); |
| 623 | 623 | |
| 624 | 624 | // 2024-04-13 13:04:16 46a127 |
| 625 | - $updater->updPatchApply(12, function () use ($updater) { |
|
| 625 | + $updater->updPatchApply(12, function() use ($updater) { |
|
| 626 | 626 | $updater->upd_alter_table('config', [ |
| 627 | 627 | "ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP", |
| 628 | 628 | "ADD COLUMN `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", |
| 629 | - ], ! $updater->isFieldExists('config', 'created_at')); |
|
| 629 | + ], !$updater->isFieldExists('config', 'created_at')); |
|
| 630 | 630 | |
| 631 | 631 | if (!$updater->isTableExists('festival_config')) { |
| 632 | 632 | $updater->upd_create_table( |
@@ -680,9 +680,9 @@ discard block |
||
| 680 | 680 | `config_value` = {$matches[4]} |
| 681 | 681 | ;"); |
| 682 | 682 | $patched++; |
| 683 | - } elseif(empty($festival->num_rows)) { |
|
| 683 | + } elseif (empty($festival->num_rows)) { |
|
| 684 | 684 | $updater->upd_log_message("Warning! Festival ID {$matches[1]} not found"); |
| 685 | - } elseif(empty($highspot->num_rows)) { |
|
| 685 | + } elseif (empty($highspot->num_rows)) { |
|
| 686 | 686 | $updater->upd_log_message("Warning! Highspot ID {$matches[2]} not found"); |
| 687 | 687 | } |
| 688 | 688 | // pdump($matches); |
@@ -695,9 +695,9 @@ discard block |
||
| 695 | 695 | $updater->upd_log_message("Migrated {$patched}/{$total} festival configuration records"); |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - $updater->upd_alter_table('que', ['DROP KEY `que_id`',], $updater->isIndexExists('que', 'que_id')); |
|
| 699 | - $updater->upd_alter_table('counter', ['DROP KEY `counter_id`',], $updater->isIndexExists('counter', 'counter_id')); |
|
| 700 | - $updater->upd_alter_table('captain', ['DROP KEY `captain_id`',], $updater->isIndexExists('captain', 'captain_id')); |
|
| 698 | + $updater->upd_alter_table('que', ['DROP KEY `que_id`', ], $updater->isIndexExists('que', 'que_id')); |
|
| 699 | + $updater->upd_alter_table('counter', ['DROP KEY `counter_id`', ], $updater->isIndexExists('counter', 'counter_id')); |
|
| 700 | + $updater->upd_alter_table('captain', ['DROP KEY `captain_id`', ], $updater->isIndexExists('captain', 'captain_id')); |
|
| 701 | 701 | }, PATCH_PRE_CHECK); |
| 702 | 702 | |
| 703 | 703 | // // #ctv |
@@ -692,7 +692,7 @@ |
||
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - $updater->upd_log_message("Migrated {$patched}/{$total} festival configuration records"); |
|
| 695 | + $updater->upd_log_message("migrated {$patched}/{$total} festival configuration records"); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | $updater->upd_alter_table('que', ['DROP KEY `que_id`',], $updater->isIndexExists('que', 'que_id')); |