@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
5 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
6 | 6 | $error_message = SN::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
7 | 7 | !SN::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
8 | 8 | ); |
9 | 9 | |
10 | - if($error_message) { |
|
10 | + if ($error_message) { |
|
11 | 11 | messageBox($lang[$error_message], $lang['sys_error'], 'overview.php', 10); |
12 | 12 | die(); |
13 | 13 | } |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | $current_round = intval(SN::$config->db_loadItem('game_blitz_register_round')); |
18 | 18 | $current_price = intval(SN::$config->db_loadItem('game_blitz_register_price')); |
19 | 19 | |
20 | -if(SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
20 | +if (SN::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
21 | 21 | sn_db_transaction_start(); |
22 | 22 | $user = db_user_by_id($user['id'], true); |
23 | 23 | $is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true); |
24 | - if(sys_get_param_str('register_me')) { |
|
25 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
24 | + if (sys_get_param_str('register_me')) { |
|
25 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
26 | 26 | doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};"); |
27 | 27 | //mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
28 | 28 | SN::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | $blitz_players = 0; |
44 | 44 | $blitz_prize_dark_matter = 0; |
45 | 45 | $blitz_prize_places = 0; |
46 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
47 | - if(sys_get_param_str('generate')) { |
|
46 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
47 | + if (sys_get_param_str('generate')) { |
|
48 | 48 | $next_id = 0; |
49 | 49 | $query = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY RAND();"); |
50 | - while($row = db_fetch($query)) { |
|
50 | + while ($row = db_fetch($query)) { |
|
51 | 51 | $next_id++; |
52 | 52 | $blitz_name = 'Игрок' . $next_id; |
53 | 53 | $blitz_password = sys_random_string(8); |
54 | 54 | doquery("UPDATE {{blitz_registrations}} SET blitz_name = '{$blitz_name}', blitz_password = '{$blitz_password}' WHERE `id` = {$row['id']} AND `round_number` = {$current_round};"); |
55 | 55 | } |
56 | - } elseif(sys_get_param_str('import_generated')) { |
|
56 | + } elseif (sys_get_param_str('import_generated')) { |
|
57 | 57 | // ЭТО НА БЛИЦЕ!!! |
58 | 58 | doquery("DELETE FROM {{users}} WHERE username like 'Игрок%';"); |
59 | 59 | doquery("DELETE FROM {{planets}} WHERE id_owner not in (SELECT `id` FROM {{users}});"); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $system = $system_step; |
76 | 76 | $planet = round(SN::$config->game_maxPlanet / 2); |
77 | 77 | |
78 | - foreach($imported_string as &$string_data) { |
|
78 | + foreach ($imported_string as &$string_data) { |
|
79 | 79 | $string_data = explode(',', $string_data); |
80 | 80 | $username_safe = $string_data[0]; |
81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], Universe::MOON_MAX_SIZE, false); |
91 | 91 | |
92 | - if(($system += $system_step) >= SN::$config->game_maxSystem) { |
|
92 | + if (($system += $system_step) >= SN::$config->game_maxSystem) { |
|
93 | 93 | $galaxy++; |
94 | 94 | $system = $system_step; |
95 | 95 | } |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | SN::$config->db_saveItem('users_amount', SN::$config->users_amount + $new_players); |
100 | 100 | // generated_string |
101 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
101 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
102 | 102 | $blitz_result = explode(';', $blitz_result_string); |
103 | 103 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
104 | 104 | unset($blitz_result[0]); |
105 | - foreach($blitz_result as $blitz_result_data) { |
|
105 | + foreach ($blitz_result as $blitz_result_data) { |
|
106 | 106 | $blitz_result_data = explode(',', $blitz_result_data); |
107 | - if(count($blitz_result_data) == 5) { |
|
107 | + if (count($blitz_result_data) == 5) { |
|
108 | 108 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
109 | 109 | doquery( |
110 | 110 | "UPDATE `{{blitz_registrations}}` SET |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | $blitz_result = array(); |
119 | 119 | } |
120 | 120 | |
121 | - if(SN::$config->game_mode == GAME_BLITZ) { |
|
121 | + if (SN::$config->game_mode == GAME_BLITZ) { |
|
122 | 122 | $blitz_result = array(SN::$config->db_loadItem('var_stat_update')); |
123 | 123 | $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;"); |
124 | - while($row = db_fetch($query)) { |
|
124 | + while ($row = db_fetch($query)) { |
|
125 | 125 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;"); |
129 | - while($row = db_fetch($query)) { |
|
129 | + while ($row = db_fetch($query)) { |
|
130 | 130 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
131 | 131 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
132 | 132 | $blitz_players++; |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | 'Игрок40' |
142 | 142 | */ |
143 | 143 | |
144 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
144 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
145 | 145 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
146 | 146 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
147 | 147 | sn_db_transaction_start(); |
148 | 148 | $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;"); |
149 | - while($row = db_fetch($query)) { |
|
150 | - if(!$row['blitz_place']) { |
|
149 | + while ($row = db_fetch($query)) { |
|
150 | + if (!$row['blitz_place']) { |
|
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | $blitz_prize_places_actual--; |
156 | 156 | |
157 | 157 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
158 | -pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']); |
|
159 | - if($reward) { |
|
158 | +pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
|
159 | + if ($reward) { |
|
160 | 160 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
161 | 161 | $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
162 | 162 | )); |
163 | 163 | doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};"); |
164 | 164 | } |
165 | 165 | |
166 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
166 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
167 | 167 | break; |
168 | 168 | } |
169 | 169 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | JOIN {{users}} AS u ON u.id = br.user_id |
184 | 184 | WHERE br.`round_number` = {$current_round} |
185 | 185 | order by `blitz_place`, `timestamp`;"); |
186 | -while($row = db_fetch($query)) { |
|
186 | +while ($row = db_fetch($query)) { |
|
187 | 187 | $tpl_player_data = array( |
188 | 188 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
189 | 189 | ); |
190 | 190 | |
191 | - if(SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
191 | + if (SN::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
192 | 192 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
193 | 193 | $tpl_player_data = array_merge($tpl_player_data, array( |
194 | 194 | 'ID' => $row['id'], |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | $template->assign_block_vars('registrations', $tpl_player_data); |
204 | - if($row['id'] == $user['id']) { |
|
204 | + if ($row['id'] == $user['id']) { |
|
205 | 205 | $player_registered = $row; |
206 | 206 | } |
207 | 207 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | unset($player_options[PLAYER_OPTION_TUTORIAL_CURRENT]); |
402 | 402 | } |
403 | 403 | |
404 | - array_walk($player_options, function (&$value) { |
|
404 | + array_walk($player_options, function(&$value) { |
|
405 | 405 | // TODO - Когда будет больше параметров - сделать больше проверок |
406 | 406 | $value = intval($value); |
407 | 407 | }); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $user['id'], |
451 | 451 | RPG_NAME_CHANGE, |
452 | 452 | -$config->game_user_changename_cost, |
453 | - vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username,]) |
|
453 | + vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username, ]) |
|
454 | 454 | ); |
455 | 455 | |
456 | 456 | case SERVER_PLAYER_NAME_CHANGE_FREE: |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
151 | 151 | |
152 | 152 | // Alliance bonus calculations |
153 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
153 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
154 | 154 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
155 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
155 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
156 | 156 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
157 | 157 | 'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
158 | 158 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | 'Defs_Cdr' => 30, |
187 | 187 | 'eco_scale_storage' => 1, |
188 | 188 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
189 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
189 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
190 | 190 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
191 | 191 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
192 | 192 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | 'energy_basic_income' => 0, |
198 | 198 | |
199 | 199 | // Bashing protection settings |
200 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
201 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
202 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
203 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
204 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
200 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
201 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
202 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
203 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
204 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
205 | 205 | |
206 | 206 | 'Fleet_Cdr' => 30, |
207 | 207 | 'fleet_speed' => 1, |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | 'fleet_update_interval' => 4, |
210 | 210 | 'fleet_update_lock' => '', // SQL time when lock was acquired |
211 | 211 | |
212 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
213 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
212 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
213 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
214 | 214 | // Defaults |
215 | 215 | 'game_default_language' => 'ru', |
216 | 216 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | 'game_maxSystem' => 199, |
225 | 225 | 'game_maxPlanet' => 15, |
226 | 226 | // Game global settings |
227 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
227 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
228 | 228 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
229 | 229 | |
230 | 230 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
231 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
232 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
231 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
232 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
233 | 233 | // Noob protection |
234 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
234 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
235 | 235 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
236 | 236 | |
237 | 237 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | 'payment_currency_exchange_wmu' => 30, |
286 | 286 | 'payment_currency_exchange_wmz' => 1, |
287 | 287 | |
288 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
289 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
288 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
289 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
290 | 290 | |
291 | 291 | 'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
292 | - 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
293 | - 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
292 | + 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
293 | + 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
294 | 294 | 'planet_teleport_cost' => 50000, // Cost of planet teleportation |
295 | 295 | 'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
296 | 296 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | 'resource_multiplier' => 1, |
313 | 313 | |
314 | 314 | //Roleplay system |
315 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
315 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
316 | 316 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
317 | 317 | |
318 | 318 | // Black Market - General |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | SN::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | SN::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | SN::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | SN::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | SN::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | SN::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | SN::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | SN::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | SN::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
100 | 100 | |
101 | 101 | SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
102 | - if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
103 | - if(SN::$config->empire_mercenary_temporary) { |
|
102 | + if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
103 | + if (SN::$config->empire_mercenary_temporary) { |
|
104 | 104 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
105 | 105 | } else { |
106 | 106 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | tpl_assign_select($template, 'ver_response', SN::$lang['adm_opt_ver_response'], 'ID', 'NAME'); |
151 | 151 | |
152 | 152 | $lang_list = lng_get_list(); |
153 | -foreach($lang_list as $lang_id => $lang_data) { |
|
153 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
154 | 154 | $template->assign_block_vars('game_languages', array( |
155 | 155 | 'ID' => $lang_id, |
156 | 156 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use \DBAL\DbQuery; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | $ally_name_safe = db_escape($user['ally_name']); |
18 | 18 | |
19 | 19 | $autoAccept = false; |
20 | -if(sys_get_param_str('ali_dip_offer_make')) |
|
20 | +if (sys_get_param_str('ali_dip_offer_make')) |
|
21 | 21 | { |
22 | 22 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
23 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
23 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
24 | 24 | { |
25 | 25 | messageBox($lang['ali_dip_err_wrong_offer'], $page_title); |
26 | 26 | } |
27 | 27 | |
28 | 28 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
29 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
29 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
30 | 30 | { |
31 | 31 | messageBox($lang['ali_dip_err_same_ally'], $page_title); |
32 | 32 | } |
33 | 33 | |
34 | 34 | $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true); |
35 | - if(!$contr_ally_row) |
|
35 | + if (!$contr_ally_row) |
|
36 | 36 | { |
37 | 37 | messageBox($lang['ali_dip_err_no_ally'], $page_title); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
41 | - if($alliance_negotiation_relation == $relation_current_id) |
|
41 | + if ($alliance_negotiation_relation == $relation_current_id) |
|
42 | 42 | { |
43 | 43 | messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
44 | 44 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
52 | 52 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
53 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
53 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
54 | 54 | { |
55 | 55 | DbQuery::build() |
56 | 56 | ->setTable('alliance_negotiation') |
@@ -84,39 +84,39 @@ discard block |
||
84 | 84 | else |
85 | 85 | { |
86 | 86 | $offer_id = sys_get_param_id('offer_id'); |
87 | - if($offer_id) |
|
87 | + if ($offer_id) |
|
88 | 88 | { |
89 | 89 | $offer_answer = sys_get_param_str('answer'); |
90 | 90 | |
91 | 91 | $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true); |
92 | - if(!$negotiation) |
|
92 | + if (!$negotiation) |
|
93 | 93 | { |
94 | 94 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
95 | 95 | } |
96 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
96 | + elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
97 | 97 | { |
98 | 98 | // TODO: Add log of hack attempt |
99 | 99 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
100 | 100 | } |
101 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
101 | + elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
102 | 102 | { |
103 | - if($offer_answer == 'accept') |
|
103 | + if ($offer_answer == 'accept') |
|
104 | 104 | { |
105 | 105 | // TODO: Add log of hack attempt |
106 | 106 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
107 | 107 | } |
108 | - elseif($offer_answer == 'deny') |
|
108 | + elseif ($offer_answer == 'deny') |
|
109 | 109 | { |
110 | 110 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
111 | 111 | } |
112 | 112 | } |
113 | 113 | else |
114 | 114 | { |
115 | - if($offer_answer == 'accept') |
|
115 | + if ($offer_answer == 'accept') |
|
116 | 116 | { |
117 | 117 | $accept_offer = true; |
118 | 118 | } |
119 | - elseif($offer_answer == 'deny') |
|
119 | + elseif ($offer_answer == 'deny') |
|
120 | 120 | { |
121 | 121 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
122 | 122 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -if($accept_offer) |
|
127 | +if ($accept_offer) |
|
128 | 128 | { |
129 | 129 | sn_db_transaction_start(); |
130 | 130 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | sn_db_transaction_commit(); |
185 | 185 | } |
186 | 186 | |
187 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
187 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
188 | 188 | { |
189 | 189 | $template->assign_block_vars('relation', array( |
190 | 190 | 'ID' => $diplomacy_relation_id, |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;"); |
196 | -while($alliance = db_fetch($query)) |
|
196 | +while ($alliance = db_fetch($query)) |
|
197 | 197 | { |
198 | 198 | $template->assign_block_vars('alliance', array( |
199 | 199 | 'ID' => $alliance['id'], |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | WHERE |
213 | 213 | alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};" |
214 | 214 | ); |
215 | -while($offer = db_fetch($query)) |
|
215 | +while ($offer = db_fetch($query)) |
|
216 | 216 | { |
217 | 217 | $template->assign_block_vars('offer', array( |
218 | 218 | 'ID' => $offer['alliance_negotiation_id'], |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | ->doInsert(); |
68 | 68 | |
69 | 69 | $accept_offer = false; |
70 | - } |
|
71 | - else |
|
70 | + } else |
|
72 | 71 | { |
73 | 72 | $accept_offer = true; |
74 | 73 | $autoAccept = true; |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | 'alliance_negotiation_relation' => $alliance_negotiation_relation, |
81 | 80 | ); |
82 | 81 | } |
83 | -} |
|
84 | -else |
|
82 | +} else |
|
85 | 83 | { |
86 | 84 | $offer_id = sys_get_param_id('offer_id'); |
87 | 85 | if($offer_id) |
@@ -92,31 +90,26 @@ discard block |
||
92 | 90 | if(!$negotiation) |
93 | 91 | { |
94 | 92 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
95 | - } |
|
96 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
93 | + } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
97 | 94 | { |
98 | 95 | // TODO: Add log of hack attempt |
99 | 96 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
100 | - } |
|
101 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
97 | + } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
102 | 98 | { |
103 | 99 | if($offer_answer == 'accept') |
104 | 100 | { |
105 | 101 | // TODO: Add log of hack attempt |
106 | 102 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
107 | - } |
|
108 | - elseif($offer_answer == 'deny') |
|
103 | + } elseif($offer_answer == 'deny') |
|
109 | 104 | { |
110 | 105 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
111 | 106 | } |
112 | - } |
|
113 | - else |
|
107 | + } else |
|
114 | 108 | { |
115 | 109 | if($offer_answer == 'accept') |
116 | 110 | { |
117 | 111 | $accept_offer = true; |
118 | - } |
|
119 | - elseif($offer_answer == 'deny') |
|
112 | + } elseif($offer_answer == 'deny') |
|
120 | 113 | { |
121 | 114 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
122 | 115 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | protected static $autoloaderRegistered = false; |
25 | 25 | |
26 | 26 | protected static function _constructorStatic() { |
27 | - if(!static::$autoloaderRegistered) { |
|
27 | + if (!static::$autoloaderRegistered) { |
|
28 | 28 | spl_autoload_register(array(__CLASS__, 'autoloader')); |
29 | 29 | static::$autoloaderRegistered = true; |
30 | 30 | } |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | public static function autoloader($class) { |
37 | 37 | static::_constructorStatic(); |
38 | 38 | |
39 | - foreach(static::$folders as $data) { |
|
39 | + foreach (static::$folders as $data) { |
|
40 | 40 | $theClassFile = $class; |
41 | 41 | |
42 | - if($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
42 | + if ($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
43 | 43 | $theClassFile = substr($class, strlen($data[static::P_PREFIX])); |
44 | 44 | } |
45 | 45 | |
46 | 46 | $classFullFileName = str_replace('\\', '/', $data[static::P_FOLDER] . $theClassFile) . DOT_PHP_EX; |
47 | - if(file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
47 | + if (file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
48 | 48 | require_once($classFullFileName); |
49 | - if(method_exists($class, '_constructorStatic')) { |
|
49 | + if (method_exists($class, '_constructorStatic')) { |
|
50 | 50 | $class::_constructorStatic(); |
51 | 51 | } |
52 | 52 | } |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | $absoluteClassRoot = str_replace('\\', '/', SN_ROOT_PHYSICAL . $absoluteClassRoot); |
64 | 64 | |
65 | - if(!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
65 | + if (!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
66 | 66 | // TODO - throw new \Exception("There is some error when installing autoloader for '{$absoluteClassRoot}' class prefix '{$classPrefix}'"); |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/'; |
70 | 70 | |
71 | - if($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
71 | + if ($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
72 | 72 | $classPrefix .= '\\'; |
73 | 73 | } |
74 | 74 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
117 | 117 | }); |
118 | 118 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if ($request['metamatter'] && $payment_module_request) { |
224 | 224 | try { |
225 | 225 | $paymentModuleReal = SN::$gc->modules->getModule($payment_module_request); |
226 | - if(!is_object($paymentModuleReal)) { |
|
226 | + if (!is_object($paymentModuleReal)) { |
|
227 | 227 | throw new Exception('{ Менеджер модулей вернул null вместо платёжного модуля для }' . $payment_module_request, ERR_ERROR); |
228 | 228 | } |
229 | 229 | /** |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | 'PLAYER_CURRENCY' => $player_currency, |
313 | 313 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
314 | 314 | |
315 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
315 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
316 | 316 | 'UNIT_AMOUNT_TEXT' => HelperString::numberFloorAndFormat($request['metamatter']), |
317 | 317 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
318 | 318 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | displayP($page_item); |
284 | 284 | } |
285 | 285 | |
286 | - if(is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
287 | - foreach($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
286 | + if (is_array($template_result[TEMPLATE_EXTRA_ARRAY]) && !empty($template_result[TEMPLATE_EXTRA_ARRAY])) { |
|
287 | + foreach ($template_result[TEMPLATE_EXTRA_ARRAY] as $extraName => $extraTemplate) { |
|
288 | 288 | /** |
289 | 289 | * @var template $extraTemplate |
290 | 290 | */ |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | renderFooter(); |
298 | 298 | } |
299 | 299 | |
300 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
300 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
301 | 301 | |
302 | 302 | sn_db_disconnect(); |
303 | 303 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | -SN::$afterInit[] = function () { |
|
612 | +SN::$afterInit[] = function() { |
|
613 | 613 | SN::$gc->pimp->add()->tpl_render_topnav($t = 'sn_tpl_render_topnav', [], null); |
614 | 614 | }; |
615 | 615 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | global $lang, $config, $sn_mvc; |
625 | 625 | |
626 | 626 | // This call was not first one... Using results from previous call |
627 | - if(!empty($prevUser['username'])) { |
|
627 | + if (!empty($prevUser['username'])) { |
|
628 | 628 | $user = $prevUser; |
629 | 629 | } |
630 | 630 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | 'QUE_ID' => QUE_RESEARCH, |
681 | 681 | 'QUE_HTML' => 'topnav', |
682 | 682 | |
683 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
683 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
684 | 684 | |
685 | 685 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
686 | 686 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | 'LANG' => $language ? $language : '', |
975 | 975 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
976 | 976 | |
977 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
977 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
978 | 978 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
979 | 979 | )); |
980 | 980 |
@@ -272,15 +272,15 @@ |
||
272 | 272 | |
273 | 273 | global $sn_mvc; |
274 | 274 | foreach ($sn_mvc as $handler_type => &$handler_data) { |
275 | - if($handler_type == MVC_OPTIONS) { |
|
275 | + if ($handler_type == MVC_OPTIONS) { |
|
276 | 276 | continue; |
277 | 277 | } |
278 | 278 | sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type); |
279 | 279 | } |
280 | 280 | |
281 | - if(!empty($this->manifest['mvc'][MVC_OPTIONS])) { |
|
281 | + if (!empty($this->manifest['mvc'][MVC_OPTIONS])) { |
|
282 | 282 | foreach ($this->manifest['mvc'][MVC_OPTIONS] as $pageName => $pageOptions) { |
283 | - if(empty($pageOptions)) { |
|
283 | + if (empty($pageOptions)) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 |