@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | |
9 | 9 | global $user; |
10 | 10 | |
11 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
11 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
12 | 12 | $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
13 | 13 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
14 | 14 | ); |
15 | 15 | |
16 | - if($error_message) { |
|
16 | + if ($error_message) { |
|
17 | 17 | message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10); |
18 | 18 | die(); |
19 | 19 | } |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
23 | 23 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
24 | 24 | |
25 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
25 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
26 | 26 | sn_db_transaction_start(); |
27 | 27 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
28 | 28 | $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round); |
29 | - if(sys_get_param_str('register_me')) { |
|
30 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
29 | + if (sys_get_param_str('register_me')) { |
|
30 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
31 | 31 | db_blitz_reg_insert($user['id'], $current_round); |
32 | 32 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
33 | 33 | } |
34 | - } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
34 | + } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
35 | 35 | db_blitz_reg_delete($user['id'], $current_round); |
36 | 36 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица"); |
37 | 37 | } |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | $blitz_players = 0; |
47 | 47 | $blitz_prize_dark_matter = 0; |
48 | 48 | $blitz_prize_places = 0; |
49 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
50 | - if(sys_get_param_str('generate')) { |
|
49 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
50 | + if (sys_get_param_str('generate')) { |
|
51 | 51 | $next_id = 0; |
52 | 52 | $query = db_blitz_reg_get_random_id($current_round); |
53 | - while($row = db_fetch($query)) { |
|
53 | + while ($row = db_fetch($query)) { |
|
54 | 54 | $next_id++; |
55 | 55 | $blitz_name = 'Игрок' . $next_id; |
56 | 56 | $blitz_password = sys_random_string(8); |
57 | 57 | db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row['id'], $current_round); |
58 | 58 | } |
59 | - } elseif(sys_get_param_str('import_generated')) { |
|
59 | + } elseif (sys_get_param_str('import_generated')) { |
|
60 | 60 | // ЭТО НА БЛИЦЕ!!! |
61 | 61 | DBStaticUser::db_player_list_blitz_delete_players(); |
62 | 62 | DBStaticPlanet::db_planets_purge(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $system = $system_step; |
79 | 79 | $planet = round(Vector::$knownPlanets / 2); |
80 | 80 | |
81 | - foreach($imported_string as &$string_data) { |
|
81 | + foreach ($imported_string as &$string_data) { |
|
82 | 82 | $string_data = explode(',', $string_data); |
83 | 83 | $username_safe = $string_data[0]; |
84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false); |
100 | 100 | |
101 | - if(($system += $system_step) >= Vector::$knownSystems) { |
|
101 | + if (($system += $system_step) >= Vector::$knownSystems) { |
|
102 | 102 | $galaxy++; |
103 | 103 | $system = $system_step; |
104 | 104 | } |
@@ -108,27 +108,27 @@ discard block |
||
108 | 108 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
109 | 109 | // pdump($imported_string); |
110 | 110 | // generated_string |
111 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
111 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
112 | 112 | $blitz_result = explode(';', $blitz_result_string); |
113 | 113 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
114 | 114 | unset($blitz_result[0]); |
115 | - foreach($blitz_result as $blitz_result_data) { |
|
115 | + foreach ($blitz_result as $blitz_result_data) { |
|
116 | 116 | $blitz_result_data = explode(',', $blitz_result_data); |
117 | - if(count($blitz_result_data) == 5) { |
|
117 | + if (count($blitz_result_data) == 5) { |
|
118 | 118 | db_blitz_reg_update_results($current_round, $blitz_result_data[1], $blitz_result_data[0], $blitz_result_data[2], $blitz_result_data[3], $blitz_result_data[4]); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | $blitz_result = array(); |
122 | 122 | } |
123 | 123 | |
124 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
124 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
125 | 125 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
126 | - foreach(DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
126 | + foreach (DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
127 | 127 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
128 | 128 | } |
129 | 129 | } else { |
130 | 130 | $query = db_blitz_reg_get_player_list($current_round); |
131 | - while($row = db_fetch($query)) { |
|
131 | + while ($row = db_fetch($query)) { |
|
132 | 132 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
133 | 133 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
134 | 134 | $blitz_players++; |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | $blitz_prize_dark_matter = $blitz_prize_players_active * 20000; |
137 | 137 | $blitz_prize_places = ceil($blitz_prize_players_active / 5); |
138 | 138 | |
139 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
139 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
140 | 140 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
141 | 141 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
142 | 142 | sn_db_transaction_start(); |
143 | 143 | $query = db_blitz_reg_get_player_list_order_by_place($current_round); |
144 | - while($row = db_fetch($query)) { |
|
145 | - if(!$row['blitz_place']) { |
|
144 | + while ($row = db_fetch($query)) { |
|
145 | + if (!$row['blitz_place']) { |
|
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | |
152 | 152 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
153 | 153 | pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
154 | - if($reward) { |
|
154 | + if ($reward) { |
|
155 | 155 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
156 | 156 | classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
157 | 157 | )); |
158 | 158 | db_blitz_reg_update_apply_results($reward, $row, $current_round); |
159 | 159 | } |
160 | 160 | |
161 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
161 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
162 | 162 | break; |
163 | 163 | } |
164 | 164 | } |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | $player_registered = false; |
175 | 175 | $query = db_blitz_reg_get_player_list_and_users($current_round); |
176 | -while($row = db_fetch($query)) { |
|
176 | +while ($row = db_fetch($query)) { |
|
177 | 177 | $tpl_player_data = array( |
178 | 178 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
179 | 179 | ); |
180 | 180 | |
181 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
181 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
182 | 182 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
183 | 183 | $tpl_player_data = array_merge($tpl_player_data, array( |
184 | 184 | 'ID' => $row['id'], |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | $template->assign_block_vars('registrations', $tpl_player_data); |
194 | - if($row['id'] == $user['id']) { |
|
194 | + if ($row['id'] == $user['id']) { |
|
195 | 195 | $player_registered = $row; |
196 | 196 | } |
197 | 197 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $result = array(); |
54 | 54 | |
55 | -switch($mode = sys_get_param_str('mode')) { |
|
55 | +switch ($mode = sys_get_param_str('mode')) { |
|
56 | 56 | case 'manage': |
57 | 57 | sn_sys_sector_buy('overview.php?mode=manage'); |
58 | 58 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $template = gettemplate('planet_manage', true); |
63 | 63 | $planet_id = sys_get_param_id('planet_id'); |
64 | 64 | |
65 | - if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
65 | + if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
66 | 66 | $planetrow['name'] = $new_name_unsafe; |
67 | 67 | DBStaticPlanet::db_planet_update_set_by_id( |
68 | 68 | $planetrow['id'], |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | 'name' => $new_name_unsafe, |
71 | 71 | ) |
72 | 72 | ); |
73 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
73 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
74 | 74 | try { |
75 | 75 | sn_db_transaction_start(); |
76 | 76 | $user = DBStaticUser::db_user_by_id($user['id'], true, '*'); |
77 | 77 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*'); |
78 | 78 | |
79 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
79 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
80 | 80 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
81 | 81 | } |
82 | 82 | |
83 | - if($planetrow['id'] == $user['id_planet']) { |
|
83 | + if ($planetrow['id'] == $user['id_planet']) { |
|
84 | 84 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
85 | 85 | } |
86 | 86 | |
87 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
87 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
88 | 88 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
89 | 89 | } |
90 | 90 | |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | ); |
110 | 110 | sn_db_transaction_commit(); |
111 | 111 | sys_redirect('overview.php?mode=manage'); |
112 | - } catch(exception $e) { |
|
112 | + } catch (exception $e) { |
|
113 | 113 | sn_db_transaction_rollback(); |
114 | 114 | $result[] = array( |
115 | 115 | 'STATUS' => $e->getCode(), |
116 | 116 | 'MESSAGE' => $e->getMessage(), |
117 | 117 | ); |
118 | 118 | } |
119 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
119 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
120 | 120 | try { |
121 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
121 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
122 | 122 | 'galaxy' => sys_get_param_int('new_galaxy'), |
123 | 123 | 'system' => sys_get_param_int('new_system'), |
124 | 124 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | // $planetrow = $global_data['planet']; |
136 | 136 | |
137 | 137 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
138 | - if($can_teleport['result'] != ERR_NONE) { |
|
138 | + if ($can_teleport['result'] != ERR_NONE) { |
|
139 | 139 | throw new exception($can_teleport['message'], $can_teleport['result']); |
140 | 140 | } |
141 | 141 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | array() |
155 | 155 | ); |
156 | 156 | |
157 | - if($planetrow['id'] == $user['id_planet']) { |
|
157 | + if ($planetrow['id'] == $user['id_planet']) { |
|
158 | 158 | DBStaticUser::db_user_set_by_id( |
159 | 159 | $user['id'], |
160 | 160 | array( |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
175 | 175 | ); |
176 | 176 | sys_redirect('overview.php?mode=manage'); |
177 | - } catch(exception $e) { |
|
177 | + } catch (exception $e) { |
|
178 | 178 | sn_db_transaction_rollback(); |
179 | 179 | $result[] = array( |
180 | 180 | 'STATUS' => $e->getCode(), |
181 | 181 | 'MESSAGE' => $e->getMessage(), |
182 | 182 | ); |
183 | 183 | } |
184 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
184 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
185 | 185 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
186 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
187 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
186 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
187 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
188 | 188 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
189 | 189 | DBStaticPlanet::db_planet_update_set_by_id( |
190 | 190 | $user['current_planet'], |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
211 | 211 | } |
212 | 212 | } else { |
213 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
213 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
214 | 214 | } |
215 | - } elseif( |
|
215 | + } elseif ( |
|
216 | 216 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
217 | 217 | && ( |
218 | 218 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
228 | 228 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
229 | 229 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
230 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
231 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
230 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
231 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
232 | 232 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
233 | 233 | } else { |
234 | 234 | $planetrow['PLANET_GOVERNOR_LEVEL'] = 1; |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | |
261 | 261 | lng_include('mrc_mercenary'); |
262 | 262 | int_planet_pretemplate($planetrow, $template); |
263 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
264 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
263 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
264 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
265 | 265 | continue; |
266 | 266 | } |
267 | 267 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
314 | 314 | )); |
315 | 315 | |
316 | - foreach($result as &$a_result) { |
|
316 | + foreach ($result as &$a_result) { |
|
317 | 317 | $template->assign_block_vars('result', $a_result); |
318 | 318 | } |
319 | 319 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | default: |
324 | 324 | sn_sys_sector_buy(); |
325 | 325 | |
326 | - if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
326 | + if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
327 | 327 | $planetrow['name'] = $new_name_unsafe; |
328 | 328 | DBStaticPlanet::db_planet_update_set_by_id( |
329 | 329 | $planetrow['id'], |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | $planet_count = 0; |
360 | 360 | $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*'); |
361 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
361 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
362 | 362 | sn_db_transaction_start(); |
363 | 363 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
364 | 364 | sn_db_transaction_commit(); |
@@ -369,16 +369,16 @@ discard block |
||
369 | 369 | |
370 | 370 | $planet_fleet_id = 0; |
371 | 371 | $fleet_list = $template_planet['fleet_list']; |
372 | - if($fleet_list['own']['count']) { |
|
372 | + if ($fleet_list['own']['count']) { |
|
373 | 373 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
374 | 374 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
375 | 375 | // $fleet_id++;tpl_parse_fleet_sn |
376 | 376 | } |
377 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
377 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
378 | 378 | continue; |
379 | 379 | } |
380 | 380 | $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']); |
381 | - if($moon) { |
|
381 | + if ($moon) { |
|
382 | 382 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
383 | 383 | } else { |
384 | 384 | $moon_fill = 0; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | tpl_assign_fleet($template, $fleets); |
419 | 419 | |
420 | 420 | $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']); |
421 | - if($lune) { |
|
421 | + if ($lune) { |
|
422 | 422 | $template->assign_vars(array( |
423 | 423 | 'MOON_ID' => $lune['id'], |
424 | 424 | 'MOON_IMG' => $lune['image'], |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
431 | 431 | |
432 | 432 | $planet_recyclers_orbiting = 0; |
433 | - foreach(classSupernova::$gc->groupRecyclers as $recycler_id) { |
|
433 | + foreach (classSupernova::$gc->groupRecyclers as $recycler_id) { |
|
434 | 434 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
435 | 435 | } |
436 | 436 | |
437 | 437 | int_planet_pretemplate($planetrow, $template); |
438 | 438 | |
439 | 439 | $sn_group_ques = sn_get_groups('ques'); |
440 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
441 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
440 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
441 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
442 | 442 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
443 | 443 | $template->assign_block_vars('ques', array( |
444 | 444 | 'ID' => $que_id, |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
447 | 447 | )); |
448 | 448 | |
449 | - if(!empty($this_que)) { |
|
450 | - foreach($this_que as $que_item) { |
|
449 | + if (!empty($this_que)) { |
|
450 | + foreach ($this_que as $que_item) { |
|
451 | 451 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
452 | 452 | } |
453 | 453 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | 'LENGTH' => $que_hangar_length, |
462 | 462 | )); |
463 | 463 | |
464 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
464 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
465 | 465 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
466 | 466 | $template->assign_block_vars('ques', array( |
467 | 467 | 'ID' => SUBQUE_DEFENSE, |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
474 | 474 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
475 | 475 | |
476 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
476 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
477 | 477 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
478 | 478 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
479 | 479 | } |
480 | 480 | |
481 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
481 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
482 | 482 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
483 | 483 | } |
484 | 484 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | )); |
536 | 536 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
537 | 537 | |
538 | - foreach($result as &$a_result) { |
|
538 | + foreach ($result as &$a_result) { |
|
539 | 539 | $template->assign_block_vars('result', $a_result); |
540 | 540 | } |
541 | 541 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $language_new = sys_get_param_str('langer', $user['lang']); |
17 | 17 | |
18 | - if($language_new != $user['lang']) { |
|
18 | + if ($language_new != $user['lang']) { |
|
19 | 19 | classLocale::$lang->lng_switch($language_new); |
20 | 20 | } |
21 | 21 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
26 | 26 | |
27 | - if(sys_get_param_str('mode') == 'change') { |
|
28 | - if($user['authlevel'] > 0) { |
|
27 | + if (sys_get_param_str('mode') == 'change') { |
|
28 | + if ($user['authlevel'] > 0) { |
|
29 | 29 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
30 | 30 | DBStaticPlanet::db_planet_set_by_owner( |
31 | 31 | $user['id'], |
@@ -42,27 +42,27 @@ discard block |
||
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
45 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
45 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
46 | 46 | sn_db_transaction_start(); |
47 | - if($user['authlevel'] < 3) { |
|
48 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
47 | + if ($user['authlevel'] < 3) { |
|
48 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
49 | 49 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
50 | 50 | die(); |
51 | 51 | } |
52 | 52 | |
53 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
53 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
54 | 54 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
55 | 55 | die(); |
56 | 56 | } |
57 | 57 | |
58 | 58 | $que = que_get($user['id'], false); |
59 | - if(!empty($que)) { |
|
59 | + if (!empty($que)) { |
|
60 | 60 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
61 | 61 | die(); |
62 | 62 | } |
63 | 63 | |
64 | 64 | $query = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
65 | - foreach($query as $planet) { |
|
65 | + foreach ($query as $planet) { |
|
66 | 66 | $classConfig = classSupernova::$config; |
67 | 67 | DBStaticPlanet::db_planet_update_set_by_id( |
68 | 68 | $planet['id'], |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | sn_db_transaction_commit(); |
91 | 91 | } |
92 | 92 | |
93 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
94 | - foreach($option_group as $option_name => $option_value) { |
|
95 | - if($user[$option_name] !== null) { |
|
93 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
94 | + foreach ($option_group as $option_name => $option_value) { |
|
95 | + if ($user[$option_name] !== null) { |
|
96 | 96 | $user[$option_name] = sys_get_param_str($option_name); |
97 | 97 | } else { |
98 | 98 | $user[$option_name] = $option_value; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | $player_options = sys_get_param('options'); |
106 | - if(!empty($player_options)) { |
|
107 | - array_walk($player_options, function (&$value) { |
|
106 | + if (!empty($player_options)) { |
|
107 | + array_walk($player_options, function(&$value) { |
|
108 | 108 | // TODO - Когда будет больше параметров - сделать больше проверок |
109 | 109 | $value = intval($value); |
110 | 110 | }); |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | |
116 | 116 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
117 | 117 | $username_safe = db_escape($username); |
118 | - 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)) { |
|
118 | + 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)) { |
|
119 | 119 | // проверка на корректность |
120 | 120 | sn_db_transaction_start(); |
121 | 121 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
122 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
122 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
123 | 123 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
124 | - switch(classSupernova::$config->game_user_changename) { |
|
124 | + switch (classSupernova::$config->game_user_changename) { |
|
125 | 125 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
126 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
126 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
127 | 127 | $template_result['.']['result'][] = array( |
128 | 128 | 'STATUS' => ERR_ERROR, |
129 | 129 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | sn_db_transaction_commit(); |
160 | 160 | } |
161 | 161 | |
162 | - if($new_password = sys_get_param('newpass1')) { |
|
162 | + if ($new_password = sys_get_param('newpass1')) { |
|
163 | 163 | try { |
164 | - if($new_password != sys_get_param('newpass2')) { |
|
164 | + if ($new_password != sys_get_param('newpass2')) { |
|
165 | 165 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
166 | 166 | } |
167 | 167 | |
168 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
168 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
169 | 169 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
170 | 170 | } |
171 | 171 | |
172 | 172 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
173 | - } catch(Exception $e) { |
|
173 | + } catch (Exception $e) { |
|
174 | 174 | $template_result['.']['result'][] = array( |
175 | 175 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
176 | 176 | 'MESSAGE' => $e->getMessage() |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
193 | 193 | |
194 | 194 | try { |
195 | - if($user['birthday']) { |
|
195 | + if ($user['birthday']) { |
|
196 | 196 | throw new exception(); |
197 | 197 | } |
198 | 198 | |
199 | 199 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
200 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
200 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
201 | 201 | throw new exception(); |
202 | 202 | } |
203 | 203 | |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
208 | 208 | asort($pos); |
209 | 209 | $i = 0; |
210 | - foreach($pos as &$position) { |
|
210 | + foreach ($pos as &$position) { |
|
211 | 211 | $position = ++$i; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
215 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
215 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
216 | 216 | throw new exception(); |
217 | 217 | } |
218 | 218 | |
219 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
219 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
220 | 220 | throw new exception(); |
221 | 221 | } |
222 | 222 | |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
225 | 225 | |
226 | 226 | $year = date('Y', SN_TIME_NOW); |
227 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
227 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
228 | 228 | $year--; |
229 | 229 | } |
230 | 230 | $user['user_birthday_celebrated'] = "{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"; |
231 | 231 | |
232 | - } catch(Exception $e) { |
|
232 | + } catch (Exception $e) { |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | require_once('includes/includes/sys_avatar.php'); |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | $template_result['.']['result'][] = $avatar_upload_result; |
239 | 239 | |
240 | 240 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
241 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
241 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
242 | 242 | playerTimeDiff::user_time_diff_set(array( |
243 | 243 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
244 | 244 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
245 | 245 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
246 | 246 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
247 | 247 | )); |
248 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
248 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
249 | 249 | playerTimeDiff::user_time_diff_set(array( |
250 | 250 | PLAYER_OPTION_TIME_DIFF => '', |
251 | 251 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'STATUS' => ERR_NONE, |
277 | 277 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
278 | 278 | ); |
279 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
279 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
280 | 280 | $template_result['.']['result'][] = array( |
281 | 281 | 'STATUS' => ERR_NONE, |
282 | 282 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | $template = gettemplate('options', $template); |
301 | 301 | |
302 | 302 | $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
303 | - while(($entry = $dir->read()) !== false) { |
|
304 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
303 | + while (($entry = $dir->read()) !== false) { |
|
304 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
305 | 305 | $template_result['.']['skin_list'][] = array( |
306 | 306 | 'VALUE' => $entry, |
307 | 307 | 'NAME' => $entry, |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | } |
312 | 312 | $dir->close(); |
313 | 313 | |
314 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
314 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
315 | 315 | $template_result['.']['planet_sort_options'][] = array( |
316 | 316 | 'VALUE' => $key, |
317 | 317 | 'NAME' => $value, |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | ); |
320 | 320 | } |
321 | 321 | |
322 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
322 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
323 | 323 | $template_result['.']['gender_list'][] = array( |
324 | 324 | 'VALUE' => $key, |
325 | 325 | 'NAME' => $value, |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $lang_list = lng_get_list(); |
331 | - foreach($lang_list as $lang_id => $lang_data) { |
|
331 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
332 | 332 | $template_result['.']['languages'][] = array( |
333 | 333 | 'VALUE' => $lang_id, |
334 | 334 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | |
340 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
341 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
340 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
341 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
342 | 342 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
343 | 343 | 'ID' => $key, |
344 | 344 | 'NAME' => $value, |
@@ -445,10 +445,10 @@ discard block |
||
445 | 445 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
446 | 446 | )); |
447 | 447 | |
448 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
449 | - if($option_group_id == OPT_MESSAGE) { |
|
450 | - foreach(DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
451 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
448 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
449 | + if ($option_group_id == OPT_MESSAGE) { |
|
450 | + foreach (DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
451 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
452 | 452 | $option_name = $message_class_data['name']; |
453 | 453 | |
454 | 454 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | } |
461 | 461 | } |
462 | 462 | } else { |
463 | - foreach($option_group as $option_name => $option_value) { |
|
464 | - if(array_key_exists($option_name, $user_option_types)) { |
|
463 | + foreach ($option_group as $option_name => $option_value) { |
|
464 | + if (array_key_exists($option_name, $user_option_types)) { |
|
465 | 465 | $option_type = $user_option_types[$option_name]; |
466 | 466 | } else { |
467 | 467 | $option_type = 'switch'; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | define('SN_PAYMENT_REQUEST_OK', 0); |
303 | 303 | define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1); |
304 | 304 | define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2); |
305 | -define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
305 | +define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
306 | 306 | define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак |
307 | 307 | define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак |
308 | 308 | define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ! |
@@ -772,14 +772,14 @@ discard block |
||
772 | 772 | |
773 | 773 | |
774 | 774 | // *** Mercenary/talent bonus types |
775 | -define('BONUS_NONE', 0); // No bonus |
|
776 | -define('BONUS_PERCENT', 1); // Percent on base value |
|
777 | -define('BONUS_ADD', 2); // Add |
|
778 | -define('BONUS_ABILITY', 3); // Some ability |
|
779 | -define('BONUS_MULTIPLY', 4); // Multiply by value |
|
780 | -define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
781 | -define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
782 | -define('BONUS_SPEED', 7); // Speed bonus |
|
775 | +define('BONUS_NONE', 0); // No bonus |
|
776 | +define('BONUS_PERCENT', 1); // Percent on base value |
|
777 | +define('BONUS_ADD', 2); // Add |
|
778 | +define('BONUS_ABILITY', 3); // Some ability |
|
779 | +define('BONUS_MULTIPLY', 4); // Multiply by value |
|
780 | +define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
781 | +define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
782 | +define('BONUS_SPEED', 7); // Speed bonus |
|
783 | 783 | |
784 | 784 | // *** Action constant (build should be replaced with ACTION) |
785 | 785 | define('BUILD_CREATE', 1); |
@@ -991,10 +991,10 @@ discard block |
||
991 | 991 | |
992 | 992 | // === Artifacts |
993 | 993 | define('UNIT_ARTIFACTS', 1000); |
994 | -define('ART_LHC', 1001); // Additional moon chance |
|
995 | -define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
996 | -define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
997 | -define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
994 | +define('ART_LHC', 1001); // Additional moon chance |
|
995 | +define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
996 | +define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
997 | +define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
998 | 998 | define('ART_HEURISTIC_CHIP', 1005); // Speed up research |
999 | 999 | define('ART_NANO_BUILDER', 1006); // Speed up building |
1000 | 1000 | define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions |
@@ -1064,18 +1064,18 @@ discard block |
||
1064 | 1064 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место |
1065 | 1065 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место |
1066 | 1066 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место |
1067 | -define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1067 | +define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1068 | 1068 | |
1069 | 1069 | define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд |
1070 | -define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1071 | -define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1070 | +define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1071 | +define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1072 | 1072 | define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда |
1073 | 1073 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН |
1074 | 1074 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН |
1075 | 1075 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН |
1076 | 1076 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН |
1077 | 1077 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН |
1078 | -define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1078 | +define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1079 | 1079 | |
1080 | 1080 | define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд |
1081 | 1081 | define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей" |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use DBStatic\DBStaticAlly; |
6 | 6 | use DBStatic\DBStaticUser; |
7 | 7 | |
8 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
8 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
9 | 9 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
10 | 10 | } |
11 | 11 | |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $ally_name_unsafe = sys_get_param_str_unsafe('name'); |
15 | 15 | $ally_name = db_escape($ally_name_unsafe); |
16 | 16 | |
17 | -if($ally_tag) { |
|
18 | - if(!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
17 | +if ($ally_tag) { |
|
18 | + if (!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
19 | 19 | message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name); |
23 | - if($query) { |
|
23 | + if ($query) { |
|
24 | 24 | message(str_replace('%s', $query['ally_tag'] == $ally_tag_unsafe ? $ally_tag_unsafe : $ally_name_unsafe, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']); |
25 | 25 | } |
26 | 26 |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_can_send_mails) { |
|
7 | +if (!$user_can_send_mails) { |
|
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $POST_text = sys_get_param_str('text'); |
12 | 12 | $internalAliSendTextUnsafe = sys_get_param_str_unsafe('text'); |
13 | -if($internalAliSendTextUnsafe) { |
|
13 | +if ($internalAliSendTextUnsafe) { |
|
14 | 14 | message(classLocale::$lang['members_who_recived_message'] . DBStaticMessages::msg_ali_send($internalAliSendTextUnsafe, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
15 | 15 | } |
16 | 16 | |
17 | 17 | $r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>"; |
18 | -if($ranks) { |
|
19 | - foreach($ranks as $id => $array) { |
|
18 | +if ($ranks) { |
|
19 | + foreach ($ranks as $id => $array) { |
|
20 | 20 | $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
21 | 21 | } |
22 | 22 | } |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | use DBStatic\DBStaticAlly; |
4 | 4 | use DBStatic\DBStaticUser; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
7 | 7 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
10 | -if(!$user_admin) { |
|
10 | +if (!$user_admin) { |
|
11 | 11 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
12 | 12 | } |
13 | 13 | |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
24 | 24 | |
25 | 25 | |
26 | -if(sys_get_param_str('isSaveOptions')) { |
|
26 | +if (sys_get_param_str('isSaveOptions')) { |
|
27 | 27 | require_once('includes/includes/sys_avatar.php'); |
28 | 28 | |
29 | 29 | $fieldChange = array(); |
30 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
30 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
31 | 31 | $fieldChange['ally_tag'] = $new_tag; |
32 | 32 | DBStaticUser::db_user_set_by_id( |
33 | 33 | $ally['ally_user_id'], |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | ) |
37 | 37 | ); |
38 | 38 | } |
39 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
39 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
40 | 40 | $fieldChange['ally_name'] = $new_name; |
41 | 41 | } |
42 | 42 | |
43 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
43 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
44 | 44 | $fieldChange['ally_owner_range'] = $new_owner_rank; |
45 | 45 | } |
46 | 46 | |
47 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
47 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
48 | 48 | $fieldChange['ally_web'] = $new_web; |
49 | 49 | } |
50 | 50 | |
51 | - if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
51 | + if (($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
52 | 52 | $fieldChange['ally_request_notallow'] = sys_get_param_int('request_notallow', $ally['ally_request_notallow']); |
53 | 53 | } |
54 | 54 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | 'AVATAR_UPLOAD_STATUS' => $avatar_upload_result['STATUS'], |
59 | 59 | 'AVATAR_UPLOAD_MESSAGE' => $avatar_upload_result['MESSAGE'], |
60 | 60 | )); |
61 | - if($new_image != $ally['ally_image']) { |
|
61 | + if ($new_image != $ally['ally_image']) { |
|
62 | 62 | $fieldChange['ally_image'] = $new_image; |
63 | 63 | } |
64 | 64 | |
65 | - if(!empty($fieldChange)) { |
|
65 | + if (!empty($fieldChange)) { |
|
66 | 66 | classSupernova::$db->doUpdateRowSet( |
67 | 67 | TABLE_ALLIANCE, |
68 | 68 | $fieldChange, |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | |
74 | 74 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
75 | 75 | } |
76 | -} elseif(sys_get_param_str('isSaveText')) { |
|
76 | +} elseif (sys_get_param_str('isSaveText')) { |
|
77 | 77 | $text_unsafe = sys_get_param_str_unsafe('text'); |
78 | 78 | DBStaticAlly::db_ally_update_texts($text_unsafe, $ally['id'], $text_list[$allyTextID]['db_field']); |
79 | 79 | $ally[$text_list[$allyTextID]['db_field']] = db_escape($text_unsafe); |
80 | -} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
81 | - if(!$isAllyOwner) { |
|
80 | +} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
81 | + if (!$isAllyOwner) { |
|
82 | 82 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
83 | 83 | } |
84 | 84 | |
85 | 85 | $newLeader = DBStaticUser::db_user_by_id($idNewLeader, false, `ally_id`); |
86 | - if($newLeader['ally_id'] == $user['ally_id']) { |
|
86 | + if ($newLeader['ally_id'] == $user['ally_id']) { |
|
87 | 87 | sn_db_transaction_start(); |
88 | 88 | DBStaticUser::db_user_set_by_id( |
89 | 89 | $user['id'], |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | sn_db_transaction_commit(); |
103 | 103 | sys_redirect('alliance.php'); |
104 | 104 | } |
105 | -} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
106 | - if(!$isAllyOwner) { |
|
105 | +} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
106 | + if (!$isAllyOwner) { |
|
107 | 107 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
108 | 108 | } |
109 | 109 | sn_db_transaction_start(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $userAllyAdmins = DBStaticUser::db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
160 | 160 | unset($tmp); |
161 | 161 | // while ($userAllyAdmin = db_fetch($userAllyAdmins)) |
162 | - foreach($userAllyAdmins as $userAllyAdmin) { |
|
162 | + foreach ($userAllyAdmins as $userAllyAdmin) { |
|
163 | 163 | // pdump($userAllyAdmin); |
164 | 164 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
165 | 165 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | $template->assign_var('adminMembers', $tmp); |
168 | 168 | } |
169 | 169 | |
170 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
171 | - if(!$sn_ali_admin_action_locale['title']) { |
|
170 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
171 | + if (!$sn_ali_admin_action_locale['title']) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | $template->assign_block_vars('admin_actions', array( |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | define('SN_DEBUG_PDUMP_CALLER', true); |
20 | 20 | |
21 | 21 | // Бенчмарк |
22 | -register_shutdown_function(function () { |
|
23 | - if(defined('IN_AJAX')) { |
|
22 | +register_shutdown_function(function() { |
|
23 | + if (defined('IN_AJAX')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
31 | 31 | (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
32 | 32 | '</div>'); |
33 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
33 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
34 | 34 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
35 | 35 | } |
36 | 36 | |
37 | - if(!empty($locale_cache_statistic['misses'])) { |
|
37 | + if (!empty($locale_cache_statistic['misses'])) { |
|
38 | 38 | print('<!--'); |
39 | 39 | pdump($locale_cache_statistic); |
40 | 40 | print('-->'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
56 | 56 | |
57 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
57 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | 58 | define('SN_GOOGLE', true); |
59 | 59 | } |
60 | 60 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ini_set('error_reporting', E_ALL ^ E_NOTICE); |
83 | 83 | |
84 | 84 | empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false; |
85 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
85 | +spl_autoload_register(function($class) use ($classRoot) { |
|
86 | 86 | $class = str_replace('\\', '/', $class); |
87 | 87 | if (file_exists($classRoot . $class . '.php')) { |
88 | 88 | require_once $classRoot . $class . '.php'; |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | // Но нужно, пока у нас есть не MVC-страницы |
162 | 162 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
163 | 163 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
164 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
164 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
165 | 165 | require_once($sn_page_name_file); |
166 | - if(is_array($sn_page_data['options'])) { |
|
166 | + if (is_array($sn_page_data['options'])) { |
|
167 | 167 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
168 | 168 | } |
169 | 169 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
176 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
176 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
177 | 177 | $sn_page_name = ''; |
178 | 178 | } |
179 | 179 | |
@@ -181,6 +181,6 @@ discard block |
||
181 | 181 | classLocale::$lang = $lang = classSupernova::$gc->localePlayer; |
182 | 182 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
183 | 183 | |
184 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
184 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
185 | 185 | require_once "init_secondary.php"; |
186 | 186 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | // ------------------------------------------------------------------------------------------------------------------------------ |
4 | 4 | function sn_sys_load_php_files($dir_name, $load_extension = '.php', $modules = false) { |
5 | - if(!file_exists($dir_name) || !is_dir($dir_name)) { |
|
5 | + if (!file_exists($dir_name) || !is_dir($dir_name)) { |
|
6 | 6 | return; |
7 | 7 | } |
8 | 8 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init_update() { |
41 | 41 | $update_file = SN_ROOT_PHYSICAL . "includes/update" . DOT_PHP_EX; |
42 | - if(file_exists($update_file)) { |
|
43 | - if(filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | - if(defined('IN_ADMIN')) { |
|
42 | + if (file_exists($update_file)) { |
|
43 | + if (filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | + if (defined('IN_ADMIN')) { |
|
45 | 45 | sn_db_transaction_start(); // Для защиты от двойного запуска апдейта - начинаем транзакцию. Так запись в базе будет блокирована |
46 | - if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
46 | + if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
47 | 47 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW + (classSupernova::$config->upd_lock_time ? classSupernova::$config->upd_lock_time : 300)); |
48 | 48 | sn_db_transaction_commit(); |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $current_time = time(); |
54 | 54 | classSupernova::$config->db_saveItem('var_db_update', $current_time); |
55 | 55 | classSupernova::$config->db_saveItem('var_db_update_end', $current_time); |
56 | - } elseif(filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
56 | + } elseif (filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
57 | 57 | $timeout = classSupernova::$config->var_db_update_end - SN_TIME_NOW; |
58 | 58 | die( |
59 | 59 | "Обновляется база данных. Рассчетное время окончания - {$timeout} секунд (время обновления может увеличиваться). Пожалуйста, подождите...<br /> |