@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $insert_position = $is_positioned == '-' ? 0 : count($menu); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $insert_position += $is_positioned == '+' ? 1 : 0; |
|
| 131 | + $insert_position += $is_positioned == '+' ? 1 : 0; |
|
| 132 | 132 | $spliced = array_splice($menu, $insert_position, count($menu) - $insert_position); |
| 133 | 133 | $menu[$menu_item_id] = $menu_item; |
| 134 | 134 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | 'LANG' => $language ? $language : '', |
| 647 | 647 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
| 648 | 648 | |
| 649 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 649 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 650 | 650 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
| 651 | 651 | )); |
| 652 | 652 | |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | 'QUE_ID' => QUE_RESEARCH, |
| 874 | 874 | 'QUE_HTML' => 'topnav', |
| 875 | 875 | |
| 876 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
| 876 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
| 877 | 877 | |
| 878 | 878 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
| 879 | 879 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | SnTemplate::renderFooter($page, $template_result); |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
| 1164 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
| 1165 | 1165 | |
| 1166 | 1166 | sn_db_disconnect(); |
| 1167 | 1167 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // $this->log_file('Dispatch stopped: lock ' . $runLock->isLocked() .'s' ); |
| 171 | 171 | return self::TASK_ALREADY_LOCKED; |
| 172 | 172 | } |
| 173 | - register_shutdown_function(function () use ($runLock) { |
|
| 173 | + register_shutdown_function(function() use ($runLock) { |
|
| 174 | 174 | // $this->log_file('Shutting down'); |
| 175 | 175 | $timeLock = $runLock->isLocked(); |
| 176 | 176 | if ($timeLock > 0 || $timeLock === 0) { |
@@ -552,15 +552,11 @@ discard block |
||
| 552 | 552 | protected function flt_flyingFleetsSort($a, $b) { |
| 553 | 553 | return |
| 554 | 554 | // Сравниваем время флотов - кто раньше, тот и первый обрабатывается |
| 555 | - $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : |
|
| 556 | - // Если время - одинаковое, сравниваем события флотов |
|
| 555 | + $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов |
|
| 557 | 556 | // Если события - одинаковые, то флоты равны |
| 558 | - ($a['fleet_event'] == $b['fleet_event'] ? 0 : |
|
| 559 | - // Если события разные - первыми считаем прибывающие флоты |
|
| 560 | - ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : |
|
| 561 | - // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
| 562 | - ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : |
|
| 563 | - // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
| 557 | + ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты |
|
| 558 | + ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
| 559 | + ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
| 564 | 560 | // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска |
| 565 | 561 | ( |
| 566 | 562 | 0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $url = HttpUrl::spawn($this->gc) |
| 64 | 64 | ->parseUrl(SN_ROOT_VIRTUAL) |
| 65 | 65 | ->addPath('index.php') |
| 66 | - ->addParams(['page' => 'worker', 'mode' => 'dispatchFleets',]); |
|
| 66 | + ->addParams(['page' => 'worker', 'mode' => 'dispatchFleets', ]); |
|
| 67 | 67 | |
| 68 | 68 | sn_get_url_contents($url->urlSigned()); |
| 69 | 69 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | define('IN_AJAX', true); |
| 25 | 25 | |
| 26 | - if(!is_object($template)) { |
|
| 26 | + if (!is_object($template)) { |
|
| 27 | 27 | $template = SnTemplate::gettemplate('_ajax', true); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | * @var IPage $page |
| 52 | 52 | */ |
| 53 | 53 | $page = new $className(); |
| 54 | - if(method_exists($page, 'loadParams')) { |
|
| 54 | + if (method_exists($page, 'loadParams')) { |
|
| 55 | 55 | $page->loadParams(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if(method_exists($page, $action = sys_get_param_str('action')) && $page->checkAction($action)) { |
|
| 58 | + if (method_exists($page, $action = sys_get_param_str('action')) && $page->checkAction($action)) { |
|
| 59 | 59 | $result = $page->$action(); |
| 60 | 60 | is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false; |
| 61 | 61 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
| 202 | 202 | |
| 203 | 203 | // Alliance bonus calculations |
| 204 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 204 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 205 | 205 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
| 206 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
| 206 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
| 207 | 207 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
| 208 | 208 | 'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
| 209 | 209 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | 'eco_scale_storage' => 1, |
| 247 | 247 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
| 248 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 248 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 249 | 249 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
| 250 | 250 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
| 251 | 251 | |
@@ -256,21 +256,21 @@ discard block |
||
| 256 | 256 | 'energy_basic_income' => 0, |
| 257 | 257 | |
| 258 | 258 | // Bashing protection settings |
| 259 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 260 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 261 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 262 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 263 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 259 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 260 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 261 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 262 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 263 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 264 | 264 | |
| 265 | 265 | 'Fleet_Cdr' => 30, |
| 266 | 266 | 'fleet_speed' => 1, |
| 267 | 267 | |
| 268 | - self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run |
|
| 268 | + self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run |
|
| 269 | 269 | 'fleet_update_interval' => 4, |
| 270 | 270 | 'fleet_update_lock' => '', // SQL time when lock was acquired |
| 271 | 271 | |
| 272 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 273 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 272 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 273 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 274 | 274 | // Defaults |
| 275 | 275 | 'game_default_language' => 'ru', |
| 276 | 276 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | 'game_maxSystem' => 199, |
| 285 | 285 | 'game_maxPlanet' => 15, |
| 286 | 286 | // Game global settings |
| 287 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 287 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 288 | 288 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
| 289 | 289 | |
| 290 | 290 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
| 291 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 292 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
| 291 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 292 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
| 293 | 293 | // Noob protection |
| 294 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 294 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 295 | 295 | 'game_noob_points' => 5000, // Below this point user treated as noob. 0 to disable |
| 296 | 296 | |
| 297 | 297 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -346,12 +346,12 @@ discard block |
||
| 346 | 346 | 'payment_currency_exchange_wmz' => 1, |
| 347 | 347 | 'payment_currency_exchange_pln' => 3.86, |
| 348 | 348 | |
| 349 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
| 350 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 349 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
| 350 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 351 | 351 | |
| 352 | 352 | 'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
| 353 | - 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
| 354 | - 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
| 353 | + 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
| 354 | + 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
| 355 | 355 | 'planet_teleport_cost' => 50000, // Cost of planet teleportation |
| 356 | 356 | 'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
| 357 | 357 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | 'resource_multiplier' => 1, |
| 374 | 374 | |
| 375 | 375 | //Roleplay system |
| 376 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 376 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 377 | 377 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
| 378 | 378 | |
| 379 | 379 | // Black Market - General |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | 'url_purchase_metamatter' => '', |
| 439 | 439 | 'url_rules' => '', |
| 440 | 440 | |
| 441 | - 'users_amount' => 1, // Total users count |
|
| 441 | + 'users_amount' => 1, // Total users count |
|
| 442 | 442 | 'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should considered ONLINE for online counter |
| 443 | - 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
| 444 | - 'var_online_user_time' => 0, // When last time user online was refreshed |
|
| 445 | - 'var_online_user_count' => 0, // Last calculated online user count |
|
| 446 | - 'server_log_online' => 0, // Log online user count |
|
| 443 | + 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
| 444 | + 'var_online_user_time' => 0, // When last time user online was refreshed |
|
| 445 | + 'var_online_user_count' => 0, // Last calculated online user count |
|
| 446 | + 'server_log_online' => 0, // Log online user count |
|
| 447 | 447 | |
| 448 | 448 | 'user_birthday_celebrate' => 0, // When last time celebrations (i.e. giftgiving) was made |
| 449 | 449 | 'user_birthday_gift' => 0, // User birthday gift |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Checking task lock |
| 88 | - if (is_object($this->lock) && !$this->lock->attemptLock(function () { |
|
| 88 | + if (is_object($this->lock) && !$this->lock->attemptLock(function() { |
|
| 89 | 89 | return $this->proceedLockExpiration(); |
| 90 | 90 | }, SN_TIME_NOW)) { |
| 91 | 91 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function updateTaskLastRunTime($time) { |
| 154 | 154 | $this->db->transactionWrap( |
| 155 | - function () use ($time) { |
|
| 155 | + function() use ($time) { |
|
| 156 | 156 | $this->config->dateWrite($this->configName, $time, classConfig::DATE_TYPE_SQL_STRING); |
| 157 | 157 | } |
| 158 | 158 | ); |
@@ -110,123 +110,123 @@ |
||
| 110 | 110 | |
| 111 | 111 | // Services -------------------------------------------------------------------------------------------------------- |
| 112 | 112 | // Default db |
| 113 | - $gc->request = function (GlobalContainer $c) { |
|
| 113 | + $gc->request = function(GlobalContainer $c) { |
|
| 114 | 114 | $httpRequest = new HttpRequest($c); |
| 115 | 115 | $httpRequest->fillCurrent(); |
| 116 | 116 | |
| 117 | 117 | return $httpRequest; |
| 118 | 118 | }; |
| 119 | 119 | |
| 120 | - $gc->db = function (GlobalContainer $c) { |
|
| 120 | + $gc->db = function(GlobalContainer $c) { |
|
| 121 | 121 | SN::$db = new db_mysql($c); |
| 122 | 122 | |
| 123 | 123 | return SN::$db; |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
| 126 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
| 127 | 127 | GlobalContainer $c) { |
| 128 | 128 | return new debug(); |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | - $gc->cache = function (GlobalContainer $gc) { |
|
| 131 | + $gc->cache = function(GlobalContainer $gc) { |
|
| 132 | 132 | return new classCache($gc->cachePrefix); |
| 133 | 133 | }; |
| 134 | 134 | |
| 135 | - $gc->config = function (GlobalContainer $gc) { |
|
| 135 | + $gc->config = function(GlobalContainer $gc) { |
|
| 136 | 136 | return new classConfig($gc->cachePrefix); |
| 137 | 137 | }; |
| 138 | 138 | |
| 139 | - $gc->crypto = function (GlobalContainer $gc) { |
|
| 139 | + $gc->crypto = function(GlobalContainer $gc) { |
|
| 140 | 140 | return new Crypto($gc); |
| 141 | 141 | }; |
| 142 | 142 | |
| 143 | - $gc->worker = function (GlobalContainer $gc) { |
|
| 143 | + $gc->worker = function(GlobalContainer $gc) { |
|
| 144 | 144 | return new Worker($gc); |
| 145 | 145 | }; |
| 146 | 146 | |
| 147 | - $gc->repository = function (GlobalContainer $gc) { |
|
| 147 | + $gc->repository = function(GlobalContainer $gc) { |
|
| 148 | 148 | /** @noinspection PhpDeprecationInspection */ |
| 149 | 149 | return new Repository($gc); |
| 150 | 150 | }; |
| 151 | 151 | |
| 152 | - $gc->storage = function (GlobalContainer $gc) { |
|
| 152 | + $gc->storage = function(GlobalContainer $gc) { |
|
| 153 | 153 | /** @noinspection PhpDeprecationInspection */ |
| 154 | 154 | return new Storage($gc); |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | - $gc->repoV2 = function (GlobalContainer $gc) { |
|
| 157 | + $gc->repoV2 = function(GlobalContainer $gc) { |
|
| 158 | 158 | return new RepoV2($gc); |
| 159 | 159 | }; |
| 160 | 160 | |
| 161 | - $gc->storageV2 = function (GlobalContainer $gc) { |
|
| 161 | + $gc->storageV2 = function(GlobalContainer $gc) { |
|
| 162 | 162 | return new StorageV2($gc); |
| 163 | 163 | }; |
| 164 | 164 | |
| 165 | - $gc->storageSqlV2 = function (GlobalContainer $gc) { |
|
| 165 | + $gc->storageSqlV2 = function(GlobalContainer $gc) { |
|
| 166 | 166 | return new StorageSqlV2($gc); |
| 167 | 167 | }; |
| 168 | 168 | |
| 169 | - $gc->design = function (GlobalContainer $gc) { |
|
| 169 | + $gc->design = function(GlobalContainer $gc) { |
|
| 170 | 170 | return new Design($gc); |
| 171 | 171 | }; |
| 172 | 172 | |
| 173 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
| 173 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
| 174 | 174 | return new BBCodeParser($gc); |
| 175 | 175 | }; |
| 176 | 176 | |
| 177 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
| 177 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
| 178 | 178 | return new FleetDispatcher($gc); |
| 179 | 179 | }; |
| 180 | 180 | |
| 181 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
| 181 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
| 182 | 182 | return new Watchdog($gc); |
| 183 | 183 | }; |
| 184 | 184 | |
| 185 | - $gc->valueStorage = function (/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) { |
|
| 185 | + $gc->valueStorage = function(/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) { |
|
| 186 | 186 | return new ValueStorage([]); |
| 187 | 187 | }; |
| 188 | 188 | |
| 189 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
| 189 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
| 190 | 190 | return new BonusCatalog($gc); |
| 191 | 191 | }; |
| 192 | 192 | |
| 193 | - $gc->general = function (GlobalContainer $gc) { |
|
| 193 | + $gc->general = function(GlobalContainer $gc) { |
|
| 194 | 194 | return new General($gc); |
| 195 | 195 | }; |
| 196 | 196 | |
| 197 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
| 197 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
| 198 | 198 | return new EconomicHelper($gc); |
| 199 | 199 | }; |
| 200 | 200 | |
| 201 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
| 201 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
| 202 | 202 | return new PlayerLevelHelper($gc); |
| 203 | 203 | }; |
| 204 | 204 | |
| 205 | - $gc->pimp = function (GlobalContainer $gc) { |
|
| 205 | + $gc->pimp = function(GlobalContainer $gc) { |
|
| 206 | 206 | return new SnPimp($gc); |
| 207 | 207 | }; |
| 208 | 208 | |
| 209 | - $gc->modules = function (GlobalContainer $gc) { |
|
| 209 | + $gc->modules = function(GlobalContainer $gc) { |
|
| 210 | 210 | return new ModulesManager($gc); |
| 211 | 211 | }; |
| 212 | 212 | |
| 213 | 213 | // Dummy objects --------------------------------------------------------------------------------------------------- |
| 214 | - $gc->theUser = function (GlobalContainer $gc) { |
|
| 214 | + $gc->theUser = function(GlobalContainer $gc) { |
|
| 215 | 215 | return new TheUser($gc); |
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | 218 | |
| 219 | 219 | // Models ---------------------------------------------------------------------------------------------------------- |
| 220 | 220 | $gc->skinEntityClass = SkinV2::class; |
| 221 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
| 221 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
| 222 | 222 | return new SkinModel($gc); |
| 223 | 223 | }; |
| 224 | 224 | |
| 225 | - $gc->textModel = function (GlobalContainer $gc) { |
|
| 225 | + $gc->textModel = function(GlobalContainer $gc) { |
|
| 226 | 226 | return new TextModel($gc); |
| 227 | 227 | }; |
| 228 | 228 | |
| 229 | - $gc->ignores = function (GlobalContainer $gc) { |
|
| 229 | + $gc->ignores = function(GlobalContainer $gc) { |
|
| 230 | 230 | return new PlayerIgnore($gc); |
| 231 | 231 | }; |
| 232 | 232 | |
@@ -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', |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $updater->upd_log_version_update(); |
| 575 | 575 | |
| 576 | 576 | // 2019-08-15 00:10:48 45a8 |
| 577 | - $updater->updPatchApply(8, function () use ($updater) { |
|
| 577 | + $updater->updPatchApply(8, function() use ($updater) { |
|
| 578 | 578 | if (!$updater->isTableExists('player_ignore')) { |
| 579 | 579 | $updater->upd_create_table( |
| 580 | 580 | 'player_ignore', |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | }, PATCH_REGISTER); |
| 596 | 596 | |
| 597 | 597 | // 2019-08-21 20:14:18 45a19 |
| 598 | - $updater->updPatchApply(9, function () use ($updater) { |
|
| 598 | + $updater->updPatchApply(9, function() use ($updater) { |
|
| 599 | 599 | $updater->upd_alter_table('payment', [ |
| 600 | 600 | 'ADD COLUMN `payment_method_id` smallint DEFAULT NULL AFTER `payment_module_name`', |
| 601 | 601 | 'ADD KEY `I_payment_method_id` (`payment_method_id`)', |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | }, PATCH_REGISTER); |
| 604 | 604 | |
| 605 | 605 | // 2020-02-18 21:00:19 45a71 |
| 606 | - $updater->updPatchApply(10, function () use ($updater) { |
|
| 606 | + $updater->updPatchApply(10, function() use ($updater) { |
|
| 607 | 607 | $name = classConfig::FLEET_UPDATE_MAX_RUN_TIME; |
| 608 | 608 | if (!SN::$gc->config->pass()->$name) { |
| 609 | 609 | SN::$gc->config->pass()->$name = 30; |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use Player\playerTimeDiff; |
| 8 | 8 | |
| 9 | 9 | // Защита от двойного инита |
| 10 | -if(defined('INIT')) { |
|
| 10 | +if (defined('INIT')) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -126,40 +126,40 @@ discard block |
||
| 126 | 126 | // Но нужно, пока у нас есть не MVC-страницы |
| 127 | 127 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
| 128 | 128 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
| 129 | -if($sn_page_name) { |
|
| 129 | +if ($sn_page_name) { |
|
| 130 | 130 | // Merging page options to global option pull |
| 131 | - if(is_array($sn_page_data['options'])) { |
|
| 131 | + if (is_array($sn_page_data['options'])) { |
|
| 132 | 132 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 135 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 136 | 136 | require_once($sn_page_name_file); |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 140 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 141 | 141 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 146 | 146 | // TODO - костыль, что бы работали старые модули. Убрать! |
| 147 | -if(is_array($sn_data['pages'])) { |
|
| 147 | +if (is_array($sn_data['pages'])) { |
|
| 148 | 148 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
| 149 | 149 | } |
| 150 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 150 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 151 | 151 | $sn_page_name = ''; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $lang->lng_switch(sys_get_param_str('lang')); |
| 155 | 155 | |
| 156 | 156 | |
| 157 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 157 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 158 | 158 | VersionCheckerDeprecated::performCheckVersion(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | SN::$gc->watchdog->register(new TaskDispatchFleets(), TaskDispatchFleets::class); |
| 162 | -SN::$gc->worker->registerWorker('dispatchFleets', function () { |
|
| 162 | +SN::$gc->worker->registerWorker('dispatchFleets', function() { |
|
| 163 | 163 | \Core\Worker::detachIncomingRequest(); |
| 164 | 164 | |
| 165 | 165 | $result = SN::$gc->fleetDispatcher->flt_flying_fleet_handler(); |
@@ -182,16 +182,16 @@ discard block |
||
| 182 | 182 | die(json_encode($result)); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 185 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 186 | 186 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
| 187 | 187 | sn_user_birthday_celebrate(); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
| 190 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
| 191 | 191 | dbUpdateUsersCount(db_user_count()); |
| 192 | 192 | dbUpdateUsersOnline(db_user_count(true)); |
| 193 | 193 | SN::$config->pass()->var_online_user_time = SN_TIME_NOW; |
| 194 | - if(SN::$config->server_log_online) { |
|
| 194 | + if (SN::$config->server_log_online) { |
|
| 195 | 195 | /** @noinspection SqlResolve */ |
| 196 | 196 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
| 197 | 197 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 217 | 217 | |
| 218 | -if(!empty($user['id'])) { |
|
| 218 | +if (!empty($user['id'])) { |
|
| 219 | 219 | SN::$user_options->user_change($user['id']); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | : false |
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 231 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 232 | 232 | $prohibited_characters = array_map(function($value) { |
| 233 | 233 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
| 234 | 234 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
| 239 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 239 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 240 | 240 | pdump('Отключи отладку перед продакшном!'); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -251,17 +251,17 @@ discard block |
||
| 251 | 251 | // TODO - to scheduler |
| 252 | 252 | StatUpdateLauncher::unlock(); |
| 253 | 253 | |
| 254 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 254 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 255 | 255 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
| 256 | 256 | SN::$config->game_disable == GAME_DISABLE_REASON |
| 257 | 257 | ? SN::$config->game_disable_reason |
| 258 | 258 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
| 259 | 259 | ); |
| 260 | - if(defined('IN_API')) { |
|
| 260 | + if (defined('IN_API')) { |
|
| 261 | 261 | return; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if( |
|
| 264 | + if ( |
|
| 265 | 265 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 266 | 266 | && |
| 267 | 267 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | // TODO ban |
| 278 | 278 | // TODO $skip_ban_check |
| 279 | 279 | global $skip_ban_check; |
| 280 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 281 | - if(defined('IN_API')) { |
|
| 280 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 281 | + if (defined('IN_API')) { |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
| 293 | 293 | |
| 294 | 294 | |
| 295 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 295 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 296 | 296 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 297 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 298 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 297 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 298 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 299 | 299 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
| 300 | 300 | } |
| 301 | 301 | |