@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $unit_level = $artifact_level_old = mrc_get_level($user, null, $unit_id, true); |
20 | 20 | if ($unit_level > 0) { |
21 | - switch($unit_id) { |
|
21 | + switch ($unit_id) { |
|
22 | 22 | case ART_LHC: |
23 | 23 | case ART_HOOK_SMALL: |
24 | 24 | case ART_HOOK_MEDIUM: |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function flt_mission_relocate($mission_data) { |
13 | 13 | $objFleet = $mission_data->fleet; |
14 | 14 | $destination_planet = &$mission_data->dst_planet; |
15 | - if($objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
15 | + if ($objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
16 | 16 | $objFleet->markReturnedAndSave(); |
17 | 17 | |
18 | 18 | return; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $fleet_resources[RES_CRYSTAL], classLocale::$lang['Crystal'], |
27 | 27 | $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium'] |
28 | 28 | ) . '<br />' . classLocale::$lang['sys_relocate_mess_user']; |
29 | - foreach($objFleet->shipsIterator() as $ship_id => $ship) { |
|
29 | + foreach ($objFleet->shipsIterator() as $ship_id => $ship) { |
|
30 | 30 | $Message .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship->count . '<br />'; |
31 | 31 | } |
32 | 32 | DBStaticMessages::msg_send_simple_message( |
@@ -4,19 +4,19 @@ discard block |
||
4 | 4 | |
5 | 5 | $classLocale = classLocale::$lang; |
6 | 6 | |
7 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
7 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
8 | 8 | include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
9 | 9 | } |
10 | 10 | |
11 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
11 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
12 | 12 | require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
13 | 13 | sn_user_birthday_celebrate(); |
14 | 14 | } |
15 | 15 | |
16 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
16 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
17 | 17 | classSupernova::$config->db_saveItem('var_online_user_count', DBStaticUser::db_user_count(true)); |
18 | 18 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
19 | - if(classSupernova::$config->server_log_online) { |
|
19 | + if (classSupernova::$config->server_log_online) { |
|
20 | 20 | db_log_online_insert(); |
21 | 21 | } |
22 | 22 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
44 | 44 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
45 | 45 | |
46 | -if(!empty($user['id'])) { |
|
46 | +if (!empty($user['id'])) { |
|
47 | 47 | classSupernova::$user_options->user_change($user['id']); |
48 | 48 | } |
49 | 49 | |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | : false |
57 | 57 | ); |
58 | 58 | |
59 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
60 | - $prohibited_characters = array_map(function ($value) { |
|
59 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
60 | + $prohibited_characters = array_map(function($value) { |
|
61 | 61 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
62 | 62 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
63 | 63 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
67 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
68 | 68 | pdump("Отключи отладку перед продакшном!"); |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
79 | 79 | : false; |
80 | 80 | |
81 | -if( |
|
81 | +if ( |
|
82 | 82 | classSupernova::$config->game_disable == GAME_DISABLE_STAT |
83 | 83 | && |
84 | 84 | SN_TIME_NOW - strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) > 600 |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | classSupernova::$debug->warning('Stat worked too long - watchdog unlocked', 'Stat WARNING'); |
92 | 92 | } |
93 | 93 | |
94 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
94 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
95 | 95 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
96 | 96 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
97 | 97 | ? classSupernova::$config->game_disable_reason |
98 | 98 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
99 | 99 | ); |
100 | - if(defined('IN_API')) { |
|
100 | + if (defined('IN_API')) { |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
104 | - if( |
|
104 | + if ( |
|
105 | 105 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
106 | 106 | && |
107 | 107 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | // TODO ban |
117 | 117 | // TODO $skip_ban_check |
118 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
119 | - if(defined('IN_API')) { |
|
118 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
119 | + if (defined('IN_API')) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | // pdump($allow_anonymous, '$allow_anonymous'); |
135 | 135 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
136 | 136 | |
137 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
137 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
138 | 138 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
139 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
139 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
140 | 140 | // pdump($sn_page_name); |
141 | 141 | // pdump(INITIAL_PAGE); |
142 | 142 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
143 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
143 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
144 | 144 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
145 | 145 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
146 | 146 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | global $skip_fleet_update; |
163 | 163 | $skip_fleet_update = $skip_fleet_update || classSupernova::$options['fleet_update_skip'] || defined('IN_ADMIN'); |
164 | -if( |
|
164 | +if ( |
|
165 | 165 | !$skip_fleet_update |
166 | 166 | && !(defined('IN_AJAX') && IN_AJAX === true) |
167 | 167 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | flt_flying_fleet_handler($skip_fleet_update); |
171 | 171 | } |
172 | 172 | |
173 | -if(!defined('IN_AJAX')) { |
|
173 | +if (!defined('IN_AJAX')) { |
|
174 | 174 | pdump("Scheduled processes is disabled"); |
175 | 175 | } |
176 | 176 | // scheduler_process(); |
@@ -298,7 +298,7 @@ |
||
298 | 298 | |
299 | 299 | if (!empty($resourcesChange)) { |
300 | 300 | $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id; |
301 | - if($planet_id) { |
|
301 | + if ($planet_id) { |
|
302 | 302 | // update planet |
303 | 303 | DBStaticPlanet::db_planet_update_resources($resourcesChange, $planet_id); |
304 | 304 | } else { |
@@ -9,19 +9,19 @@ discard block |
||
9 | 9 | $ts_var_stat_update = strtotime(classSupernova::$config->db_loadItem('var_stat_update')); |
10 | 10 | $ts_scheduled_update = sys_schedule_get_prev_run(classSupernova::$config->db_loadItem('stats_schedule'), classSupernova::$config->var_stat_update); |
11 | 11 | |
12 | - if(sys_get_param_int('admin_update')) { |
|
12 | + if (sys_get_param_int('admin_update')) { |
|
13 | 13 | define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1); |
14 | - if(USER_LEVEL > 0) { |
|
14 | + if (USER_LEVEL > 0) { |
|
15 | 15 | $is_admin_request = true; |
16 | 16 | $ts_scheduled_update = SN_TIME_NOW; |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | - if($ts_scheduled_update > $ts_var_stat_update) { |
|
20 | + if ($ts_scheduled_update > $ts_var_stat_update) { |
|
21 | 21 | lng_include('admin'); |
22 | 22 | sn_db_transaction_start(); |
23 | 23 | $ts_var_stat_update_end = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')); |
24 | - if(SN_TIME_NOW > $ts_var_stat_update_end) { |
|
24 | + if (SN_TIME_NOW > $ts_var_stat_update_end) { |
|
25 | 25 | $old_server_status = classSupernova::$config->db_loadItem('game_disable'); |
26 | 26 | classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_STAT); |
27 | 27 | |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_SQL); |
57 | 57 | classSupernova::$config->db_saveItem('var_stat_update_end', SN_TIME_SQL); |
58 | 58 | |
59 | - if($old_server_status == GAME_DISABLE_STAT) { |
|
59 | + if ($old_server_status == GAME_DISABLE_STAT) { |
|
60 | 60 | $old_server_status = GAME_DISABLE_NONE; |
61 | 61 | } |
62 | 62 | classSupernova::$config->db_saveItem('game_disable', $old_server_status); |
63 | - } elseif($ts_scheduled_update > $ts_var_stat_update) { |
|
63 | + } elseif ($ts_scheduled_update > $ts_var_stat_update) { |
|
64 | 64 | $timeout = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW; |
65 | 65 | $msg = classSupernova::$config->db_loadItem('var_stat_update_msg'); |
66 | 66 | $msg = "{$msg} ETA {$timeout} seconds. Please wait..."; |
67 | 67 | } |
68 | 68 | sn_db_transaction_rollback(); |
69 | - } elseif($is_admin_request) { |
|
69 | + } elseif ($is_admin_request) { |
|
70 | 70 | $msg = 'Stat is up to date'; |
71 | 71 | } |
72 | 72 |
@@ -83,8 +83,8 @@ |
||
83 | 83 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
84 | 84 | } |
85 | 85 | |
86 | - $return['structures'] = $structures; // Structures left after attack |
|
87 | - $return['metal'] = floor($metal); // Metal scraps |
|
86 | + $return['structures'] = $structures; // Structures left after attack |
|
87 | + $return['metal'] = floor($metal); // Metal scraps |
|
88 | 88 | $return['crystal'] = floor($crystal); // Crystal scraps |
89 | 89 | |
90 | 90 | return $return; |
@@ -103,23 +103,23 @@ |
||
103 | 103 | |
104 | 104 | !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false; |
105 | 105 | |
106 | - foreach(classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | - if($auth_level > $author_auth) { |
|
106 | + foreach (classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | + if ($auth_level > $author_auth) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach($replaces as $key => $html) { |
|
112 | - $msg = preg_replace(''.$key.'', $html, $msg); |
|
111 | + foreach ($replaces as $key => $html) { |
|
112 | + $msg = preg_replace('' . $key . '', $html, $msg); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | - if($auth_level > $author_auth) { |
|
116 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | + if ($auth_level > $author_auth) { |
|
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | |
121 | - foreach($replaces as $key => $imgName) { |
|
122 | - $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg); |
|
121 | + foreach ($replaces as $key => $imgName) { |
|
122 | + $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU", "<img src=\"design/images/smileys/" . $imgName . ".gif\" align=\"absmiddle\" title=\"" . $key . "\" alt=\"" . $key . "\">", $msg); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -131,7 +131,6 @@ |
||
131 | 131 | // return cht_message_parse($text, $escaped, $author_auth); |
132 | 132 | } |
133 | 133 | |
134 | -function sys_bbcodeUnParse($text, $escaped = false, $author_auth = 0) |
|
135 | -{ |
|
134 | +function sys_bbcodeUnParse($text, $escaped = false, $author_auth = 0) { |
|
136 | 135 | return str_replace('<br />', $escaped ? '\r\n' : "\r\n", $text); |
137 | 136 | } |
@@ -61,10 +61,10 @@ |
||
61 | 61 | } else { |
62 | 62 | $changeset['dark_matter_total'] = +$dark_matter; |
63 | 63 | } |
64 | - if($dark_matter) { |
|
64 | + if ($dark_matter) { |
|
65 | 65 | $changeset[$sn_data_dark_matter_db_name] = +$dark_matter; |
66 | 66 | } |
67 | - if(!empty($changeset)) { |
|
67 | + if (!empty($changeset)) { |
|
68 | 68 | DBStaticUser::db_user_adjust_by_id($user_id, $changeset); |
69 | 69 | } |
70 | 70 | $rows_affected = classSupernova::$db->db_affected_rows(); |
@@ -1,14 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
4 | -function lng_try_filepath($path, $file_path_relative) |
|
5 | -{ |
|
4 | +function lng_try_filepath($path, $file_path_relative) { |
|
6 | 5 | $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
7 | 6 | return file_exists($file_path) ? $file_path : false; |
8 | 7 | } |
9 | 8 | |
10 | -function lng_die_not_an_object() |
|
11 | -{ |
|
9 | +function lng_die_not_an_object() { |
|
12 | 10 | print('Ошибка - lang не объект! Сообщите Администратору сервера и приложите содержимое страницы'); |
13 | 11 | $trace = debug_backtrace(); |
14 | 12 | unset($trace[0]); |
@@ -17,27 +15,22 @@ discard block |
||
17 | 15 | } |
18 | 16 | |
19 | 17 | // ---------------------------------------------------------------------------------------------------------------- |
20 | -function lng_include($filename, $path = '', $ext = '.mo.php') |
|
21 | -{ |
|
18 | +function lng_include($filename, $path = '', $ext = '.mo.php') { |
|
22 | 19 | return is_object(classLocale::$lang) ? classLocale::$lang->lng_include($filename, $path, $ext) : lng_die_not_an_object(); |
23 | 20 | } |
24 | 21 | |
25 | -function lng_get_list() |
|
26 | -{ |
|
22 | +function lng_get_list() { |
|
27 | 23 | return is_object(classLocale::$lang) ? classLocale::$lang->lng_get_list() : lng_die_not_an_object(); |
28 | 24 | } |
29 | 25 | |
30 | -function lng_get_info($entry) |
|
31 | -{ |
|
26 | +function lng_get_info($entry) { |
|
32 | 27 | return is_object(classLocale::$lang) ? classLocale::$lang->lng_get_info($entry) : lng_die_not_an_object(); |
33 | 28 | } |
34 | 29 | |
35 | -function lng_switch($language_new) |
|
36 | -{ |
|
30 | +function lng_switch($language_new) { |
|
37 | 31 | return is_object(classLocale::$lang) ? classLocale::$lang->lng_switch($language_new) : lng_die_not_an_object(); |
38 | 32 | } |
39 | 33 | |
40 | -function lng_load_i18n($i18n) |
|
41 | -{ |
|
34 | +function lng_load_i18n($i18n) { |
|
42 | 35 | return is_object(classLocale::$lang) ? classLocale::$lang->lng_load_i18n($i18n) : lng_die_not_an_object(); |
43 | 36 | } |