@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
| 115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
| 115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
| 116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
| 117 | 117 | }); |
| 118 | 118 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | if ($request['metamatter'] && $payment_module_request) { |
| 224 | 224 | try { |
| 225 | 225 | $paymentModuleReal = SN::$gc->modules->getModule($payment_module_request); |
| 226 | - if(!is_object($paymentModuleReal)) { |
|
| 226 | + if (!is_object($paymentModuleReal)) { |
|
| 227 | 227 | throw new Exception('{ Менеджер модулей вернул null вместо платёжного модуля для }' . $payment_module_request, ERR_ERROR); |
| 228 | 228 | } |
| 229 | 229 | /** |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | 'PLAYER_CURRENCY' => $player_currency, |
| 313 | 313 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
| 314 | 314 | |
| 315 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
| 315 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
| 316 | 316 | 'UNIT_AMOUNT_TEXT' => HelperString::numberFloorAndFormat($request['metamatter']), |
| 317 | 317 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
| 318 | 318 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 4 | 4 | |
| 5 | -if(SN::$gc->modules->getModulesActiveCount('payment') && !defined('SN_GOOGLE')) { |
|
| 5 | +if (SN::$gc->modules->getModulesActiveCount('payment') && !defined('SN_GOOGLE')) { |
|
| 6 | 6 | sys_redirect('metamatter.php'); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -91,95 +91,95 @@ |
||
| 91 | 91 | |
| 92 | 92 | // Services -------------------------------------------------------------------------------------------------------- |
| 93 | 93 | // Default db |
| 94 | - $gc->db = function (GlobalContainer $c) { |
|
| 94 | + $gc->db = function(GlobalContainer $c) { |
|
| 95 | 95 | SN::$db = new \db_mysql($c); |
| 96 | 96 | |
| 97 | 97 | return SN::$db; |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
| 100 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
| 101 | 101 | GlobalContainer $c) { |
| 102 | 102 | return new \debug(); |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | - $gc->cache = function (GlobalContainer $gc) { |
|
| 105 | + $gc->cache = function(GlobalContainer $gc) { |
|
| 106 | 106 | return new \classCache($gc->cachePrefix); |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | - $gc->config = function (GlobalContainer $gc) { |
|
| 109 | + $gc->config = function(GlobalContainer $gc) { |
|
| 110 | 110 | return new \classConfig($gc->cachePrefix); |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $gc->repository = function (GlobalContainer $gc) { |
|
| 114 | + $gc->repository = function(GlobalContainer $gc) { |
|
| 115 | 115 | return new Repository($gc); |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | - $gc->storage = function (GlobalContainer $gc) { |
|
| 118 | + $gc->storage = function(GlobalContainer $gc) { |
|
| 119 | 119 | return new \Storage($gc); |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | - $gc->design = function (GlobalContainer $gc) { |
|
| 122 | + $gc->design = function(GlobalContainer $gc) { |
|
| 123 | 123 | return new \Design($gc); |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
| 126 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
| 127 | 127 | return new \BBCodeParser($gc); |
| 128 | 128 | }; |
| 129 | 129 | |
| 130 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
| 130 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
| 131 | 131 | return new \FleetDispatcher($gc); |
| 132 | 132 | }; |
| 133 | 133 | |
| 134 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
| 134 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
| 135 | 135 | return new Watchdog($gc); |
| 136 | 136 | }; |
| 137 | 137 | |
| 138 | - $gc->eventBus = function (GlobalContainer $gc) { |
|
| 138 | + $gc->eventBus = function(GlobalContainer $gc) { |
|
| 139 | 139 | return new EventBus($gc); |
| 140 | 140 | }; |
| 141 | 141 | |
| 142 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
| 142 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
| 143 | 143 | return new ValueStorage([]); |
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
| 146 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
| 147 | 147 | return new BonusCatalog($gc); |
| 148 | 148 | }; |
| 149 | 149 | |
| 150 | - $gc->general = function (GlobalContainer $gc) { |
|
| 150 | + $gc->general = function(GlobalContainer $gc) { |
|
| 151 | 151 | return new General($gc); |
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
| 154 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
| 155 | 155 | return new EconomicHelper($gc); |
| 156 | 156 | }; |
| 157 | 157 | |
| 158 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
| 158 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
| 159 | 159 | return new PlayerLevelHelper($gc); |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | - $gc->pimp = function (GlobalContainer $gc) { |
|
| 162 | + $gc->pimp = function(GlobalContainer $gc) { |
|
| 163 | 163 | return new SnPimp($gc); |
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | - $gc->modules = function (GlobalContainer $gc) { |
|
| 166 | + $gc->modules = function(GlobalContainer $gc) { |
|
| 167 | 167 | return new Manager($gc); |
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | // Dummy objects --------------------------------------------------------------------------------------------------- |
| 171 | - $gc->theUser = function (GlobalContainer $gc) { |
|
| 171 | + $gc->theUser = function(GlobalContainer $gc) { |
|
| 172 | 172 | return new \TheUser($gc); |
| 173 | 173 | }; |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | // Models ---------------------------------------------------------------------------------------------------------- |
| 177 | 177 | $gc->skinEntityClass = \SkinV2::class; |
| 178 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
| 178 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
| 179 | 179 | return new \SkinModel($gc); |
| 180 | 180 | }; |
| 181 | 181 | |
| 182 | - $gc->textModel = function (GlobalContainer $gc) { |
|
| 182 | + $gc->textModel = function(GlobalContainer $gc) { |
|
| 183 | 183 | return new \TextModel($gc); |
| 184 | 184 | }; |
| 185 | 185 | |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | $this->secret_word = SN::$sn_secret_word; |
| 92 | 92 | |
| 93 | 93 | $snTableNames = $this->db->schema()->getSnTables(); |
| 94 | - foreach($this->table_check as $table_name) { |
|
| 95 | - if(empty($snTableNames[$table_name])) { |
|
| 94 | + foreach ($this->table_check as $table_name) { |
|
| 95 | + if (empty($snTableNames[$table_name])) { |
|
| 96 | 96 | die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br /> |
| 97 | 97 | В противном случае - сообщите Администрации сервера об ошибке.<br/> |
| 98 | 98 | Не хватает таблицы для работы системы авторизации: ' . $table_name); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | // OK v4.6 |
| 118 | 118 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
| 119 | - if(!$this->password_check($old_password_unsafe)) { |
|
| 119 | + if (!$this->password_check($old_password_unsafe)) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // OK v4.5 |
| 138 | 138 | public function assign_from_db_row($row) { |
| 139 | 139 | $this->reset(); |
| 140 | - if(empty($row) || !is_array($row)) { |
|
| 140 | + if (empty($row) || !is_array($row)) { |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | $this->account_id = $row['account_id']; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $this->reset(); |
| 203 | 203 | |
| 204 | 204 | $email_safe = $this->db->db_escape($email_unsafe); |
| 205 | - if($email_safe) { |
|
| 205 | + if ($email_safe) { |
|
| 206 | 206 | $account_row = $this->db->doquery("SELECT * FROM {{account}} WHERE LOWER(`account_email`) = LOWER('{$email_safe}') FOR UPDATE;", true); |
| 207 | 207 | |
| 208 | 208 | return $this->assign_from_db_row($account_row); |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | `account_email` = LOWER('{$email_safe}'), |
| 276 | 276 | `account_language` = '{$language_safe}'" |
| 277 | 277 | ); |
| 278 | - if(!$result) { |
|
| 278 | + if (!$result) { |
|
| 279 | 279 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if(!($account_id = $this->db->db_insert_id())) { |
|
| 282 | + if (!($account_id = $this->db->db_insert_id())) { |
|
| 283 | 283 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | WHERE `account_id` = '{$account_id_safe}'" |
| 310 | 310 | ) ? true : false; |
| 311 | 311 | |
| 312 | - if($result) { |
|
| 312 | + if ($result) { |
|
| 313 | 313 | $result = $this->db_get_by_id($this->account_id); |
| 314 | 314 | } |
| 315 | 315 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | public function metamatter_change($change_type, $metamatter, $comment = false, $already_changed = false) { |
| 399 | 399 | global $debug, $mm_change_legit, $config; |
| 400 | 400 | |
| 401 | - if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
| 401 | + if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
| 402 | 402 | $debug->error('Ошибка при попытке манипуляции с ММ'); |
| 403 | 403 | return false; |
| 404 | 404 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $mm_change_legit = true; |
| 409 | 409 | // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER); |
| 410 | - if($already_changed) { |
|
| 410 | + if ($already_changed) { |
|
| 411 | 411 | $metamatter_total_delta = 0; |
| 412 | 412 | $result = -1; |
| 413 | 413 | } else { |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$config->player_metamatter_immortal} AND `account_immortal` IS NULL, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') . |
| 421 | 421 | " WHERE `account_id` = {$account_id_safe}" |
| 422 | 422 | ); |
| 423 | - if(!$result) { |
|
| 423 | + if (!$result) { |
|
| 424 | 424 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
| 425 | 425 | } |
| 426 | 426 | $result = SN::$db->db_affected_rows(); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $this->awardImmortal($metamatter, $config); |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if(empty(core_auth::$user['id'])) { |
|
| 431 | + if (empty(core_auth::$user['id'])) { |
|
| 432 | 432 | $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id); |
| 433 | 433 | reset($user_list); |
| 434 | 434 | $user_id_unsafe = key($user_list); |
@@ -437,30 +437,30 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | $user_id_safe = $this->db->db_escape($user_id_unsafe); |
| 439 | 439 | |
| 440 | - if(!$result) { |
|
| 440 | + if (!$result) { |
|
| 441 | 441 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if(!$already_changed) { |
|
| 444 | + if (!$already_changed) { |
|
| 445 | 445 | $this->account_metamatter += $metamatter; |
| 446 | 446 | $this->account_metamatter_total += $metamatter_total_delta; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - if(is_array($comment)) { |
|
| 449 | + if (is_array($comment)) { |
|
| 450 | 450 | $comment = call_user_func_array('sprintf', $comment); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe); |
| 454 | 454 | |
| 455 | - if($metamatter > 0 && !empty($user_id_safe)) { |
|
| 455 | + if ($metamatter > 0 && !empty($user_id_safe)) { |
|
| 456 | 456 | $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id_safe} LIMIT 1 FOR UPDATE;", '', true); |
| 457 | - if($old_referral['id']) { |
|
| 457 | + if ($old_referral['id']) { |
|
| 458 | 458 | $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM; |
| 459 | 459 | doquery("UPDATE {{referrals}} SET dark_matter = dark_matter + '{$dark_matter_from_metamatter}' WHERE `id` = {$user_id_safe} LIMIT 1;"); |
| 460 | 460 | $new_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id_safe} LIMIT 1;", '', true); |
| 461 | 461 | |
| 462 | 462 | $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0); |
| 463 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 463 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
| 464 | 464 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}"); |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * @throws Exception |
| 477 | 477 | */ |
| 478 | 478 | public function cookieSet($rememberMe = false, $domain = null) { |
| 479 | - if(!$this->is_exists) { |
|
| 479 | + if (!$this->is_exists) { |
|
| 480 | 480 | throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR); |
| 481 | 481 | } |
| 482 | 482 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | // OK v4.1 |
| 496 | 496 | public function cookieClear($domain = null) { |
| 497 | 497 | // Автоматически вообще-то - если установлена кука имперсонатора - то чистим обычную, а куку имперсонатора - копируем в неё |
| 498 | - if(!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
| 498 | + if (!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
| 499 | 499 | sn_setcookie($this->cookie_name, $_COOKIE[$this->cookie_name_impersonate], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $domain); |
| 500 | 500 | sn_setcookie($this->cookie_name_impersonate, '', SN_TIME_NOW - PERIOD_WEEK, $this->sn_root_path, $domain); |
| 501 | 501 | } else { |
@@ -505,14 +505,14 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | public function cookieLogin(&$rememberMe = false) { |
| 507 | 507 | // Пытаемся войти по куке |
| 508 | - if(!empty($_COOKIE[$this->cookie_name])) { |
|
| 509 | - if(count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
| 508 | + if (!empty($_COOKIE[$this->cookie_name])) { |
|
| 509 | + if (count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
| 510 | 510 | list($account_id_unsafe, $cookie_password_hash_salted, $user_remember_me) = explode(AUTH_COOKIE_DELIMETER, $_COOKIE[$this->cookie_name]); |
| 511 | 511 | } else { |
| 512 | 512 | list($account_id_unsafe, $user_name, $cookie_password_hash_salted, $user_remember_me) = explode("/%/", $_COOKIE[$this->cookie_name]); |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - if( |
|
| 515 | + if ( |
|
| 516 | 516 | $this->db_get_by_id($account_id_unsafe) |
| 517 | 517 | && ($this->password_encode_for_cookie($this->account_password) == $cookie_password_hash_salted) |
| 518 | 518 | ) { |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | protected function awardImmortal($metamatter, $config) { |
| 540 | 540 | $awardModule = SN::$gc->modules->getModule('player_award'); |
| 541 | - if(!is_object($awardModule)) { |
|
| 541 | + if (!is_object($awardModule)) { |
|
| 542 | 542 | return; |
| 543 | 543 | } |
| 544 | 544 | /** |
| 545 | 545 | * @var player_award $awardModule |
| 546 | 546 | */ |
| 547 | - if ($this->account_metamatter + $metamatter >= $config->player_metamatter_immortal ) { |
|
| 547 | + if ($this->account_metamatter + $metamatter >= $config->player_metamatter_immortal) { |
|
| 548 | 548 | $account_translation = PlayerToAccountTranslate::db_translate_get_users_from_account_list(ACCOUNT_PROVIDER_LOCAL, $this->account_id); |
| 549 | 549 | if (!empty($account_translation)) { |
| 550 | 550 | reset($account_translation); |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | * @return bool|mysqli_result|null |
| 567 | 567 | */ |
| 568 | 568 | public function getMetamatterSum($where = '', $group = '') { |
| 569 | - if(is_array($where) && !empty($where)) { |
|
| 569 | + if (is_array($where) && !empty($where)) { |
|
| 570 | 570 | $where = implode(' AND ', $where); |
| 571 | 571 | } |
| 572 | - if(is_array($group) && !empty($group)) { |
|
| 572 | + if (is_array($group) && !empty($group)) { |
|
| 573 | 573 | $group = implode(',', $group); |
| 574 | 574 | } |
| 575 | 575 | |
@@ -191,18 +191,18 @@ discard block |
||
| 191 | 191 | // TODO Хотя тут может получится вечный цикл - ПОДУМАТЬ |
| 192 | 192 | // TODO Тут же можно пробовать провести попытку слияния аккаунтов - хотя это и очень небезопасно |
| 193 | 193 | |
| 194 | - if(sys_get_param('login_player_register_logout')) { |
|
| 194 | + if (sys_get_param('login_player_register_logout')) { |
|
| 195 | 195 | $this->logout(); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | $original_suggest = ''; |
| 199 | 199 | // Смотрим - есть ли у нас данные от пользователя |
| 200 | - if(($player_name_submitted = sys_get_param('submit_player_name'))) { |
|
| 200 | + if (($player_name_submitted = sys_get_param('submit_player_name'))) { |
|
| 201 | 201 | // Попытка регистрации нового игрока из данных, введенных пользователем |
| 202 | 202 | $this->player_suggested_name = sys_get_param_str_unsafe('player_suggested_name'); |
| 203 | 203 | } else { |
| 204 | - foreach($this->providers_authorised as $provider) { |
|
| 205 | - if($this->player_suggested_name = $provider->player_name_suggest()) { // OK 4.5 |
|
| 204 | + foreach ($this->providers_authorised as $provider) { |
|
| 205 | + if ($this->player_suggested_name = $provider->player_name_suggest()) { // OK 4.5 |
|
| 206 | 206 | $original_suggest = $provider->player_name_suggest(); |
| 207 | 207 | break; |
| 208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Если у нас провайдеры не дают имени и пользователь не дал свой вариант - это у нас первый логин в игру |
| 213 | - if(!$this->player_suggested_name) { |
|
| 213 | + if (!$this->player_suggested_name) { |
|
| 214 | 214 | $max_user_id = db_player_get_max_id(); // 4.5 |
| 215 | 215 | // TODO - предлагать имя игрока по локали |
| 216 | 216 | |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | sn_db_transaction_rollback(); |
| 220 | 220 | $this->player_suggested_name = 'Emperor ' . mt_rand($max_user_id + 1, $max_user_id + 1000); |
| 221 | 221 | sn_db_transaction_start(); |
| 222 | - } while(db_player_name_exists($this->player_suggested_name)); |
|
| 222 | + } while (db_player_name_exists($this->player_suggested_name)); |
|
| 223 | 223 | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if($player_name_submitted) { |
|
| 226 | + if ($player_name_submitted) { |
|
| 227 | 227 | $this->register_player_db_create($this->player_suggested_name); // OK 4.5 |
| 228 | - if($this->register_status == LOGIN_SUCCESS) { |
|
| 228 | + if ($this->register_status == LOGIN_SUCCESS) { |
|
| 229 | 229 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 230 | - } elseif($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) { |
|
| 230 | + } elseif ($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) { |
|
| 231 | 231 | // self::$player_suggested_name .= ' ' . $this->account->account_id; |
| 232 | 232 | } |
| 233 | 233 | // if(self::$login_status != LOGIN_SUCCESS) { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | : false |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - if($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 254 | + if ($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 255 | 255 | $prohibited_characters = array_map(function($value) { |
| 256 | 256 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
| 257 | 257 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | // !self::$is_init ? self::init() : false; |
| 286 | 286 | |
| 287 | - if(!SN::$gc->modules->getModulesActiveCount('auth')) { |
|
| 287 | + if (!SN::$gc->modules->getModulesActiveCount('auth')) { |
|
| 288 | 288 | die('{Не обнаружено ни одного провайдера авторизации в core_auth::login()!}'); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | !empty($_POST) ? self::flog(dump($_POST, '$_POST')) : false; |
| 292 | 292 | !empty($_GET) ? self::flog(dump($_GET, '$_GET')) : false; |
| 293 | - !empty($_COOKIE) ? self::flog(dump($_COOKIE,'$_COOKIE')) : false; |
|
| 293 | + !empty($_COOKIE) ? self::flog(dump($_COOKIE, '$_COOKIE')) : false; |
|
| 294 | 294 | |
| 295 | 295 | $this->auth_reset(); // OK v4.5 |
| 296 | 296 | |
| 297 | 297 | $this->providers = array(); |
| 298 | - foreach(SN::$gc->modules->getModulesActive('auth') as $module_name => $module) { |
|
| 298 | + foreach (SN::$gc->modules->getModulesActive('auth') as $module_name => $module) { |
|
| 299 | 299 | /** |
| 300 | 300 | * @var auth_abstract $module |
| 301 | 301 | */ |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | // $this->providers = array_reverse($this->providers, true); // НИНАДА! СН-аккаунт должен всегда авторизироваться первым! |
| 306 | 306 | //pdump($this->providers); |
| 307 | - foreach($this->providers as $provider_id => $provider) { |
|
| 307 | + foreach ($this->providers as $provider_id => $provider) { |
|
| 308 | 308 | $login_status = $provider->login(); // OK v4.5 |
| 309 | 309 | self::flog(($provider->manifest['name'] . '->' . 'login_try - ') . (empty($provider->account->account_id) ? $lang['sys_login_messages'][$provider->account_login_status] : dump($provider))); |
| 310 | - if($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) { |
|
| 310 | + if ($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) { |
|
| 311 | 311 | $this->providers_authorised[$provider_id] = &$this->providers[$provider_id]; |
| 312 | 312 | |
| 313 | 313 | $this->user_id_to_provider = array_replace_recursive( |
@@ -315,20 +315,20 @@ discard block |
||
| 315 | 315 | // static::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id) // OK 4.5 |
| 316 | 316 | PlayerToAccountTranslate::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id) // OK 4.5 |
| 317 | 317 | ); |
| 318 | - } elseif($login_status != LOGIN_UNDEFINED) { |
|
| 318 | + } elseif ($login_status != LOGIN_UNDEFINED) { |
|
| 319 | 319 | $this->provider_error_list[$provider_id] = $login_status; |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if(empty($this->providers_authorised)) { |
|
| 323 | + if (empty($this->providers_authorised)) { |
|
| 324 | 324 | // Ни один аккаунт не авторизирован |
| 325 | 325 | // Проверяем - есть ли у нас ошибки в аккаунтах? |
| 326 | - if(!empty($this->provider_error_list)) { |
|
| 326 | + if (!empty($this->provider_error_list)) { |
|
| 327 | 327 | // Если есть - выводим их |
| 328 | 328 | self::$login_status = reset($this->provider_error_list); |
| 329 | 329 | $providerError = $this->providers[key($this->provider_error_list)]->account_login_message; |
| 330 | 330 | |
| 331 | - if(!empty($providerError)) { |
|
| 331 | + if (!empty($providerError)) { |
|
| 332 | 332 | self::$login_message = $providerError; |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -343,12 +343,12 @@ discard block |
||
| 343 | 343 | // В self::$accessible_user_row_list - список доступных игроков для данных аккаунтов с соответствующими записями из таблицы `users` |
| 344 | 344 | |
| 345 | 345 | // Остались ли у нас в списке доступные игроки? |
| 346 | - if(empty($this->accessible_user_row_list)) { |
|
| 346 | + if (empty($this->accessible_user_row_list)) { |
|
| 347 | 347 | // Нет ни одного игрока ни на одном авторизированном аккаунте |
| 348 | 348 | // Надо регать нового игрока |
| 349 | 349 | |
| 350 | 350 | // Сейчас происходит процесс регистрации игрока? |
| 351 | - if(!$this->is_player_register) { |
|
| 351 | + if (!$this->is_player_register) { |
|
| 352 | 352 | // Нет - отправляем на процесс регистрации |
| 353 | 353 | $partner_id = sys_get_param_int('id_ref', sys_get_param_int('partner_id')); |
| 354 | 354 | sys_redirect(SN_ROOT_VIRTUAL . 'index.php?page=player_register&player_register=1' . ($partner_id ? '&id_ref=' . $partner_id : '')); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | // Да, есть доступные игроки, которые так же прописаны в базе |
| 358 | 358 | $this->get_active_user(); // 4.5 |
| 359 | 359 | |
| 360 | - if($this->is_impersonating = !empty($_COOKIE[SN_COOKIE_U_I]) ? $_COOKIE[SN_COOKIE_U_I] : 0) { |
|
| 360 | + if ($this->is_impersonating = !empty($_COOKIE[SN_COOKIE_U_I]) ? $_COOKIE[SN_COOKIE_U_I] : 0) { |
|
| 361 | 361 | $a_user = db_user_by_id($this->is_impersonating); |
| 362 | 362 | $this->impersonator_username = $a_user['username']; |
| 363 | 363 | } |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | //Прописываем текущего игрока на все авторизированные аккаунты |
| 367 | 367 | // TODO - ИЛИ ВСЕХ ИГРОКОВ?? |
| 368 | - if(empty($this->is_impersonating)) { |
|
| 369 | - foreach($this->providers_authorised as $provider_id => $provider) { |
|
| 370 | - if(empty($this->user_id_to_provider[self::$user['id']][$provider_id])) { |
|
| 368 | + if (empty($this->is_impersonating)) { |
|
| 369 | + foreach ($this->providers_authorised as $provider_id => $provider) { |
|
| 370 | + if (empty($this->user_id_to_provider[self::$user['id']][$provider_id])) { |
|
| 371 | 371 | // self::db_translate_register_user($provider_id, $provider->account->account_id, self::$user['id']); |
| 372 | 372 | PlayerToAccountTranslate::db_translate_register_user($provider_id, $provider->account->account_id, self::$user['id']); |
| 373 | 373 | $this->user_id_to_provider[self::$user['id']][$provider_id][$provider->account->account_id] = true; |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - if(empty(self::$user['id'])) { |
|
| 380 | + if (empty(self::$user['id'])) { |
|
| 381 | 381 | self::cookie_set(''); // OK 4.5 |
| 382 | - } elseif(self::$user['id'] != $_COOKIE[SN_COOKIE_U]) { |
|
| 382 | + } elseif (self::$user['id'] != $_COOKIE[SN_COOKIE_U]) { |
|
| 383 | 383 | self::cookie_set(self::$user['id']); // OK 4.5 |
| 384 | 384 | } |
| 385 | 385 | |
@@ -398,21 +398,21 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | // OK v4.7 |
| 400 | 400 | public function logout($redirect = true) { |
| 401 | - if(!empty($_COOKIE[SN_COOKIE_U_I])) { |
|
| 401 | + if (!empty($_COOKIE[SN_COOKIE_U_I])) { |
|
| 402 | 402 | self::cookie_set($_COOKIE[SN_COOKIE_U_I]); |
| 403 | 403 | self::cookie_set(0, true); |
| 404 | 404 | self::$main_provider->logout(); |
| 405 | 405 | } else { |
| 406 | - foreach($this->providers as $provider_name => $provider) { |
|
| 406 | + foreach ($this->providers as $provider_name => $provider) { |
|
| 407 | 407 | $provider->logout(); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | self::cookie_set(0); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if($redirect === true) { |
|
| 413 | + if ($redirect === true) { |
|
| 414 | 414 | sys_redirect(SN_ROOT_RELATIVE . (empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php')); |
| 415 | - } elseif($redirect !== false) { |
|
| 415 | + } elseif ($redirect !== false) { |
|
| 416 | 416 | sys_redirect($redirect); |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -423,15 +423,15 @@ discard block |
||
| 423 | 423 | * @param $user_selected |
| 424 | 424 | */ |
| 425 | 425 | public function impersonate($user_selected) { |
| 426 | - if($_COOKIE[SN_COOKIE_U_I]) { |
|
| 426 | + if ($_COOKIE[SN_COOKIE_U_I]) { |
|
| 427 | 427 | die('You already impersonating someone. Go back to living other\'s life! Or clear your cookies and try again'); // TODO: Log it |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if($this->auth_level_max_local < AUTH_LEVEL_ADMINISTRATOR) { |
|
| 430 | + if ($this->auth_level_max_local < AUTH_LEVEL_ADMINISTRATOR) { |
|
| 431 | 431 | die('You can\'t impersonate - too low level'); // TODO: Log it |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if($this->auth_level_max_local <= $user_selected['authlevel']) { |
|
| 434 | + if ($this->auth_level_max_local <= $user_selected['authlevel']) { |
|
| 435 | 435 | die('You can\'t impersonate this account - level is greater or equal to yours'); // TODO: Log it |
| 436 | 436 | } |
| 437 | 437 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $account_translate = reset($account_translate[$user_selected['id']][self::$main_provider->provider_id]); |
| 440 | 440 | $account_to_impersonate = new Account(self::$main_provider->db); |
| 441 | 441 | $account_to_impersonate->db_get_by_id($account_translate['provider_account_id']); |
| 442 | - if(!$account_to_impersonate->is_exists) { |
|
| 442 | + if (!$account_to_impersonate->is_exists) { |
|
| 443 | 443 | die('Какая-то ошибка - не могу найти аккаунт для имперсонации'); // TODO: Log it |
| 444 | 444 | } |
| 445 | 445 | self::$main_provider->impersonate($account_to_impersonate); |
@@ -465,12 +465,12 @@ discard block |
||
| 465 | 465 | public function password_check($password_unsafe) { |
| 466 | 466 | $result = false; |
| 467 | 467 | |
| 468 | - if(empty($this->providers_authorised)) { |
|
| 468 | + if (empty($this->providers_authorised)) { |
|
| 469 | 469 | // TODO - такого быть не может! |
| 470 | 470 | self::flog("password_check: Не найдено ни одного авторизированного провайдера в self::\$providers_authorised", true); |
| 471 | 471 | } else { |
| 472 | - foreach($this->providers_authorised as $provider_id => $provider) { |
|
| 473 | - if($provider->is_feature_supported(AUTH_FEATURE_HAS_PASSWORD)) { |
|
| 472 | + foreach ($this->providers_authorised as $provider_id => $provider) { |
|
| 473 | + if ($provider->is_feature_supported(AUTH_FEATURE_HAS_PASSWORD)) { |
|
| 474 | 474 | $result = $result || $provider->password_check($password_unsafe); |
| 475 | 475 | } |
| 476 | 476 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | public function password_change($old_password_unsafe, $new_password_unsafe) { |
| 492 | 492 | global $lang; |
| 493 | 493 | |
| 494 | - if(empty($this->providers_authorised)) { |
|
| 494 | + if (empty($this->providers_authorised)) { |
|
| 495 | 495 | // TODO - такого быть не может! |
| 496 | 496 | self::flog("Не найдено ни одного авторизированного провайдера в self::\$providers_authorised", true); |
| 497 | 497 | return false; |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | $salt_unsafe = self::password_salt_generate(); |
| 505 | 505 | |
| 506 | 506 | $providers_changed_password = array(); |
| 507 | - foreach($this->providers_authorised as $provider_id => $provider) { |
|
| 508 | - if( |
|
| 507 | + foreach ($this->providers_authorised as $provider_id => $provider) { |
|
| 508 | + if ( |
|
| 509 | 509 | !$provider->is_feature_supported(AUTH_FEATURE_PASSWORD_CHANGE) |
| 510 | 510 | || !$provider->password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe) |
| 511 | 511 | ) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $account_translation = PlayerToAccountTranslate::db_translate_get_users_from_account_list($provider_id, $provider->account->account_id); |
| 518 | 518 | |
| 519 | 519 | // Рассылаем уведомления о смене пароля в ЛС |
| 520 | - foreach($account_translation as $user_id => $provider_info) { |
|
| 520 | + foreach ($account_translation as $user_id => $provider_info) { |
|
| 521 | 521 | // TODO - УКазывать тип аккаунта, на котором сменён пароль |
| 522 | 522 | msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN, |
| 523 | 523 | $lang['sys_administration'], $lang['sys_login_register_message_title'], |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | sn_db_transaction_start(); |
| 565 | 565 | // Проверить наличие такого имени в истории имён |
| 566 | 566 | |
| 567 | - if(db_player_name_exists($player_name_unsafe)) { |
|
| 567 | + if (db_player_name_exists($player_name_unsafe)) { |
|
| 568 | 568 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_EXISTS, ERR_ERROR); |
| 569 | 569 | } |
| 570 | 570 | |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | $player_language = ''; |
| 573 | 573 | $player_email = ''; |
| 574 | 574 | // TODO - порнография - работа должна происходить над списком аккаунтов, а не только на одном аккаунте... |
| 575 | - foreach($this->providers_authorised as $provider) { |
|
| 576 | - if(!$player_language && $provider->account->account_language) { |
|
| 575 | + foreach ($this->providers_authorised as $provider) { |
|
| 576 | + if (!$player_language && $provider->account->account_language) { |
|
| 577 | 577 | $player_language = $provider->account->account_language; |
| 578 | 578 | } |
| 579 | - if(!$player_email && $provider->account->account_email) { |
|
| 579 | + if (!$player_email && $provider->account->account_email) { |
|
| 580 | 580 | $player_email = $provider->account->account_email; |
| 581 | 581 | } |
| 582 | 582 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | )); |
| 593 | 593 | // Зарегестрировать на него аккаунты из self::$accounts_authorised |
| 594 | 594 | $a_user = self::$user; |
| 595 | - foreach($this->providers_authorised as $provider) { |
|
| 595 | + foreach ($this->providers_authorised as $provider) { |
|
| 596 | 596 | // TODO - порнография. Должен быть отдельный класс трансляторов - в т.ч. и кэширующий транслятор |
| 597 | 597 | // TODO - ну и работа должна происходить над списком аккаунтов, а не только на одном аккаунте... |
| 598 | 598 | // self::db_translate_register_user($provider->provider_id, $provider->account->account_id, $a_user['id']); |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | sn_db_transaction_commit(); |
| 606 | 606 | $this->register_status = LOGIN_SUCCESS; |
| 607 | - } catch(Exception $e) { |
|
| 607 | + } catch (Exception $e) { |
|
| 608 | 608 | sn_db_transaction_rollback(); |
| 609 | 609 | |
| 610 | 610 | // Если старое имя занято |
@@ -623,10 +623,10 @@ discard block |
||
| 623 | 623 | // Пробиваем все ИД игроков по базе - есть ли вообще такие записи |
| 624 | 624 | // Вообще-то это не особо нужно - у нас по определению стоят констраинты |
| 625 | 625 | // Зато так мы узнаем максимальный authlevel, проверим права имперсонейта и вытащим все записи юзеров |
| 626 | - foreach($this->user_id_to_provider as $user_id => $cork) { |
|
| 626 | + foreach ($this->user_id_to_provider as $user_id => $cork) { |
|
| 627 | 627 | $user = db_user_by_id($user_id); |
| 628 | 628 | // Если записи игрока в БД не существует? |
| 629 | - if(empty($user['id'])) { |
|
| 629 | + if (empty($user['id'])) { |
|
| 630 | 630 | // Удаляем этого и переходим к следующему |
| 631 | 631 | unset($this->user_id_to_provider[$user_id]); |
| 632 | 632 | // Де-регистрируем игрока из таблицы трансляции игроков |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | // OK v4.5 |
| 648 | 648 | protected function get_active_user() { |
| 649 | 649 | // Проверяем куку "текущего игрока" из браузера |
| 650 | - if( |
|
| 650 | + if ( |
|
| 651 | 651 | // Кука не пустая |
| 652 | 652 | ($_COOKIE[SN_COOKIE_U] = trim($_COOKIE[SN_COOKIE_U])) && !empty($_COOKIE[SN_COOKIE_U]) |
| 653 | 653 | // И в куке находится ID |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | // В куке нет валидного ИД записи игрока, доступной с текущих аккаунтов |
| 675 | - if(empty(self::$user['id'])) { |
|
| 675 | + if (empty(self::$user['id'])) { |
|
| 676 | 676 | // Берем первого из доступных |
| 677 | 677 | // TODO - default_user |
| 678 | 678 | self::$user = reset($this->accessible_user_row_list); |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | $result = array(); |
| 698 | 698 | |
| 699 | - if($user_id && empty($this->is_impersonating)) { |
|
| 699 | + if ($user_id && empty($this->is_impersonating)) { |
|
| 700 | 700 | // self::db_counter_insert(); |
| 701 | 701 | self::$device->db_counter_insert($user_id); |
| 702 | 702 | |
@@ -704,12 +704,12 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | sys_user_options_unpack($user); |
| 706 | 706 | |
| 707 | - if($user['banaday'] && $user['banaday'] <= SN_TIME_NOW) { |
|
| 707 | + if ($user['banaday'] && $user['banaday'] <= SN_TIME_NOW) { |
|
| 708 | 708 | $user['banaday'] = 0; |
| 709 | 709 | $user['vacation'] = SN_TIME_NOW; |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - $user['user_lastip'] = self::$device->ip_v4_string;// $ip['ip']; |
|
| 712 | + $user['user_lastip'] = self::$device->ip_v4_string; // $ip['ip']; |
|
| 713 | 713 | $user['user_proxy'] = self::$device->ip_v4_proxy_chain; //$ip['proxy_chain']; |
| 714 | 714 | |
| 715 | 715 | $result[F_BANNED_STATUS] = $user['banaday']; |
@@ -723,13 +723,13 @@ discard block |
||
| 723 | 723 | ); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - if($extra = $config->security_ban_extra) { |
|
| 726 | + if ($extra = $config->security_ban_extra) { |
|
| 727 | 727 | $extra = explode(',', $extra); |
| 728 | - array_walk($extra,'trim'); |
|
| 728 | + array_walk($extra, 'trim'); |
|
| 729 | 729 | in_array(self::$device->device_id, $extra) and die(); |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if(self::$login_message) { |
|
| 732 | + if (self::$login_message) { |
|
| 733 | 733 | $result[F_LOGIN_MESSAGE] = self::$login_message; |
| 734 | 734 | } |
| 735 | 735 | |
@@ -765,21 +765,21 @@ discard block |
||
| 765 | 765 | protected function register_player_name_validate($player_name_unsafe) { |
| 766 | 766 | // TODO - переделать под RAW-строки |
| 767 | 767 | // Если имя игрока пустое - NO GO! |
| 768 | - if(trim($player_name_unsafe) == '') { |
|
| 768 | + if (trim($player_name_unsafe) == '') { |
|
| 769 | 769 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_EMPTY, ERR_ERROR); |
| 770 | 770 | } |
| 771 | 771 | // Проверяем, что бы в начале и конце не было пустых символов |
| 772 | - if($player_name_unsafe != trim($player_name_unsafe)) { |
|
| 772 | + if ($player_name_unsafe != trim($player_name_unsafe)) { |
|
| 773 | 773 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_TRIMMED, ERR_ERROR); |
| 774 | 774 | } |
| 775 | 775 | // Если логин имеет запрещенные символы - NO GO! |
| 776 | - if(strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 776 | + if (strpbrk($player_name_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 777 | 777 | // TODO - выдавать в сообщение об ошибке список запрещенных символов |
| 778 | 778 | // TODO - заранее извещать игрока, какие символы являются запрещенными |
| 779 | 779 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_RESTRICTED_CHARACTERS, ERR_ERROR); |
| 780 | 780 | } |
| 781 | 781 | // Если логин меньше минимальной длины - NO GO! |
| 782 | - if(strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 782 | + if (strlen($player_name_unsafe) < LOGIN_LENGTH_MIN) { |
|
| 783 | 783 | // TODO - выдавать в сообщение об ошибке минимальную длину имени игрока |
| 784 | 784 | // TODO - заранее извещать игрока, какая минимальная и максимальная длина имени |
| 785 | 785 | throw new Exception(REGISTER_ERROR_PLAYER_NAME_SHORT, ERR_ERROR); |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | protected static function flog($message, $die = false) { |
| 840 | - if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 840 | + if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
| 841 | 841 | return; |
| 842 | 842 | } |
| 843 | 843 | list($called, $caller) = debug_backtrace(false); |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false; |
| 851 | 851 | |
| 852 | 852 | SN::log_file("$message - $caller_name"); |
| 853 | - if($die) { |
|
| 853 | + if ($die) { |
|
| 854 | 854 | $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
| 855 | 855 | } |
| 856 | 856 | } |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | displayP($page_item); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - if(is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
| 287 | - foreach($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
| 286 | + if (is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
| 287 | + foreach ($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
| 288 | 288 | /** |
| 289 | 289 | * @var template $extraTemplate |
| 290 | 290 | */ |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | renderFooter(); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
| 300 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
| 301 | 301 | |
| 302 | 302 | sn_db_disconnect(); |
| 303 | 303 | |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | -SN::$afterInit[] = function () { |
|
| 612 | +SN::$afterInit[] = function() { |
|
| 613 | 613 | SN::$gc->pimp->add()->tpl_render_topnav($t = 'sn_tpl_render_topnav', [], null); |
| 614 | 614 | }; |
| 615 | 615 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | global $lang, $config, $sn_mvc; |
| 625 | 625 | |
| 626 | 626 | // This call was not first one... Using results from previous call |
| 627 | - if(!empty($prevUser['username'])) { |
|
| 627 | + if (!empty($prevUser['username'])) { |
|
| 628 | 628 | $user = $prevUser; |
| 629 | 629 | } |
| 630 | 630 | |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | 'QUE_ID' => QUE_RESEARCH, |
| 681 | 681 | 'QUE_HTML' => 'topnav', |
| 682 | 682 | |
| 683 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
| 683 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
| 684 | 684 | |
| 685 | 685 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
| 686 | 686 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | 'LANG' => $language ? $language : '', |
| 975 | 975 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
| 976 | 976 | |
| 977 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 977 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 978 | 978 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
| 979 | 979 | )); |
| 980 | 980 | |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function eco_get_lab_max_effective_level(&$user, $lab_require) |
| 15 | 15 | { |
| 16 | - if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
|
| 16 | + if (!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
|
| 17 | 17 | { |
| 18 | 18 | $user['laboratories_active'] = array(); |
| 19 | 19 | $query = DBStaticUnit::db_unit_list_laboratories($user['id']); |
| 20 | - while($row = db_fetch($query)) |
|
| 20 | + while ($row = db_fetch($query)) |
|
| 21 | 21 | { |
| 22 | - if(!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) |
|
| 22 | + if (!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) |
|
| 23 | 23 | { |
| 24 | 24 | $row += array( |
| 25 | 25 | STRUC_LABORATORY => $level_lab = mrc_get_level($user, $row, STRUC_LABORATORY), |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | uasort($user['laboratories_active'], 'eco_lab_sort_effectivness'); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if(!isset($user['research_effective_level'][$lab_require])) |
|
| 36 | + if (!isset($user['research_effective_level'][$lab_require])) |
|
| 37 | 37 | { |
| 38 | - if($user['user_as_ally']) |
|
| 38 | + if ($user['user_as_ally']) |
|
| 39 | 39 | { |
| 40 | 40 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
| 41 | 41 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
| 45 | 45 | $lab_level['effective_level'] = 0; |
| 46 | 46 | |
| 47 | - foreach($user['laboratories_active'] as $data) |
|
| 47 | + foreach ($user['laboratories_active'] as $data) |
|
| 48 | 48 | { |
| 49 | - if($tech_intergalactic <= 0) |
|
| 49 | + if ($tech_intergalactic <= 0) |
|
| 50 | 50 | { |
| 51 | 51 | break; |
| 52 | 52 | } |
| 53 | - if($data[STRUC_LABORATORY] >= $lab_require) |
|
| 53 | + if ($data[STRUC_LABORATORY] >= $lab_require) |
|
| 54 | 54 | { |
| 55 | 55 | $lab_level['effective_level'] += $data['laboratory_effective_level']; |
| 56 | 56 | $tech_intergalactic--; |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | $cost[P_OPTIONS][P_TIME_RAW] = 0; |
| 91 | 91 | $only_dark_matter = 0; |
| 92 | 92 | $cost_in_metal = 0; |
| 93 | - foreach($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
| 94 | - if($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
| 93 | + foreach ($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
| 94 | + if ($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $cost_in_metal += $cost[BUILD_CREATE][$resource_id] * $currentResourceExchange; |
| 104 | 104 | |
| 105 | - if(in_array($resource_id, $resources_loot)) { |
|
| 105 | + if (in_array($resource_id, $resources_loot)) { |
|
| 106 | 106 | $cost[P_OPTIONS][P_TIME_RAW] += $resource_cost * $currentResourceExchange / $rpg_exchange_deuterium; |
| 107 | 107 | $resource_got = mrc_get_level($user, $planet, $resource_id); |
| 108 | - } elseif($resource_id == RES_DARK_MATTER) { |
|
| 108 | + } elseif ($resource_id == RES_DARK_MATTER) { |
|
| 109 | 109 | $resource_got = mrc_get_level($user, null, $resource_id); |
| 110 | - } elseif($resource_id == RES_ENERGY) { |
|
| 110 | + } elseif ($resource_id == RES_ENERGY) { |
|
| 111 | 111 | $resource_got = max(0, $planet['energy_max'] - $planet['energy_used']); |
| 112 | 112 | } else { |
| 113 | 113 | $resource_got = 0; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $resources_normalized = 0; |
| 122 | - foreach($resources_loot as $resource_id) { |
|
| 122 | + foreach ($resources_loot as $resource_id) { |
|
| 123 | 123 | $resources_normalized += floor(mrc_get_level($user, $planet, $resource_id)) * $config->__get('rpg_exchange_' . pname_resource_name($resource_id)); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $cost[P_OPTIONS][P_TIME_RAW] = $cost[P_OPTIONS][P_TIME_RAW] * 60 * 60 / get_game_speed() / 2500; |
| 136 | 136 | |
| 137 | 137 | // TODO - Вынести в отдельную процедуру расчёт стоимости |
| 138 | - if($only_cost) { |
|
| 138 | + if ($only_cost) { |
|
| 139 | 139 | return $cost; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $cost['RESULT'][BUILD_DESTROY] = BUILD_INDESTRUCTABLE; |
| 148 | 148 | |
| 149 | 149 | $mercenary = 0; |
| 150 | - if(in_array($unit_id, sn_get_groups('structures'))) { |
|
| 150 | + if (in_array($unit_id, sn_get_groups('structures'))) { |
|
| 151 | 151 | $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_ROBOT) + 1); |
| 152 | 152 | $cost['RESULT'][BUILD_DESTROY] = |
| 153 | 153 | mrc_get_level($user, $planet, $unit_id, false, true) |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | ) |
| 158 | 158 | : BUILD_NO_UNITS; |
| 159 | 159 | $mercenary = MRC_ENGINEER; |
| 160 | - } elseif(in_array($unit_id, sn_get_groups('tech'))) { |
|
| 160 | + } elseif (in_array($unit_id, sn_get_groups('tech'))) { |
|
| 161 | 161 | $lab_level = eco_get_lab_max_effective_level($user, intval($unit_data[P_REQUIRE][STRUC_LABORATORY])); |
| 162 | 162 | $cost[RES_TIME][BUILD_CREATE] /= $lab_level; |
| 163 | 163 | $mercenary = MRC_ACADEMIC; |
| 164 | - } elseif(in_array($unit_id, sn_get_groups('defense'))) { |
|
| 165 | - $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1) ; |
|
| 164 | + } elseif (in_array($unit_id, sn_get_groups('defense'))) { |
|
| 165 | + $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
|
| 166 | 166 | $mercenary = MRC_FORTIFIER; |
| 167 | - } elseif(in_array($unit_id, sn_get_groups('fleet'))) { |
|
| 167 | + } elseif (in_array($unit_id, sn_get_groups('fleet'))) { |
|
| 168 | 168 | $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
| 169 | 169 | $mercenary = MRC_ENGINEER; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if( |
|
| 172 | + if ( |
|
| 173 | 173 | // If planet is capital |
| 174 | 174 | $user['id_planet'] == $planet['id'] |
| 175 | 175 | && |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] / SN::$gc->config->planet_capital_building_rate; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if($mercenary) { |
|
| 183 | + if ($mercenary) { |
|
| 184 | 184 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] / mrc_modify_value($user, $planet, $mercenary, 1); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
| 187 | + if (in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
| 188 | 188 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_DESTROY] = 0; |
| 189 | 189 | } else { |
| 190 | 190 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] > 1 ? round($cost[RES_TIME][BUILD_CREATE]) : 1; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return $cost; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | -function eco_can_build_unit($user, $planet, $unit_id){$result = null;return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result));} |
|
| 197 | +function eco_can_build_unit($user, $planet, $unit_id) {$result = null; return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result)); } |
|
| 198 | 198 | function sn_eco_can_build_unit($user, $planet, $unit_id, &$result) { |
| 199 | 199 | global $config; |
| 200 | 200 | |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | $result = $result == BUILD_ALLOWED && eco_unit_busy($user, $planet, $unit_id) ? BUILD_UNIT_BUSY : $result; |
| 203 | 203 | |
| 204 | 204 | $unit_param = get_unit_param($unit_id); |
| 205 | - if($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) { |
|
| 205 | + if ($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) { |
|
| 206 | 206 | $requirement = &$unit_param[P_REQUIRE]; |
| 207 | - if($result == BUILD_ALLOWED && $requirement) { |
|
| 208 | - foreach($requirement as $require_id => $require_level) { |
|
| 209 | - if(mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
| 207 | + if ($result == BUILD_ALLOWED && $requirement) { |
|
| 208 | + foreach ($requirement as $require_id => $require_level) { |
|
| 209 | + if (mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
| 210 | 210 | $result = BUILD_REQUIRE_NOT_MEET; |
| 211 | 211 | break; |
| 212 | 212 | } |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
| 225 | 225 | $planet_que = explode(';', $planet_que); |
| 226 | - foreach($planet_que as $planet_que_item) |
|
| 226 | + foreach ($planet_que as $planet_que_item) |
|
| 227 | 227 | { |
| 228 | - if($planet_que_item) |
|
| 228 | + if ($planet_que_item) |
|
| 229 | 229 | { |
| 230 | 230 | list($planet_que_item) = explode(',', $planet_que_item); |
| 231 | - if(in_array($planet_que_item, $unit_list)) |
|
| 231 | + if (in_array($planet_que_item, $unit_list)) |
|
| 232 | 232 | { |
| 233 | 233 | $eco_is_builds_in_que = true; |
| 234 | 234 | break; |
@@ -239,21 +239,21 @@ discard block |
||
| 239 | 239 | return $eco_is_builds_in_que; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -function eco_unit_busy(&$user, &$planet, $unit_id){$result = null;return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]);} |
|
| 242 | +function eco_unit_busy(&$user, &$planet, $unit_id) {$result = null; return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]); } |
|
| 243 | 243 | function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
| 244 | 244 | { |
| 245 | 245 | global $config; |
| 246 | 246 | |
| 247 | 247 | $result = isset($result) ? $result : false; |
| 248 | - if(!$result) |
|
| 248 | + if (!$result) |
|
| 249 | 249 | { |
| 250 | - if(($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun) |
|
| 250 | + if (($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun) |
|
| 251 | 251 | { |
| 252 | 252 | $global_que = que_get($user['id'], $planet['id'], QUE_RESEARCH, false); |
| 253 | - if(is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) |
|
| 253 | + if (is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) |
|
| 254 | 254 | { |
| 255 | 255 | $first_element = reset($global_que['ques'][QUE_RESEARCH][$user['id']]); |
| 256 | - if(is_array($first_element)) |
|
| 256 | + if (is_array($first_element)) |
|
| 257 | 257 | { |
| 258 | 258 | $result = true; |
| 259 | 259 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | // $result = true; |
| 264 | 264 | //} |
| 265 | 265 | } |
| 266 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
| 266 | + elseif (($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
| 267 | 267 | { |
| 268 | 268 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
| 269 | 269 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use \Core\SnBootstrap; |
| 4 | 4 | |
| 5 | 5 | // Защита от двойного инита |
| 6 | -if(defined('INIT')) { |
|
| 6 | +if (defined('INIT')) { |
|
| 7 | 7 | return; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -121,47 +121,47 @@ discard block |
||
| 121 | 121 | // Но нужно, пока у нас есть не MVC-страницы |
| 122 | 122 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
| 123 | 123 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
| 124 | -if($sn_page_name) { |
|
| 124 | +if ($sn_page_name) { |
|
| 125 | 125 | // Merging page options to global option pull |
| 126 | - if(is_array($sn_page_data['options'])) { |
|
| 126 | + if (is_array($sn_page_data['options'])) { |
|
| 127 | 127 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 130 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 131 | 131 | require_once($sn_page_name_file); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true)) { |
|
| 135 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true)) { |
|
| 136 | 136 | SN::$options['fleet_update_skip'] = true; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 141 | 141 | // TODO - костыль, что бы работали старые модули. Убрать! |
| 142 | -if(is_array($sn_data['pages'])) { |
|
| 142 | +if (is_array($sn_data['pages'])) { |
|
| 143 | 143 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
| 144 | 144 | } |
| 145 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 145 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 146 | 146 | $sn_page_name = ''; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $lang->lng_switch(sys_get_param_str('lang')); |
| 150 | 150 | |
| 151 | 151 | |
| 152 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 152 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 153 | 153 | \Tools\VersionCheckerDeprecated::performCheckVersion(); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 156 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 157 | 157 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
| 158 | 158 | sn_user_birthday_celebrate(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 161 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 162 | 162 | SN::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
| 163 | 163 | SN::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
| 164 | - if(SN::$config->server_log_online) { |
|
| 164 | + if (SN::$config->server_log_online) { |
|
| 165 | 165 | doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = " . SN::$config->var_online_user_count . ";"); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 186 | 186 | |
| 187 | -if(!empty($user['id'])) { |
|
| 187 | +if (!empty($user['id'])) { |
|
| 188 | 188 | SN::$user_options->user_change($user['id']); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | : false |
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 200 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 201 | 201 | $prohibited_characters = array_map(function($value) { |
| 202 | 202 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
| 203 | 203 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| 208 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 208 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 209 | 209 | pdump('Отключи отладку перед продакшном!'); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | StatUpdateLauncher::unlock(); |
| 221 | 221 | |
| 222 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 222 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 223 | 223 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
| 224 | 224 | SN::$config->game_disable == GAME_DISABLE_REASON |
| 225 | 225 | ? SN::$config->game_disable_reason |
| 226 | 226 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
| 227 | 227 | ); |
| 228 | - if(defined('IN_API')) { |
|
| 228 | + if (defined('IN_API')) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if( |
|
| 232 | + if ( |
|
| 233 | 233 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 234 | 234 | && |
| 235 | 235 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | // TODO ban |
| 244 | 244 | // TODO $skip_ban_check |
| 245 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 246 | - if(defined('IN_API')) { |
|
| 245 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 246 | + if (defined('IN_API')) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
| 258 | 258 | |
| 259 | 259 | |
| 260 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 260 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 261 | 261 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 262 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 263 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 262 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 263 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 264 | 264 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | 'fleet_update_last', |
| 284 | 284 | SN::$config->fleet_update_interval, |
| 285 | 285 | // Promise |
| 286 | - function () {SN::$gc->fleetDispatcher->dispatch();}, |
|
| 286 | + function() {SN::$gc->fleetDispatcher->dispatch(); }, |
|
| 287 | 287 | WATCHDOG_TIME_SQL, |
| 288 | 288 | false |
| 289 | 289 | ); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | // @version 1.0 |
| 4 | 4 | // @copyright 2008 by Chlorel for XNova |
| 5 | 5 | |
| 6 | -if(SN_IN_FLEET !== true) { |
|
| 6 | +if (SN_IN_FLEET !== true) { |
|
| 7 | 7 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 8 | 8 | } |
| 9 | 9 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $errorlist .= $lang['fl_limit_galaxy']; |
| 23 | 23 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
| 24 | 24 | $errorlist .= $lang['fl_limit_system']; |
| 25 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
| 25 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
| 26 | 26 | $errorlist .= $lang['fl_limit_planet']; |
| 27 | 27 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
| 28 | 28 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -49,35 +49,35 @@ discard block |
||
| 49 | 49 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
| 50 | 50 | |
| 51 | 51 | if ($target_mission == MT_EXPLORE) { |
| 52 | - if ($MaxExpeditions == 0 ) { |
|
| 52 | + if ($MaxExpeditions == 0) { |
|
| 53 | 53 | $errorlist .= $lang['fl_expe_notech']; |
| 54 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
| 54 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
| 55 | 55 | $errorlist .= $lang['fl_expe_max']; |
| 56 | 56 | } |
| 57 | 57 | } else { |
| 58 | - if ($TargetPlanet['id_owner']){ |
|
| 58 | + if ($TargetPlanet['id_owner']) { |
|
| 59 | 59 | if ($target_mission == MT_COLONIZE) |
| 60 | 60 | $errorlist .= $lang['fl_colonized']; |
| 61 | 61 | |
| 62 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
| 62 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
| 63 | 63 | if ($target_mission == MT_ATTACK) |
| 64 | 64 | $errorlist .= $lang['fl_no_self_attack']; |
| 65 | 65 | |
| 66 | 66 | if ($target_mission == MT_SPY) |
| 67 | 67 | $errorlist .= $lang['fl_no_self_spy']; |
| 68 | - }else{ |
|
| 68 | + } else { |
|
| 69 | 69 | if ($target_mission == MT_RELOCATE) |
| 70 | 70 | $errorlist .= $lang['fl_only_stay_at_home']; |
| 71 | 71 | } |
| 72 | - }else{ |
|
| 73 | - if ($target_mission < MT_COLONIZE){ |
|
| 72 | + } else { |
|
| 73 | + if ($target_mission < MT_COLONIZE) { |
|
| 74 | 74 | $errorlist .= $lang['fl_unknow_target']; |
| 75 | - }else{ |
|
| 75 | + } else { |
|
| 76 | 76 | if ($target_mission == MT_DESTROY) |
| 77 | 77 | $errorlist .= $lang['fl_nomoon']; |
| 78 | 78 | |
| 79 | - if ($target_mission == MT_RECYCLE){ |
|
| 80 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
| 79 | + if ($target_mission == MT_RECYCLE) { |
|
| 80 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
| 81 | 81 | $errorlist .= $lang['fl_nodebris']; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @var unit_captain $captainModule |
| 91 | 91 | */ |
| 92 | - if(is_object($captainModule) && $captainModule->isActive() && $captain_id = sys_get_param_id('captain_id')) { |
|
| 92 | + if (is_object($captainModule) && $captainModule->isActive() && $captain_id = sys_get_param_id('captain_id')) { |
|
| 93 | 93 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
| 94 | 94 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
| 95 | - if(!$captain) { |
|
| 95 | + if (!$captain) { |
|
| 96 | 96 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
| 97 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
| 98 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
| 97 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
| 98 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
| 99 | 99 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
| 100 | 100 | } |
| 101 | 101 | } else { |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | if ($errorlist) { |
| 107 | 107 | sn_db_transaction_rollback(); |
| 108 | - messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
| 108 | + messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
| 112 | 112 | foreach ($fleetarray as $Ship => $Count) { |
| 113 | 113 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
| 114 | - messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 114 | + messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
| 120 | 120 | //But is it acs?? |
| 121 | 121 | //Well all acs fleets must have a fleet code. |
| 122 | - if($fleet_group) { |
|
| 122 | + if ($fleet_group) { |
|
| 123 | 123 | //Also it must be mission type 2 |
| 124 | 124 | $target_mission = MT_AKS; |
| 125 | 125 | |
| 126 | 126 | //The co-ords must be the same as where the acs fleet is going. |
| 127 | 127 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
| 128 | - if($_POST['acs_target_mr'] == $target) { |
|
| 128 | + if ($_POST['acs_target_mr'] == $target) { |
|
| 129 | 129 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
| 130 | 130 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
| 131 | 131 | if (!$aks) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
| 144 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
| 144 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
| 145 | 145 | $target_mission = MT_ATTACK; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,22 +151,21 @@ discard block |
||
| 151 | 151 | $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded); |
| 152 | 152 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
| 153 | 153 | |
| 154 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
| 154 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
| 155 | 155 | messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
| 159 | 159 | if (!in_array($speed_percent, $speed_possible)) { |
| 160 | - messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 160 | + messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
| 164 | 164 | |
| 165 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
| 166 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
| 167 | - if($max_duration) { |
|
| 165 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
| 166 | + if ($max_duration) { |
|
| 168 | 167 | $StayDuration = sys_get_param_id('missiontime'); |
| 169 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
| 168 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
| 170 | 169 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
| 171 | 170 | die(); |
| 172 | 171 | } |
@@ -176,11 +175,11 @@ discard block |
||
| 176 | 175 | $StayDuration = 0; |
| 177 | 176 | $StayTime = 0; |
| 178 | 177 | } |
| 179 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
| 178 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
| 180 | 179 | |
| 181 | - if($aks && $target_mission == MT_AKS) { |
|
| 182 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
| 183 | - messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']); |
|
| 180 | + if ($aks && $target_mission == MT_AKS) { |
|
| 181 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
| 182 | + messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']); |
|
| 184 | 183 | } |
| 185 | 184 | $fleet['start_time'] = $aks['ankunft']; |
| 186 | 185 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -190,21 +189,21 @@ discard block |
||
| 190 | 189 | $FleetShipCount = 0; |
| 191 | 190 | $db_changeset = array(); |
| 192 | 191 | foreach ($fleetarray as $Ship => $Count) { |
| 193 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
| 192 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
| 194 | 193 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
| 195 | 194 | } |
| 196 | 195 | $fleet_array = sys_unit_arr2str($fleetarray); |
| 197 | - $FleetShipCount += array_sum($fleetarray); |
|
| 198 | - $FleetStorage -= $consumption; |
|
| 196 | + $FleetShipCount += array_sum($fleetarray); |
|
| 197 | + $FleetStorage -= $consumption; |
|
| 199 | 198 | |
| 200 | - if ( $StorageNeeded > $FleetStorage) { |
|
| 201 | - messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 199 | + if ($StorageNeeded > $FleetStorage) { |
|
| 200 | + messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 202 | 201 | } |
| 203 | 202 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
| 204 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 203 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 205 | 204 | } |
| 206 | 205 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
| 207 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 206 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 208 | 207 | } |
| 209 | 208 | |
| 210 | 209 | $fleet_set = array( |
@@ -246,7 +245,7 @@ discard block |
||
| 246 | 245 | // )); |
| 247 | 246 | // } |
| 248 | 247 | |
| 249 | - if(is_array($captain)) { |
|
| 248 | + if (is_array($captain)) { |
|
| 250 | 249 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
| 251 | 250 | } |
| 252 | 251 | |
@@ -259,7 +258,7 @@ discard block |
||
| 259 | 258 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
| 260 | 259 | ); |
| 261 | 260 | |
| 262 | - if(!empty($TargetPlanet)) { |
|
| 261 | + if (!empty($TargetPlanet)) { |
|
| 263 | 262 | $template_route += array( |
| 264 | 263 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 265 | 264 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -272,8 +271,8 @@ discard block |
||
| 272 | 271 | $template->assign_block_vars('fleets', $template_route); |
| 273 | 272 | |
| 274 | 273 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 275 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
| 276 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 274 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
| 275 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 277 | 276 | // $ship_base_data = get_ship_data($ship_id, $user); |
| 278 | 277 | $template->assign_block_vars('fleets.ships', array( |
| 279 | 278 | 'ID' => $ship_id, |