@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'sys_fields' => "Fields", |
200 | 200 | |
201 | 201 | // Cookies |
202 | - 'err_cookie' => "Error! You cannot authenticate the user on information in a cookie.<br />Clear cookies in you browser then <a href='login" . DOT_PHP_EX . "'>log in</a> in a game or <a href='reg" . DOT_PHP_EX . "'>register new account again</a>.", |
|
202 | + 'err_cookie' => "Error! You cannot authenticate the user on information in a cookie.<br />Clear cookies in you browser then <a href='login".DOT_PHP_EX."'>log in</a> in a game or <a href='reg".DOT_PHP_EX."'>register new account again</a>.", |
|
203 | 203 | |
204 | 204 | // Supported languages |
205 | 205 | 'ru' => 'Russian', |
@@ -946,16 +946,16 @@ discard block |
||
946 | 946 | REGISTER_ERROR_BLITZ_MODE => 'Регистрация новых игроков в режиме Блиц-сервера отключена', |
947 | 947 | REGISTER_ERROR_USERNAME_WRONG => 'Wrong player name', |
948 | 948 | REGISTER_ERROR_ACCOUNT_NAME_EXISTS => 'Account name already registered', |
949 | - REGISTER_ERROR_PASSWORD_INSECURE => 'Insecure or wrong password. Password should be at least ' . PASSWORD_LENGTH_MIN . ' characters long and cannot start or end with spaces', |
|
950 | - REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из ' . LOGIN_LENGTH_MIN. ' символов', |
|
949 | + REGISTER_ERROR_PASSWORD_INSECURE => 'Insecure or wrong password. Password should be at least '.PASSWORD_LENGTH_MIN.' characters long and cannot start or end with spaces', |
|
950 | + REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из '.LOGIN_LENGTH_MIN.' символов', |
|
951 | 951 | REGISTER_ERROR_PASSWORD_DIFFERENT => 'Password does not match confirmation password', |
952 | 952 | REGISTER_ERROR_EMAIL_EMPTY => 'Е-Мейл не может быть пустым', |
953 | 953 | REGISTER_ERROR_EMAIL_WRONG => 'Введенный Е-Мейл не является адресом электронной почты', |
954 | 954 | REGISTER_ERROR_EMAIL_EXISTS => 'This email already registered. If you already registered try password reset option. Otherwise use other email address', |
955 | 955 | |
956 | 956 | PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS => 'There is no player with such base email', |
957 | - PASSWORD_RESTORE_ERROR_TOO_OFTEN => 'You can request password restoration code only once per 10 minutes. Check your SPAM folder for restoration code or contact server administration via email <span class="ok">' . classSupernova::$config->server_email . '</span> from your main email (email which you used for registration)', |
|
958 | - PASSWORD_RESTORE_ERROR_SENDING => 'There is error sending email with restore code. Contact server administration via email <span class="ok">' . classSupernova::$config->server_email . '</span>', |
|
957 | + PASSWORD_RESTORE_ERROR_TOO_OFTEN => 'You can request password restoration code only once per 10 minutes. Check your SPAM folder for restoration code or contact server administration via email <span class="ok">'.classSupernova::$config->server_email.'</span> from your main email (email which you used for registration)', |
|
958 | + PASSWORD_RESTORE_ERROR_SENDING => 'There is error sending email with restore code. Contact server administration via email <span class="ok">'.classSupernova::$config->server_email.'</span>', |
|
959 | 959 | PASSWORD_RESTORE_SUCCESS_CODE_SENT => 'Restoration code successfully sent', |
960 | 960 | |
961 | 961 | PASSWORD_RESTORE_ERROR_CODE_EMPTY => 'Restoration code can not be empty', |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | REGISTER_ERROR_PLAYER_NAME_TRIMMED => 'Player name can not starts or ends with "empty characters" (characters like "Space", "Tabulation", "New line" etc)', |
970 | 970 | REGISTER_ERROR_PLAYER_NAME_EMPTY => 'Player name can not be empty', |
971 | 971 | REGISTER_ERROR_PLAYER_NAME_RESTRICTED_CHARACTERS => 'Player name contains forbidden characters', |
972 | - REGISTER_ERROR_PLAYER_NAME_SHORT => 'Player name should have ' . LOGIN_LENGTH_MIN . ' characters at least', |
|
972 | + REGISTER_ERROR_PLAYER_NAME_SHORT => 'Player name should have '.LOGIN_LENGTH_MIN.' characters at least', |
|
973 | 973 | REGISTER_ERROR_PLAYER_NAME_EXISTS => 'This player name is already owned by someone. Please choose another name', |
974 | 974 | |
975 | 975 | |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | |
997 | 997 | 'log_lost_email_title' => 'Supernova, Universe %s: Password reset', |
998 | 998 | 'log_lost_email_code' => "Someone (possibly you) has requested a reset password on SuperNova Universe %4\$s . If you did not request reset password-then just ignore this email.\r\n\r\nFor password reset, go to the address \r\n%1\$s?password_reset_confirm=1&password_reset_code=%2\$s#tab_password_reset\r\nor enter the confirmation code \"%2\$s\" (WITHOUT THE DOUBLE QUOTES!) on the page %1\$s#tab_password_reset This code will be valid up to %3\$s. After the password reset you will need to request a new confirmation code", |
999 | - 'log_lost_email_pass' => "You changed your password on the SuperNova Universe %1\$s.\r\n\r\nYou login:\r\n%2\$s\r\n\r\nYour new password:\r\n%3\$s\r\n\r\nRemember it!\r\n\r\nYou can enter into game following link " . SN_ROOT_VIRTUAL . "login.php and using provided login and password", |
|
999 | + 'log_lost_email_pass' => "You changed your password on the SuperNova Universe %1\$s.\r\n\r\nYou login:\r\n%2\$s\r\n\r\nYour new password:\r\n%3\$s\r\n\r\nRemember it!\r\n\r\nYou can enter into game following link ".SN_ROOT_VIRTUAL."login.php and using provided login and password", |
|
1000 | 1000 | |
1001 | 1001 | 'sys_password_reset_message_body' => "Your password to accessing this Universe was reset.\r\n\r\nYour new password is:\r\n\r\n%1\$s\r\n\r\nRemember your password!\r\n\r\nYou can change it any time to one that suits you on 'Settings' menu", |
1002 | 1002 |
@@ -116,7 +116,7 @@ |
||
116 | 116 | 'log_lost_send_mail' => 'Send confirmation code', |
117 | 117 | 'log_lost_description2' => 'If you have a confirmation code, please enter it below and click "Reset password". An e-mail will be sent an email with a new password<br /><br /> |
118 | 118 | If you already asking for confirmation code but can not find email from us in your main folder - check your SPAM folder. Some mail servers can mark our letters as "SPAM"<br /><br /> |
119 | - If you absolutly sure that did not receive email from us - just write a email to Administration address <span class="ok">' . classSupernova::$config->server_email . '</span>', |
|
119 | + If you absolutly sure that did not receive email from us - just write a email to Administration address <span class="ok">' . classSupernova::$config->server_email.'</span>', |
|
120 | 120 | 'log_lost_reset_pass' => 'Reset password', |
121 | 121 | 'log_lost_sent_code' => 'Email sent to this email with further instructions on resetting your password', |
122 | 122 | 'log_lost_sent_pass' => 'Just sent to your email message with the new password', |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | global $skip_fleet_update; |
6 | 6 | $skip_fleet_update = true; |
7 | 7 | |
8 | -require_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
8 | +require_once('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
9 | 9 | |
10 | 10 | /* |
11 | 11 | $time_local = $time_server + $time_diff |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | $time_server = $time_local - $time_diff |
14 | 14 | */ |
15 | 15 | |
16 | -if($font_size = sys_get_param_str('font_size')) { |
|
17 | - if(strpos($font_size, '%') !== false) { |
|
16 | +if ($font_size = sys_get_param_str('font_size')) { |
|
17 | + if (strpos($font_size, '%') !== false) { |
|
18 | 18 | // Размер шрифта в процентах |
19 | - $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
|
20 | - } elseif(strpos($font_size, 'px') !== false) { |
|
19 | + $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX).'%'; |
|
20 | + } elseif (strpos($font_size, 'px') !== false) { |
|
21 | 21 | // Размер шрифта в пикселях |
22 | - $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
|
22 | + $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX).'px'; |
|
23 | 23 | } else { |
24 | 24 | // Не мышонка, не лягушка... |
25 | 25 | $font_size = FONT_SIZE_PERCENT_DEFAULT_STRING; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE] = $font_size; |
30 | 30 | } else { |
31 | 31 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
32 | - if($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
32 | + if ($user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
33 | 33 | $time_diff = intval($user_time_diff[PLAYER_OPTION_TIME_DIFF]); |
34 | 34 | } else { |
35 | 35 | $user_time_diff = playerTimeDiff::user_time_diff_probe(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $language_new = sys_get_param_str('langer', $user['lang']); |
14 | 14 | |
15 | - if($language_new != $user['lang']) { |
|
15 | + if ($language_new != $user['lang']) { |
|
16 | 16 | classLocale::$lang->lng_switch($language_new); |
17 | 17 | } |
18 | 18 | |
@@ -21,41 +21,41 @@ discard block |
||
21 | 21 | |
22 | 22 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
23 | 23 | |
24 | - if(sys_get_param_str('mode') == 'change') { |
|
25 | - if($user['authlevel'] > 0) { |
|
24 | + if (sys_get_param_str('mode') == 'change') { |
|
25 | + if ($user['authlevel'] > 0) { |
|
26 | 26 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
27 | 27 | db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
28 | 28 | db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
29 | 29 | $user['admin_protection'] = $planet_protection; |
30 | 30 | } |
31 | 31 | |
32 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
32 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
33 | 33 | sn_db_transaction_start(); |
34 | - if($user['authlevel'] < 3) { |
|
35 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
34 | + if ($user['authlevel'] < 3) { |
|
35 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
36 | 36 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
37 | 37 | die(); |
38 | 38 | } |
39 | 39 | |
40 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
40 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
41 | 41 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
42 | 42 | die(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $que = que_get($user['id'], false); |
46 | - if(!empty($que)) { |
|
46 | + if (!empty($que)) { |
|
47 | 47 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
48 | 48 | die(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
52 | - foreach($query as $planet) { |
|
52 | + foreach ($query as $planet) { |
|
53 | 53 | // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW); |
54 | 54 | // $planet = $planet['planet']; |
55 | 55 | |
56 | 56 | $classConfig = classSupernova::$config; |
57 | 57 | db_planet_set_by_id($planet['id'], |
58 | - "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
|
58 | + "last_update = ".SN_TIME_NOW.", energy_used = '0', energy_max = '0', |
|
59 | 59 | metal_perhour = '{$classConfig->metal_basic_income}', crystal_perhour = '{$classConfig->crystal_basic_income}', deuterium_perhour = '{$classConfig->deuterium_basic_income}', |
60 | 60 | metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', |
61 | 61 | fusion_plant_porcent = '0', solar_satelit_porcent = '0', ship_sattelite_sloth_porcent = 0" |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | sn_db_transaction_commit(); |
69 | 69 | } |
70 | 70 | |
71 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
72 | - foreach($option_group as $option_name => $option_value) { |
|
73 | - if($user[$option_name] !== null) { |
|
71 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
72 | + foreach ($option_group as $option_name => $option_value) { |
|
73 | + if ($user[$option_name] !== null) { |
|
74 | 74 | $user[$option_name] = sys_get_param_str($option_name); |
75 | 75 | } else { |
76 | 76 | $user[$option_name] = $option_value; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | $player_options = sys_get_param('options'); |
84 | - if(!empty($player_options)) { |
|
85 | - array_walk($player_options, function (&$value) { |
|
84 | + if (!empty($player_options)) { |
|
85 | + array_walk($player_options, function(&$value) { |
|
86 | 86 | // TODO - Когда будет больше параметров - сделать больше проверок |
87 | 87 | $value = intval($value); |
88 | 88 | }); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
95 | 95 | $username_safe = db_escape($username); |
96 | - if($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
96 | + if ($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
97 | 97 | // проверка на корректность |
98 | 98 | sn_db_transaction_start(); |
99 | 99 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
100 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
100 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
101 | 101 | $user = db_user_by_id($user['id'], true); |
102 | - switch(classSupernova::$config->game_user_changename) { |
|
102 | + switch (classSupernova::$config->game_user_changename) { |
|
103 | 103 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
104 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
104 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
105 | 105 | $template_result['.']['result'][] = array( |
106 | 106 | 'STATUS' => ERR_ERROR, |
107 | 107 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | sn_db_transaction_commit(); |
132 | 132 | } |
133 | 133 | |
134 | - if($new_password = sys_get_param('newpass1')) { |
|
134 | + if ($new_password = sys_get_param('newpass1')) { |
|
135 | 135 | try { |
136 | - if($new_password != sys_get_param('newpass2')) { |
|
136 | + if ($new_password != sys_get_param('newpass2')) { |
|
137 | 137 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
138 | 138 | } |
139 | 139 | |
140 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
140 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
141 | 141 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
142 | 142 | } |
143 | 143 | |
144 | 144 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
145 | - } catch(Exception $e) { |
|
145 | + } catch (Exception $e) { |
|
146 | 146 | $template_result['.']['result'][] = array( |
147 | 147 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
148 | 148 | 'MESSAGE' => $e->getMessage() |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
165 | 165 | |
166 | 166 | try { |
167 | - if($user['birthday']) { |
|
167 | + if ($user['birthday']) { |
|
168 | 168 | throw new exception(); |
169 | 169 | } |
170 | 170 | |
171 | 171 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
172 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
172 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
173 | 173 | throw new exception(); |
174 | 174 | } |
175 | 175 | |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
180 | 180 | asort($pos); |
181 | 181 | $i = 0; |
182 | - foreach($pos as &$position) { |
|
182 | + foreach ($pos as &$position) { |
|
183 | 183 | $position = ++$i; |
184 | 184 | } |
185 | 185 | |
186 | - $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
|
187 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
186 | + $regexp = "/".preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE)."/"; |
|
187 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
188 | 188 | throw new exception(); |
189 | 189 | } |
190 | 190 | |
191 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
191 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
192 | 192 | throw new exception(); |
193 | 193 | } |
194 | 194 | |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
197 | 197 | |
198 | 198 | $year = date('Y', SN_TIME_NOW); |
199 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
199 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
200 | 200 | $year--; |
201 | 201 | } |
202 | 202 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
203 | 203 | |
204 | 204 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
205 | - } catch(exception $e) { |
|
205 | + } catch (exception $e) { |
|
206 | 206 | $user_birthday = ''; |
207 | 207 | } |
208 | 208 | |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | $template_result['.']['result'][] = $avatar_upload_result; |
213 | 213 | |
214 | 214 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
215 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
215 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
216 | 216 | playerTimeDiff::user_time_diff_set(array( |
217 | 217 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
218 | 218 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
219 | 219 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
220 | 220 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
221 | 221 | )); |
222 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
222 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
223 | 223 | playerTimeDiff::user_time_diff_set(array( |
224 | 224 | PLAYER_OPTION_TIME_DIFF => '', |
225 | 225 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | 'STATUS' => ERR_NONE, |
240 | 240 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
241 | 241 | ); |
242 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
242 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
243 | 243 | $template_result['.']['result'][] = array( |
244 | 244 | 'STATUS' => ERR_NONE, |
245 | 245 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | |
263 | 263 | $template = gettemplate('options', $template); |
264 | 264 | |
265 | - $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
|
266 | - while(($entry = $dir->read()) !== false) { |
|
267 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
265 | + $dir = dir(SN_ROOT_PHYSICAL.'skins'); |
|
266 | + while (($entry = $dir->read()) !== false) { |
|
267 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
268 | 268 | $template_result['.']['skin_list'][] = array( |
269 | 269 | 'VALUE' => $entry, |
270 | 270 | 'NAME' => $entry, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | $dir->close(); |
276 | 276 | |
277 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
277 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
278 | 278 | $template_result['.']['planet_sort_options'][] = array( |
279 | 279 | 'VALUE' => $key, |
280 | 280 | 'NAME' => $value, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | } |
284 | 284 | |
285 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
285 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
286 | 286 | $template_result['.']['gender_list'][] = array( |
287 | 287 | 'VALUE' => $key, |
288 | 288 | 'NAME' => $value, |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | $lang_list = lng_get_list(); |
294 | - foreach($lang_list as $lang_id => $lang_data) { |
|
294 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
295 | 295 | $template_result['.']['languages'][] = array( |
296 | 296 | 'VALUE' => $lang_id, |
297 | 297 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
303 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
304 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
305 | 305 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
306 | 306 | 'ID' => $key, |
307 | 307 | 'NAME' => $value, |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
409 | 409 | )); |
410 | 410 | |
411 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
412 | - if($option_group_id == OPT_MESSAGE) { |
|
413 | - foreach($sn_message_class_list as $message_class_id => $message_class_data) { |
|
414 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
411 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
412 | + if ($option_group_id == OPT_MESSAGE) { |
|
413 | + foreach ($sn_message_class_list as $message_class_id => $message_class_data) { |
|
414 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
415 | 415 | $option_name = $message_class_data['name']; |
416 | 416 | |
417 | 417 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | } else { |
426 | - foreach($option_group as $option_name => $option_value) { |
|
427 | - if(array_key_exists($option_name, $user_option_types)) { |
|
426 | + foreach ($option_group as $option_name => $option_value) { |
|
427 | + if (array_key_exists($option_name, $user_option_types)) { |
|
428 | 428 | $option_type = $user_option_types[$option_name]; |
429 | 429 | } else { |
430 | 430 | $option_type = 'switch'; |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $sn_group_factories = sn_get_groups('factories'); |
23 | 23 | $planet_density = sn_get_groups('planet_density'); |
24 | 24 | |
25 | - if(sys_get_param('save_production')) { |
|
25 | + if (sys_get_param('save_production')) { |
|
26 | 26 | $production = sys_get_param('percent'); |
27 | - if(is_array($production) && !empty($production)) { |
|
27 | + if (is_array($production) && !empty($production)) { |
|
28 | 28 | // sn_db_transaction_start(); |
29 | 29 | $query = array(); |
30 | 30 | $planet_row_list = db_planet_list_sorted($user, false, '*'); |
31 | 31 | // while($planet = db_fetch($planet_row_list)) |
32 | - foreach($planet_row_list as $planet) { |
|
33 | - foreach($sn_group_factories as $factory_unit_id) { |
|
32 | + foreach ($planet_row_list as $planet) { |
|
33 | + foreach ($sn_group_factories as $factory_unit_id) { |
|
34 | 34 | $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id); |
35 | - if( |
|
35 | + if ( |
|
36 | 36 | get_unit_param($factory_unit_id, P_MINING_IS_MANAGED) |
37 | 37 | && isset($production[$factory_unit_id][$planet['id']]) |
38 | 38 | && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - foreach($query as $planet_id => $query_data) { |
|
46 | + foreach ($query as $planet_id => $query_data) { |
|
47 | 47 | db_planet_set_by_id($planet_id, implode(',', $query_data)); |
48 | 48 | } |
49 | 49 | // sn_db_transaction_commit(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $planet_row_list = db_planet_list_sorted($user); |
54 | 54 | // while ($planet = db_fetch($planet_row_list)) |
55 | - foreach($planet_row_list as $planet) { |
|
55 | + foreach ($planet_row_list as $planet) { |
|
56 | 56 | sn_db_transaction_start(); |
57 | 57 | $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true); |
58 | 58 | $planets[$planet['id']] = $global_data['planet']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $template = gettemplate('imperium', $template); |
65 | 65 | $template->assign_var('amount', count($planets) + 2); |
66 | 66 | |
67 | - for($i = 100; $i >= 0; $i -= 10) { |
|
67 | + for ($i = 100; $i >= 0; $i -= 10) { |
|
68 | 68 | $template->assign_block_vars('percent', array('PERCENT' => $i)); |
69 | 69 | } |
70 | 70 | |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | $total['temp_min'] = 1000; |
75 | 75 | $total['temp_max'] = -999; |
76 | 76 | |
77 | - foreach($planets as $planet_index => &$planet) { |
|
77 | + foreach ($planets as $planet_index => &$planet) { |
|
78 | 78 | $list_planet_que = $ques[$planet_index]; |
79 | 79 | $planet_template = tpl_parse_planet($planet); |
80 | 80 | |
81 | 81 | $planet_fleet_id = 0; |
82 | - $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet); |
|
83 | - if($fleet_list['own']['count']) { |
|
82 | + $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet); |
|
83 | + if ($fleet_list['own']['count']) { |
|
84 | 84 | $planet_fleet_id = "p{$fleet_id}"; |
85 | 85 | $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
86 | 86 | $fleet_id++; |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | UNIT_DEFENCE => 'defense', |
142 | 142 | ); |
143 | 143 | |
144 | - foreach($show_groups as $unit_group_id => $mode) { |
|
144 | + foreach ($show_groups as $unit_group_id => $mode) { |
|
145 | 145 | $template->assign_block_vars('prods', array( |
146 | 146 | 'NAME' => classLocale::$lang['tech'][$unit_group_id], |
147 | 147 | )); |
148 | 148 | $unit_group = get_unit_param('techtree', $unit_group_id); |
149 | - foreach($unit_group as $unit_id) { |
|
149 | + foreach ($unit_group as $unit_id) { |
|
150 | 150 | $unit_count = $unit_count_abs = 0; |
151 | 151 | $block_vars = array(); |
152 | 152 | $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED); |
153 | 153 | // $unit_db_name = pname_resource_name($unit_id); |
154 | - foreach($planets as $planet) { |
|
154 | + foreach ($planets as $planet) { |
|
155 | 155 | $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true); |
156 | 156 | |
157 | 157 | $level_plus['FACTORY'] = $unit_is_factory; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $level_plus['LEVEL_PLUS_GREEN'] = 0; |
160 | 160 | |
161 | 161 | $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1; |
162 | - switch($mode) { |
|
162 | + switch ($mode) { |
|
163 | 163 | /* |
164 | 164 | case 'structures': |
165 | 165 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | case 'structures': |
180 | 180 | case 'defense': |
181 | 181 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
182 | - if($level_plus_build) { |
|
182 | + if ($level_plus_build) { |
|
183 | 183 | $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}"; |
184 | 184 | // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}"; |
185 | 185 | $total['units'][$unit_id]['LEVEL_PLUS_GREEN'] += $level_plus['LEVEL_PLUS_GREEN']; |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']); |
200 | 200 | } |
201 | 201 | |
202 | - if($unit_count_abs) { |
|
202 | + if ($unit_count_abs) { |
|
203 | 203 | $template->assign_block_vars('prods', array( |
204 | 204 | 'ID' => $unit_id, |
205 | - 'FIELD' => 'unit_' . $unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте |
|
205 | + 'FIELD' => 'unit_'.$unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте |
|
206 | 206 | 'NAME' => classLocale::$lang['tech'][$unit_id], |
207 | 207 | 'MODE' => $mode, |
208 | 208 | )); |
209 | 209 | |
210 | - foreach($block_vars as $block_var) { |
|
210 | + foreach ($block_vars as $block_var) { |
|
211 | 211 | $template->assign_block_vars('prods.planet', $block_var); |
212 | 212 | } |
213 | 213 | $unit_green = $total['units'][$unit_id]['LEVEL_PLUS_GREEN']; |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | |
15 | 15 | $no_data = array('user' => false, 'planet' => false, 'que' => false); |
16 | 16 | |
17 | - if(!$planet) { |
|
17 | + if (!$planet) { |
|
18 | 18 | return $no_data; |
19 | 19 | } |
20 | 20 | |
21 | - if(!$no_user_update) { |
|
21 | + if (!$no_user_update) { |
|
22 | 22 | $user = intval(is_array($user) && $user['id'] ? $user['id'] : $user); |
23 | - if(!$user) { |
|
23 | + if (!$user) { |
|
24 | 24 | // TODO - Убрать позже |
25 | 25 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sys_o_get_updated() - USER пустой!</h1>'); |
26 | 26 | $backtrace = debug_backtrace(); |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | $user = db_user_by_id($user, !$simulation, '*', true); |
33 | 33 | } |
34 | 34 | |
35 | - if(empty($user['id'])) { |
|
35 | + if (empty($user['id'])) { |
|
36 | 36 | return $no_data; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
39 | + if (is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
40 | 40 | $planet = db_planet_by_vector($planet, '', !$simulation); |
41 | 41 | } else { |
42 | 42 | $planet = intval(is_array($planet) && isset($planet['id']) ? $planet['id'] : $planet); |
43 | 43 | $planet = db_planet_by_id($planet, !$simulation); |
44 | 44 | } |
45 | - if(!is_array($planet) || !isset($planet['id'])) { |
|
45 | + if (!is_array($planet) || !isset($planet['id'])) { |
|
46 | 46 | return $no_data; |
47 | 47 | } |
48 | 48 | |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | RES_DEUTERIUM => 0, |
66 | 66 | ); |
67 | 67 | |
68 | - switch($planet['planet_type']) { |
|
68 | + switch ($planet['planet_type']) { |
|
69 | 69 | case PT_PLANET: |
70 | - foreach($resources_increase as $resource_id => &$increment) { |
|
70 | + foreach ($resources_increase as $resource_id => &$increment) { |
|
71 | 71 | $resource_name = pname_resource_name($resource_id); |
72 | 72 | $increment = $caps_real['total'][$resource_id] * $ProductionTime / 3600; |
73 | 73 | $store_free = $caps_real['total_storage'][$resource_id] - $planet[$resource_name]; |
74 | 74 | $increment = min($increment, max(0, $store_free)); |
75 | 75 | |
76 | - if($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
76 | + if ($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
77 | 77 | classSupernova::$debug->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resource_name]} of {$resource_name}", 'Negative Resources', 501); |
78 | 78 | } |
79 | 79 | $planet[$resource_name] += $increment; |
80 | - $planet[$resource_name . '_perhour'] = $caps_real['total'][$resource_id]; |
|
80 | + $planet[$resource_name.'_perhour'] = $caps_real['total'][$resource_id]; |
|
81 | 81 | } |
82 | 82 | break; |
83 | 83 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | // TODO пересчитывать размер планеты только при постройке чего-нибудь и при покупке сектора |
95 | 95 | $planet['field_current'] = 0; |
96 | 96 | $sn_group_build_allow = sn_get_groups('build_allow'); |
97 | - if(is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
98 | - foreach($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
97 | + if (is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
98 | + foreach ($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
99 | 99 | $planet['field_current'] += mrc_get_level($user, $planet, $building_id, !$simulation, true); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - if($simulation) { |
|
103 | + if ($simulation) { |
|
104 | 104 | return array('user' => $user, 'planet' => $planet, 'que' => $que); |
105 | 105 | } |
106 | 106 |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | function ali_rank_list_save($ranks) { |
4 | 4 | global $user; |
5 | 5 | |
6 | - if(!empty($ranks)) { |
|
7 | - foreach($ranks as $rank => $rights) { |
|
6 | + if (!empty($ranks)) { |
|
7 | + foreach ($ranks as $rank => $rights) { |
|
8 | 8 | $rights = implode(',', $rights); |
9 | - $ranklist .= $rights . ';'; |
|
9 | + $ranklist .= $rights.';'; |
|
10 | 10 | } |
11 | 11 | } |
12 | 12 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $temp_array = array(); |
23 | 23 | $query = db_ally_diplomacy_get_relations($ally_from, $ally_to); |
24 | 24 | |
25 | - while($record = db_fetch($query)) { |
|
25 | + while ($record = db_fetch($query)) { |
|
26 | 26 | $temp_array[$record['alliance_diplomacy_contr_ally_id']] = $record; |
27 | 27 | } |
28 | 28 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
4 | 4 | function lng_try_filepath($path, $file_path_relative) |
5 | 5 | { |
6 | - $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
|
6 | + $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative; |
|
7 | 7 | return file_exists($file_path) ? $file_path : false; |
8 | 8 | } |
9 | 9 |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ), |
23 | 23 | ); |
24 | 24 | |
25 | - foreach($queries as &$query) { |
|
26 | - if(!empty($query['query'])) { |
|
25 | + foreach ($queries as &$query) { |
|
26 | + if (!empty($query['query'])) { |
|
27 | 27 | $query['result'] = doquery($query['query']); |
28 | - } elseif(!empty($query['callable']) && is_callable($query['callable'])) { |
|
28 | + } elseif (!empty($query['callable']) && is_callable($query['callable'])) { |
|
29 | 29 | call_user_func($query['callable']); |
30 | 30 | } |
31 | 31 | $query['error'] = classSupernova::$db->db_error(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
70 | 70 | // pdump($prev_run_array); |
71 | 71 | $scheduleList = explode(',', $scheduleList); |
72 | - array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
72 | + array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
73 | 73 | // pdump($schedule); |
74 | 74 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
75 | 75 | |
@@ -81,21 +81,21 @@ discard block |
||
81 | 81 | */ |
82 | 82 | // pdump($schedule); |
83 | 83 | |
84 | - foreach($prev_run_array as $index => $date_part) { |
|
84 | + foreach ($prev_run_array as $index => $date_part) { |
|
85 | 85 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
86 | 86 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
87 | 87 | } |
88 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
88 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
89 | 89 | unset($schedule['array']['now']); |
90 | 90 | } |
91 | 91 | |
92 | - foreach($schedule['array'] as $name => $array) { |
|
92 | + foreach ($schedule['array'] as $name => $array) { |
|
93 | 93 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
94 | - $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
|
95 | - $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
|
94 | + $schedule['string'][$name.'_next'] = $schedule['string'][$name].' +1 '.$interval; |
|
95 | + $schedule['string'][$name.'_prev'] = $schedule['string'][$name].' -1 '.$interval; |
|
96 | 96 | } |
97 | 97 | |
98 | - foreach($schedule['string'] as $string) { |
|
98 | + foreach ($schedule['string'] as $string) { |
|
99 | 99 | $timestamp = strtotime($string); |
100 | 100 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
101 | 101 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | $prev_run = 0; |
129 | 129 | $next_run = 0; |
130 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
130 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
131 | 131 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
132 | 132 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
133 | 133 | // pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule)); |