@@ -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,7 +251,7 @@ 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 |
@@ -260,33 +260,33 @@ discard block |
||
260 | 260 | |
261 | 261 | // For API - just skipping all checks |
262 | 262 | // TODO: That is ideologically wrong and should be redone |
263 | - if(defined('IN_API')) { |
|
263 | + if (defined('IN_API')) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Actions for install mode |
268 | - if(defined('INSTALL_MODE') && INSTALL_MODE) { |
|
268 | + if (defined('INSTALL_MODE') && INSTALL_MODE) { |
|
269 | 269 | // Handling log out - should work even in install mode |
270 | - if(strtolower(INITIAL_PAGE) === 'logout') { |
|
270 | + if (strtolower(INITIAL_PAGE) === 'logout') { |
|
271 | 271 | SN::$auth->logout(true); |
272 | 272 | die(); |
273 | 273 | } |
274 | 274 | |
275 | 275 | // If user not logged in AND we are not on login page - redirect user there |
276 | - if(!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
276 | + if (!$sys_user_logged_in && !defined('LOGIN_LOGOUT')) { |
|
277 | 277 | header('Location: login.php'); |
278 | 278 | die(); |
279 | 279 | } |
280 | 280 | |
281 | 281 | // If user is type of admin AND in user pages - redirecting him to admin interface |
282 | 282 | // You really shouldn't mess in user interface until game not configured! |
283 | - if($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
283 | + if ($user['authlevel'] >= 1 && !defined('IN_ADMIN')) { |
|
284 | 284 | header('Location: ' . SN_ROOT_VIRTUAL_PARENT . 'admin/overview.php'); |
285 | 285 | die(); |
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | - if( |
|
289 | + if ( |
|
290 | 290 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
291 | 291 | && |
292 | 292 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | // TODO ban |
303 | 303 | // TODO $skip_ban_check |
304 | 304 | global $skip_ban_check; |
305 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
306 | - if(defined('IN_API')) { |
|
305 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
306 | + if (defined('IN_API')) { |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 | |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
318 | 318 | |
319 | 319 | |
320 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
320 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
321 | 321 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
322 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
323 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
322 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
323 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
324 | 324 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
325 | 325 | } |
326 | 326 |
@@ -332,7 +332,7 @@ |
||
332 | 332 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
333 | 333 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
334 | 334 | |
335 | - array_walk_recursive($result, function (&$value) use ($cost_left) { |
|
335 | + array_walk_recursive($result, function(&$value) use ($cost_left) { |
|
336 | 336 | $value -= $cost_left; |
337 | 337 | }); |
338 | 338 | } |
@@ -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 | |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | } |
835 | 835 | |
836 | 836 | $fleet_listx = flt_get_fleets_to_planet($CurPlanet); |
837 | - if($CurPlanet['planet_type'] == PT_MOON) { |
|
837 | + if ($CurPlanet['planet_type'] == PT_MOON) { |
|
838 | 838 | $parentPlanet = DBStaticPlanet::db_planet_by_id($CurPlanet['parent_planet']); |
839 | 839 | } else { |
840 | 840 | $parentPlanet = $CurPlanet; |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | 'QUE_ID' => QUE_RESEARCH, |
880 | 880 | 'QUE_HTML' => 'topnav', |
881 | 881 | |
882 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
882 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
883 | 883 | |
884 | 884 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
885 | 885 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | SnTemplate::renderFooter($page, $template_result); |
1170 | 1170 | } |
1171 | 1171 | |
1172 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
1172 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
1173 | 1173 | |
1174 | 1174 | sn_db_disconnect(); |
1175 | 1175 |
@@ -262,7 +262,7 @@ |
||
262 | 262 | foreach ($planets as $planetId => $planet) { |
263 | 263 | $templatizedPlanet = tpl_parse_planet($user, $planet); |
264 | 264 | |
265 | - if($planet['planet_type'] == PT_MOON) { |
|
265 | + if ($planet['planet_type'] == PT_MOON) { |
|
266 | 266 | $parentPlanet = DBStaticPlanet::db_planet_by_id($planet['parent_planet']); |
267 | 267 | } else { |
268 | 268 | $parentPlanet = $planet; |