@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
5 | +if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
6 | 6 | message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10); |
7 | 7 | die(); |
8 | 8 | } |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | |
15 | 15 | $mode = sys_get_param_str('mode'); |
16 | 16 | |
17 | -if($mode == 'ainfo') { |
|
17 | +if ($mode == 'ainfo') { |
|
18 | 18 | include('includes/alliance/ali_info.inc'); |
19 | 19 | } |
20 | 20 | |
21 | -if(!$user['ally_id']) { |
|
21 | +if (!$user['ally_id']) { |
|
22 | 22 | $user_request = db_ally_request_get_by_user_id($user['id']); |
23 | - if($user_request['id_user']) { |
|
23 | + if ($user_request['id_user']) { |
|
24 | 24 | require('includes/alliance/ali_external_request.inc'); |
25 | 25 | } else { |
26 | - switch($mode) { |
|
26 | + switch ($mode) { |
|
27 | 27 | case 'search': |
28 | 28 | require('includes/alliance/ali_external_search.inc'); |
29 | 29 | break; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | sn_ali_fill_user_ally($user); |
47 | -if(!isset($user['ally'])) { |
|
47 | +if (!isset($user['ally'])) { |
|
48 | 48 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
49 | 49 | message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['your_alliance'], 'alliance.php'); |
50 | 50 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | |
73 | 73 | // This piece converting old ally data to new one |
74 | 74 | // unset($ally['ranklist']); |
75 | -if(!$ally['ranklist'] && $ally['ally_ranks']) { |
|
75 | +if (!$ally['ranklist'] && $ally['ally_ranks']) { |
|
76 | 76 | $ally_ranks = unserialize($ally['ally_ranks']); |
77 | 77 | $i = 0; |
78 | - foreach($ally_ranks as $rank_id => $rank) { |
|
79 | - foreach($ally_rights as $key => $value) { |
|
78 | + foreach ($ally_ranks as $rank_id => $rank) { |
|
79 | + foreach ($ally_rights as $key => $value) { |
|
80 | 80 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
81 | 81 | } |
82 | 82 | db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
83 | 83 | $i++; |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($ranks)) { |
|
86 | + if (!empty($ranks)) { |
|
87 | 87 | ali_rank_list_save($ranks); |
88 | 88 | } |
89 | 89 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | |
102 | 102 | $edit = sys_get_param_str('edit'); |
103 | 103 | ally_pre_call(); |
104 | -switch($mode) { |
|
104 | +switch ($mode) { |
|
105 | 105 | case 'admin': |
106 | - if(!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
106 | + if (!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
107 | 107 | $edit = 'default'; |
108 | 108 | } |
109 | - if($sn_ali_admin_internal[$edit]['include']) { |
|
109 | + if ($sn_ali_admin_internal[$edit]['include']) { |
|
110 | 110 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
111 | 111 | } |
112 | - if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
112 | + if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
113 | 113 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
114 | 114 | } |
115 | 115 | break; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $result = array(); |
80 | 80 | |
81 | -switch($mode = sys_get_param_str('mode')) { |
|
81 | +switch ($mode = sys_get_param_str('mode')) { |
|
82 | 82 | case 'manage': |
83 | 83 | sn_sys_sector_buy('overview.php?mode=manage'); |
84 | 84 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $template = gettemplate('planet_manage', true); |
89 | 89 | $planet_id = sys_get_param_id('planet_id'); |
90 | 90 | |
91 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
91 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
92 | 92 | $planetrow['name'] = $new_name; |
93 | 93 | // $new_name = db_escape($new_name); |
94 | 94 | db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name}'"); |
95 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
95 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
96 | 96 | try { |
97 | 97 | sn_db_transaction_start(); |
98 | 98 | $user = db_user_by_id($user['id'], true, '*'); |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | // $user = $global_data['user']; |
102 | 102 | // $planetrow = $global_data['planet']; |
103 | 103 | |
104 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
104 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
105 | 105 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
106 | 106 | } |
107 | 107 | |
108 | - if($planetrow['id'] == $user['id_planet']) { |
|
108 | + if ($planetrow['id'] == $user['id_planet']) { |
|
109 | 109 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
110 | 110 | } |
111 | 111 | |
112 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
112 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
113 | 113 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
114 | 114 | } |
115 | 115 | |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | ); |
127 | 127 | sn_db_transaction_commit(); |
128 | 128 | sys_redirect('overview.php?mode=manage'); |
129 | - } catch(exception $e) { |
|
129 | + } catch (exception $e) { |
|
130 | 130 | sn_db_transaction_rollback(); |
131 | 131 | $result[] = array( |
132 | 132 | 'STATUS' => $e->getCode(), |
133 | 133 | 'MESSAGE' => $e->getMessage(), |
134 | 134 | ); |
135 | 135 | } |
136 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
136 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
137 | 137 | try { |
138 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
138 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
139 | 139 | 'galaxy' => sys_get_param_int('new_galaxy'), |
140 | 140 | 'system' => sys_get_param_int('new_system'), |
141 | 141 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // $planetrow = $global_data['planet']; |
153 | 153 | |
154 | 154 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
155 | - if($can_teleport['result'] != ERR_NONE) { |
|
155 | + if ($can_teleport['result'] != ERR_NONE) { |
|
156 | 156 | throw new exception($can_teleport['message'], $can_teleport['result']); |
157 | 157 | } |
158 | 158 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | db_planet_set_by_gspt($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], PT_ALL, |
164 | 164 | "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}, planet_teleport_next = {$planet_teleport_next}"); |
165 | 165 | |
166 | - if($planetrow['id'] == $user['id_planet']) { |
|
166 | + if ($planetrow['id'] == $user['id_planet']) { |
|
167 | 167 | db_user_set_by_id($user['id'], "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}"); |
168 | 168 | } |
169 | 169 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
177 | 177 | ); |
178 | 178 | sys_redirect('overview.php?mode=manage'); |
179 | - } catch(exception $e) { |
|
179 | + } catch (exception $e) { |
|
180 | 180 | sn_db_transaction_rollback(); |
181 | 181 | $result[] = array( |
182 | 182 | 'STATUS' => $e->getCode(), |
183 | 183 | 'MESSAGE' => $e->getMessage(), |
184 | 184 | ); |
185 | 185 | } |
186 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
186 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
187 | 187 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
188 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
188 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
190 | 190 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
191 | 191 | db_planet_set_by_id($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
192 | 192 | db_planet_set_by_parent($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
197 | 197 | } |
198 | 198 | } else { |
199 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
199 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
200 | 200 | } |
201 | - } elseif( |
|
201 | + } elseif ( |
|
202 | 202 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
203 | 203 | && ( |
204 | 204 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $user = db_user_by_id($user['id'], true); |
214 | 214 | $planetrow = db_planet_by_id($planetrow['id'], true); |
215 | 215 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
216 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
217 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
216 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
217 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
218 | 218 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
219 | 219 | $query = '`PLANET_GOVERNOR_LEVEL` + 1'; |
220 | 220 | } else { |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | |
241 | 241 | lng_include('mrc_mercenary'); |
242 | 242 | int_planet_pretemplate($planetrow, $template); |
243 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
244 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
243 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
244 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
245 | 245 | continue; |
246 | 246 | } |
247 | 247 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
294 | 294 | )); |
295 | 295 | |
296 | - foreach($result as &$a_result) { |
|
296 | + foreach ($result as &$a_result) { |
|
297 | 297 | $template->assign_block_vars('result', $a_result); |
298 | 298 | } |
299 | 299 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | default: |
304 | 304 | sn_sys_sector_buy(); |
305 | 305 | |
306 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
306 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
307 | 307 | $planetrow['name'] = $new_name; |
308 | 308 | $new_name_safe = db_escape($new_name); |
309 | 309 | db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name_safe}'"); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $planet_count = 0; |
335 | 335 | $planets_query = db_planet_list_sorted($user, false, '*'); |
336 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
336 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
337 | 337 | sn_db_transaction_start(); |
338 | 338 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
339 | 339 | sn_db_transaction_commit(); |
@@ -344,16 +344,16 @@ discard block |
||
344 | 344 | |
345 | 345 | $planet_fleet_id = 0; |
346 | 346 | $fleet_list = $template_planet['fleet_list']; |
347 | - if($fleet_list['own']['count']) { |
|
347 | + if ($fleet_list['own']['count']) { |
|
348 | 348 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
349 | 349 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
350 | 350 | // $fleet_id++;tpl_parse_fleet_sn |
351 | 351 | } |
352 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
352 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | $moon = db_planet_by_parent($UserPlanet['id']); |
356 | - if($moon) { |
|
356 | + if ($moon) { |
|
357 | 357 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
358 | 358 | } else { |
359 | 359 | $moon_fill = 0; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | tpl_assign_fleet($template, $fleets); |
394 | 394 | |
395 | 395 | $lune = $planetrow['planet_type'] == PT_PLANET ? db_planet_by_parent($planetrow['id']) : db_planet_by_id($planetrow['parent_planet']); |
396 | - if($lune) { |
|
396 | + if ($lune) { |
|
397 | 397 | $template->assign_vars(array( |
398 | 398 | 'MOON_ID' => $lune['id'], |
399 | 399 | 'MOON_IMG' => $lune['image'], |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
406 | 406 | |
407 | 407 | $planet_recyclers_orbiting = 0; |
408 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
408 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
409 | 409 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
410 | 410 | } |
411 | 411 | |
412 | 412 | int_planet_pretemplate($planetrow, $template); |
413 | 413 | |
414 | 414 | $sn_group_ques = sn_get_groups('ques'); |
415 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
415 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
417 | 417 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
418 | 418 | $template->assign_block_vars('ques', array( |
419 | 419 | 'ID' => $que_id, |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
422 | 422 | )); |
423 | 423 | |
424 | - if(!empty($this_que)) { |
|
425 | - foreach($this_que as $que_item) { |
|
424 | + if (!empty($this_que)) { |
|
425 | + foreach ($this_que as $que_item) { |
|
426 | 426 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
427 | 427 | } |
428 | 428 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'LENGTH' => $que_hangar_length, |
437 | 437 | )); |
438 | 438 | |
439 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
439 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
440 | 440 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
441 | 441 | $template->assign_block_vars('ques', array( |
442 | 442 | 'ID' => SUBQUE_DEFENSE, |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
449 | 449 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
450 | 450 | |
451 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
451 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
452 | 452 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
453 | 453 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
454 | 454 | } |
455 | 455 | |
456 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
456 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
457 | 457 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
458 | 458 | } |
459 | 459 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | )); |
511 | 511 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
512 | 512 | |
513 | - foreach($result as &$a_result) { |
|
513 | + foreach ($result as &$a_result) { |
|
514 | 514 | $template->assign_block_vars('result', $a_result); |
515 | 515 | } |
516 | 516 |
@@ -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 = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
7 | 7 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
8 | 8 | ); |
9 | 9 | |
10 | - if($error_message) { |
|
10 | + if ($error_message) { |
|
11 | 11 | message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10); |
12 | 12 | die(); |
13 | 13 | } |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
17 | 17 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
18 | 18 | |
19 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
19 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
20 | 20 | sn_db_transaction_start(); |
21 | 21 | $user = db_user_by_id($user['id'], true); |
22 | 22 | $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round); |
23 | - if(sys_get_param_str('register_me')) { |
|
24 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
23 | + if (sys_get_param_str('register_me')) { |
|
24 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
25 | 25 | db_blitz_reg_insert($user, $current_round); |
26 | 26 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
27 | 27 | } |
28 | - } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
28 | + } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
29 | 29 | db_blitz_reg_delete($user, $current_round); |
30 | 30 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица"); |
31 | 31 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $blitz_players = 0; |
41 | 41 | $blitz_prize_dark_matter = 0; |
42 | 42 | $blitz_prize_places = 0; |
43 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
44 | - if(sys_get_param_str('generate')) { |
|
43 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
44 | + if (sys_get_param_str('generate')) { |
|
45 | 45 | $next_id = 0; |
46 | 46 | $query = db_blitz_reg_get_random_id($current_round); |
47 | - while($row = db_fetch($query)) { |
|
47 | + while ($row = db_fetch($query)) { |
|
48 | 48 | $next_id++; |
49 | 49 | $blitz_name = 'Игрок' . $next_id; |
50 | 50 | $blitz_password = sys_random_string(8); |
51 | 51 | db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row, $current_round); |
52 | 52 | } |
53 | - } elseif(sys_get_param_str('import_generated')) { |
|
53 | + } elseif (sys_get_param_str('import_generated')) { |
|
54 | 54 | // ЭТО НА БЛИЦЕ!!! |
55 | 55 | db_player_list_blitz_delete_players(); |
56 | 56 | db_planets_purge(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $system = $system_step; |
73 | 73 | $planet = round(classSupernova::$config->game_maxPlanet / 2); |
74 | 74 | |
75 | - foreach($imported_string as &$string_data) { |
|
75 | + foreach ($imported_string as &$string_data) { |
|
76 | 76 | $string_data = explode(',', $string_data); |
77 | 77 | $username_safe = $string_data[0]; |
78 | 78 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false); |
94 | 94 | |
95 | - if(($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
95 | + if (($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
96 | 96 | $galaxy++; |
97 | 97 | $system = $system_step; |
98 | 98 | } |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
103 | 103 | // pdump($imported_string); |
104 | 104 | // generated_string |
105 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
105 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
106 | 106 | $blitz_result = explode(';', $blitz_result_string); |
107 | 107 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
108 | 108 | unset($blitz_result[0]); |
109 | - foreach($blitz_result as $blitz_result_data) { |
|
109 | + foreach ($blitz_result as $blitz_result_data) { |
|
110 | 110 | $blitz_result_data = explode(',', $blitz_result_data); |
111 | - if(count($blitz_result_data) == 5) { |
|
111 | + if (count($blitz_result_data) == 5) { |
|
112 | 112 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
113 | 113 | db_blitz_reg_update_results($blitz_result_data, $current_round); |
114 | 114 | } |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $blitz_result = array(); |
117 | 117 | } |
118 | 118 | |
119 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
119 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
120 | 120 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
121 | 121 | $query = db_player_list_export_blitz_info(); |
122 | - while($row = db_fetch($query)) { |
|
122 | + while ($row = db_fetch($query)) { |
|
123 | 123 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
124 | 124 | } |
125 | 125 | } else { |
126 | 126 | $query = db_blitz_reg_get_player_list($current_round); |
127 | - while($row = db_fetch($query)) { |
|
127 | + while ($row = db_fetch($query)) { |
|
128 | 128 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
129 | 129 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
130 | 130 | $blitz_players++; |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | $blitz_prize_dark_matter = $blitz_prize_players_active * 20000; |
133 | 133 | $blitz_prize_places = ceil($blitz_prize_players_active / 5); |
134 | 134 | |
135 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
135 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
136 | 136 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
137 | 137 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
138 | 138 | sn_db_transaction_start(); |
139 | 139 | $query = db_blitz_reg_get_player_list_order_by_place($current_round); |
140 | - while($row = db_fetch($query)) { |
|
141 | - if(!$row['blitz_place']) { |
|
140 | + while ($row = db_fetch($query)) { |
|
141 | + if (!$row['blitz_place']) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | |
148 | 148 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
149 | 149 | pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
150 | - if($reward) { |
|
150 | + if ($reward) { |
|
151 | 151 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
152 | 152 | classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
153 | 153 | )); |
154 | 154 | db_blitz_reg_update_apply_results($reward, $row, $current_round); |
155 | 155 | } |
156 | 156 | |
157 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
157 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
158 | 158 | break; |
159 | 159 | } |
160 | 160 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | |
170 | 170 | $player_registered = false; |
171 | 171 | $query = db_blitz_reg_get_player_list_and_users($current_round); |
172 | -while($row = db_fetch($query)) { |
|
172 | +while ($row = db_fetch($query)) { |
|
173 | 173 | $tpl_player_data = array( |
174 | 174 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
175 | 175 | ); |
176 | 176 | |
177 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
177 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
178 | 178 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
179 | 179 | $tpl_player_data = array_merge($tpl_player_data, array( |
180 | 180 | 'ID' => $row['id'], |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $template->assign_block_vars('registrations', $tpl_player_data); |
190 | - if($row['id'] == $user['id']) { |
|
190 | + if ($row['id'] == $user['id']) { |
|
191 | 191 | $player_registered = $row; |
192 | 192 | } |
193 | 193 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | 11 | |
12 | -define('INSIDE' , true); |
|
13 | -define('INSTALL' , false); |
|
12 | +define('INSIDE', true); |
|
13 | +define('INSTALL', false); |
|
14 | 14 | define('IN_ADMIN', true); |
15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | 17 | // if($user['authlevel'] < 1) |
18 | -if($user['authlevel'] < 3) |
|
18 | +if ($user['authlevel'] < 3) |
|
19 | 19 | { |
20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
21 | 21 | } |
22 | 22 | |
23 | -if(SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
23 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
24 | 24 | { |
25 | 25 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
26 | 26 |
@@ -8,18 +8,18 @@ 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 | |
16 | -if($user['authlevel'] < 3) { |
|
16 | +if ($user['authlevel'] < 3) { |
|
17 | 17 | AdminMessage(classLocale::$lang['adm_err_denied']); |
18 | 18 | } |
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 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
101 | 101 | db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | 'STATS_HIDE_PM_LINK' => classSupernova::$config->stats_hide_pm_link, |
139 | 139 | )); |
140 | 140 | |
141 | -foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
141 | +foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
142 | 142 | $template->assign_block_vars('sys_game_disable_reason', array( |
143 | 143 | 'ID' => $id, |
144 | 144 | 'NAME' => $name, |
145 | 145 | )); |
146 | 146 | } |
147 | 147 | |
148 | -foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
148 | +foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
149 | 149 | $template->assign_block_vars('game_modes', array( |
150 | 150 | 'ID' => $mode_id, |
151 | 151 | 'NAME' => $mode_name, |
152 | 152 | )); |
153 | 153 | } |
154 | 154 | |
155 | -foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
155 | +foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
156 | 156 | $template->assign_block_vars('ver_response', array( |
157 | 157 | 'ID' => $ver_id, |
158 | 158 | 'NAME' => js_safe_string($ver_response), |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $lang_list = lng_get_list(); |
163 | -foreach($lang_list as $lang_id => $lang_data) { |
|
163 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
164 | 164 | $template->assign_block_vars('game_languages', array( |
165 | 165 | 'ID' => $lang_id, |
166 | 166 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | . '&key=' . urlencode(classSupernova::$config->server_updater_key) |
13 | 13 | . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
14 | 14 | |
15 | -switch($mode) { |
|
15 | +switch ($mode) { |
|
16 | 16 | case SNC_MODE_REGISTER: |
17 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | - if($ajax) { |
|
17 | + if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
18 | + if ($ajax) { |
|
19 | 19 | print(SNC_VER_REGISTER_ERROR_REGISTERED); |
20 | 20 | } |
21 | 21 | die(); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $check_result = sn_get_url_contents($url); |
28 | -if(!$check_result) { |
|
28 | +if (!$check_result) { |
|
29 | 29 | $version_check = SNC_VER_ERROR_CONNECT; |
30 | -} elseif(($version_check = intval($check_result)) && $version_check == $check_result) { |
|
30 | +} elseif (($version_check = intval($check_result)) && $version_check == $check_result) { |
|
31 | 31 | $version_check = $check_result; |
32 | 32 | } else { |
33 | 33 | // JSON decode if string |
34 | 34 | $check_result = json_decode($check_result, true); |
35 | 35 | $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check']; |
36 | 36 | |
37 | - switch($mode) { |
|
37 | + switch ($mode) { |
|
38 | 38 | case SNC_MODE_REGISTER: |
39 | - if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
39 | + if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
40 | 40 | classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']); |
41 | 41 | classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']); |
42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW); |
50 | 50 | classSupernova::$config->db_saveItem('server_updater_check_result', $version_check); |
51 | 51 | |
52 | -if($ajax) { |
|
52 | +if ($ajax) { |
|
53 | 53 | define('IN_AJAX', true); |
54 | 54 | print($version_check); |
55 | 55 | } |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | protected static $cacheObject; |
47 | 47 | |
48 | 48 | public function __construct($prefIn = 'CACHE_', $init_mode = false) { |
49 | - if(!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) { |
|
49 | + if (!($init_mode === false || $init_mode === CACHER_NO_CACHE || ($init_mode === CACHER_XCACHE && extension_loaded('xcache')))) { |
|
50 | 50 | throw new UnexpectedValueException('Wrong work mode or current mode does not supported on your server'); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $this->prefix = $prefIn; |
54 | - if(extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) { |
|
55 | - if(self::$mode === CACHER_NOT_INIT) { |
|
54 | + if (extension_loaded('xcache') && ($init_mode === CACHER_XCACHE || $init_mode === false)) { |
|
55 | + if (self::$mode === CACHER_NOT_INIT) { |
|
56 | 56 | self::$mode = CACHER_XCACHE; |
57 | 57 | } |
58 | 58 | } else { |
59 | - if(self::$mode === CACHER_NOT_INIT) { |
|
59 | + if (self::$mode === CACHER_NOT_INIT) { |
|
60 | 60 | self::$mode = CACHER_NO_CACHE; |
61 | - if(!self::$data) { |
|
61 | + if (!self::$data) { |
|
62 | 62 | self::$data = array(); |
63 | 63 | } |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function getInstance($prefIn = 'CACHE_', $table_name = '') { |
69 | - if(!isset(self::$cacheObject)) { |
|
69 | + if (!isset(self::$cacheObject)) { |
|
70 | 70 | $className = get_class(); |
71 | 71 | self::$cacheObject = new $className($prefIn); |
72 | 72 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // Here comes low-level functions - those that directly works with cacher engines |
84 | 84 | // ------------------------------------------------------------------------- |
85 | 85 | public function __set($name, $value) { |
86 | - switch($name) { |
|
86 | + switch ($name) { |
|
87 | 87 | case '_MODE': |
88 | 88 | throw new UnexpectedValueException('You can not change cacher mode on-the-fly!'); |
89 | 89 | break; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | break; |
94 | 94 | |
95 | 95 | default: |
96 | - switch(self::$mode) { |
|
96 | + switch (self::$mode) { |
|
97 | 97 | case CACHER_NO_CACHE: |
98 | 98 | self::$data[$this->prefix . $name] = $value; |
99 | 99 | break; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | public function __get($name) { |
110 | - switch($name) { |
|
110 | + switch ($name) { |
|
111 | 111 | case '_MODE': |
112 | 112 | return self::$mode; |
113 | 113 | break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | break; |
118 | 118 | |
119 | 119 | default: |
120 | - switch(self::$mode) { |
|
120 | + switch (self::$mode) { |
|
121 | 121 | case CACHER_NO_CACHE: |
122 | 122 | return self::$data[$this->prefix . $name]; |
123 | 123 | break; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | public function __isset($name) { |
137 | - switch(self::$mode) { |
|
137 | + switch (self::$mode) { |
|
138 | 138 | case CACHER_NO_CACHE: |
139 | 139 | return isset(self::$data[$this->prefix . $name]); |
140 | 140 | break; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | public function __unset($name) { |
151 | - switch(self::$mode) { |
|
151 | + switch (self::$mode) { |
|
152 | 152 | case CACHER_NO_CACHE: |
153 | 153 | unset(self::$data[$this->prefix . $name]); |
154 | 154 | break; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | public function unset_by_prefix($prefix_unset = '') { |
163 | 163 | static $array_clear; |
164 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
164 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
165 | 165 | strpos($k, $p) === 0 ? $v = null : false; |
166 | 166 | } : false; |
167 | 167 | |
168 | - switch(self::$mode) { |
|
168 | + switch (self::$mode) { |
|
169 | 169 | case CACHER_NO_CACHE: |
170 | 170 | // array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset); |
171 | 171 | array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | break; |
175 | 175 | |
176 | 176 | case CACHER_XCACHE: |
177 | - if(!function_exists('xcache_unset_by_prefix')) { |
|
177 | + if (!function_exists('xcache_unset_by_prefix')) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | protected function make_element_name($args, $diff = 0) { |
192 | 192 | $num_args = count($args); |
193 | 193 | |
194 | - if($num_args < 1) { |
|
194 | + if ($num_args < 1) { |
|
195 | 195 | return false; |
196 | 196 | } |
197 | 197 | |
198 | 198 | $name = ''; |
199 | 199 | $aName = array(); |
200 | - for($i = 0; $i <= $num_args - 1 - $diff; $i++) { |
|
200 | + for ($i = 0; $i <= $num_args - 1 - $diff; $i++) { |
|
201 | 201 | $name .= "[{$args[$i]}]"; |
202 | 202 | array_unshift($aName, $name); |
203 | 203 | } |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | $args = func_get_args(); |
210 | 210 | $name = $this->make_element_name($args, 1); |
211 | 211 | |
212 | - if(!$name) { |
|
212 | + if (!$name) { |
|
213 | 213 | return null; |
214 | 214 | } |
215 | 215 | |
216 | - if($this->$name[0] === null) { |
|
217 | - for($i = count($name) - 1; $i > 0; $i--) { |
|
216 | + if ($this->$name[0] === null) { |
|
217 | + for ($i = count($name) - 1; $i > 0; $i--) { |
|
218 | 218 | $cName = "{$name[$i]}_COUNT"; |
219 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
220 | - if($this->$cName1 == null || $i == 1) { |
|
219 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
220 | + if ($this->$cName1 == null || $i == 1) { |
|
221 | 221 | $this->$cName++; |
222 | 222 | } |
223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | public function array_get() { |
232 | 232 | $name = $this->make_element_name(func_get_args()); |
233 | - if(!$name) { |
|
233 | + if (!$name) { |
|
234 | 234 | return null; |
235 | 235 | } |
236 | 236 | |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | |
240 | 240 | public function array_count() { |
241 | 241 | $name = $this->make_element_name(func_get_args()); |
242 | - if(!$name) { |
|
242 | + if (!$name) { |
|
243 | 243 | return 0; |
244 | 244 | } |
245 | 245 | $cName = "{$name[0]}_COUNT"; |
246 | 246 | $retVal = $this->$cName; |
247 | - if(!$retVal) { |
|
247 | + if (!$retVal) { |
|
248 | 248 | $retVal = null; |
249 | 249 | } |
250 | 250 | |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | public function array_unset() { |
255 | 255 | $name = $this->make_element_name(func_get_args()); |
256 | 256 | |
257 | - if(!$name) { |
|
257 | + if (!$name) { |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | $this->unset_by_prefix($name[0]); |
261 | 261 | |
262 | - for($i = 1; $i < count($name); $i++) { |
|
262 | + for ($i = 1; $i < count($name); $i++) { |
|
263 | 263 | $cName = "{$name[$i]}_COUNT"; |
264 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
264 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
265 | 265 | |
266 | - if($i == 1 || $this->$cName1 === null) { |
|
266 | + if ($i == 1 || $this->$cName1 === null) { |
|
267 | 267 | $this->$cName--; |
268 | - if($this->$cName <= 0) { |
|
268 | + if ($this->$cName <= 0) { |
|
269 | 269 | unset($this->$cName); |
270 | 270 | } |
271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | public function dumpData() { |
278 | - switch(self::$mode) { |
|
278 | + switch (self::$mode) { |
|
279 | 279 | case CACHER_NO_CACHE: |
280 | 280 | return dump(self::$data, $this->prefix); |
281 | 281 | break; |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | $this->sql_index_field = "{$table_name}_name"; |
327 | 327 | $this->sql_value_field = "{$table_name}_value"; |
328 | 328 | |
329 | - if(!$this->_DB_LOADED) { |
|
329 | + if (!$this->_DB_LOADED) { |
|
330 | 330 | $this->db_loadAll(); |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | 334 | public static function getInstance($gamePrefix = 'sn_', $table_name = '') { |
335 | - if(!isset(self::$cacheObject)) { |
|
335 | + if (!isset(self::$cacheObject)) { |
|
336 | 336 | $className = get_class(); |
337 | 337 | self::$cacheObject = new $className($gamePrefix, $table_name); |
338 | 338 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | public function db_loadItem($index) { |
344 | 344 | $result = null; |
345 | - if($index) { |
|
345 | + if ($index) { |
|
346 | 346 | $index_safe = db_escape($index); |
347 | 347 | $result = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true); |
348 | 348 | // В две строки - что бы быть уверенным в порядке выполнения |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $this->loadDefaults(); |
358 | 358 | |
359 | 359 | $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;"); |
360 | - while($row = db_fetch($query)) { |
|
360 | + while ($row = db_fetch($query)) { |
|
361 | 361 | $this->$row[$this->sql_index_field] = $row[$this->sql_value_field]; |
362 | 362 | } |
363 | 363 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | public function loadDefaults() { |
368 | - foreach($this->defaults as $defName => $defValue) { |
|
368 | + foreach ($this->defaults as $defName => $defValue) { |
|
369 | 369 | $this->$defName = $defValue; |
370 | 370 | } |
371 | 371 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | public function db_saveItem($item_list, $value = null) { |
384 | - if(empty($item_list)) { |
|
384 | + if (empty($item_list)) { |
|
385 | 385 | return; |
386 | 386 | } |
387 | 387 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | |
390 | 390 | // Сначала записываем данные в базу - что бы поймать все блокировки |
391 | 391 | $qry = array(); |
392 | - foreach($item_list as $item_name => $item_value) { |
|
393 | - if($item_name) { |
|
392 | + foreach ($item_list as $item_name => $item_value) { |
|
393 | + if ($item_name) { |
|
394 | 394 | $item_value = db_escape($item_value === null ? $this->$item_name : $item_value); |
395 | 395 | $item_name = db_escape($item_name); |
396 | 396 | $qry[] = "('{$item_name}', '{$item_value}')"; |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
400 | 400 | |
401 | 401 | // И только после взятия блокировок - меняем значения в кэше |
402 | - foreach($item_list as $item_name => $item_value) { |
|
403 | - if($item_name && $item_value !== null) { |
|
402 | + foreach ($item_list as $item_name => $item_value) { |
|
403 | + if ($item_name && $item_value !== null) { |
|
404 | 404 | $this->$item_name = $item_value; |
405 | 405 | } |
406 | 406 | } |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
588 | 588 | |
589 | 589 | // Alliance bonus calculations |
590 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
590 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
591 | 591 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
592 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
592 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
593 | 593 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
594 | 594 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
595 | 595 | |
@@ -620,25 +620,25 @@ discard block |
||
620 | 620 | 'deuterium_basic_income' => 0, |
621 | 621 | 'eco_scale_storage' => 1, |
622 | 622 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
623 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
623 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
624 | 624 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
625 | 625 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
626 | 626 | 'energy_basic_income' => 0, |
627 | 627 | |
628 | 628 | // Bashing protection settings |
629 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
630 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
631 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
632 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
633 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
629 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
630 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
631 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
632 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
633 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
634 | 634 | |
635 | 635 | 'Fleet_Cdr' => 30, |
636 | 636 | 'fleet_speed' => 1, |
637 | 637 | |
638 | 638 | 'fleet_update_interval' => 4, |
639 | 639 | |
640 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
641 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
640 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
641 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
642 | 642 | // Defaults |
643 | 643 | 'game_default_language' => 'ru', |
644 | 644 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -652,13 +652,13 @@ discard block |
||
652 | 652 | 'game_maxSystem' => 199, |
653 | 653 | 'game_maxPlanet' => 15, |
654 | 654 | // Game global settings |
655 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
655 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
656 | 656 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
657 | 657 | |
658 | 658 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
659 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
659 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
660 | 660 | // Noob protection |
661 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
661 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
662 | 662 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
663 | 663 | |
664 | 664 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | 'payment_currency_exchange_wmu' => 30, |
708 | 708 | 'payment_currency_exchange_wmz' => 1, |
709 | 709 | |
710 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
711 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
710 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
711 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
712 | 712 | |
713 | 713 | 'planet_teleport_cost' => 50000, // |
714 | 714 | 'planet_teleport_timeout' => 86400, // |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | 'resource_multiplier' => 1, |
727 | 727 | |
728 | 728 | //Roleplay system |
729 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
729 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
730 | 730 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
731 | 731 | |
732 | 732 | // Black Market - General |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | public static function getInstance($gamePrefix = 'sn_', $table_name = 'config') { |
816 | - if(!isset(self::$cacheObject)) { |
|
816 | + if (!isset(self::$cacheObject)) { |
|
817 | 817 | $className = get_class(); |
818 | 818 | self::$cacheObject = new $className($gamePrefix, $table_name); |
819 | 819 | } |
@@ -2,19 +2,19 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
5 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
6 | 6 | include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
7 | 7 | } |
8 | 8 | |
9 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
9 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
10 | 10 | require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
11 | 11 | sn_user_birthday_celebrate(); |
12 | 12 | } |
13 | 13 | |
14 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
14 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
15 | 15 | classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
16 | 16 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
17 | - if(classSupernova::$config->server_log_online) { |
|
17 | + if (classSupernova::$config->server_log_online) { |
|
18 | 18 | db_log_online_insert(); |
19 | 19 | } |
20 | 20 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
42 | 42 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
43 | 43 | |
44 | -if(!empty($user['id'])) { |
|
44 | +if (!empty($user['id'])) { |
|
45 | 45 | classSupernova::$user_options->user_change($user['id']); |
46 | 46 | } |
47 | 47 | |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | : false |
55 | 55 | ); |
56 | 56 | |
57 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | - $prohibited_characters = array_map(function ($value) { |
|
57 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | + $prohibited_characters = array_map(function($value) { |
|
59 | 59 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
60 | 60 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
61 | 61 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
65 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
66 | 66 | pdump("Отключи отладку перед продакшном!"); |
67 | 67 | } |
68 | 68 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
77 | 77 | : false; |
78 | 78 | |
79 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
79 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
80 | 80 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
81 | 81 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
82 | 82 | ? classSupernova::$config->game_disable_reason |
83 | 83 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
84 | 84 | ); |
85 | - if(defined('IN_API')) { |
|
85 | + if (defined('IN_API')) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if( |
|
89 | + if ( |
|
90 | 90 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
91 | 91 | && |
92 | 92 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | // TODO ban |
102 | 102 | // TODO $skip_ban_check |
103 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | - if(defined('IN_API')) { |
|
103 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | + if (defined('IN_API')) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | // pdump($allow_anonymous, '$allow_anonymous'); |
120 | 120 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
121 | 121 | |
122 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
122 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
123 | 123 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
124 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
124 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
125 | 125 | // pdump($sn_page_name); |
126 | 126 | // pdump(INITIAL_PAGE); |
127 | 127 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
128 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
128 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
129 | 129 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
130 | 130 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
131 | 131 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | global $skip_fleet_update; |
148 | 148 | $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); |
149 | -if( |
|
149 | +if ( |
|
150 | 150 | !$skip_fleet_update |
151 | 151 | && !(defined('IN_AJAX') && IN_AJAX === true) |
152 | 152 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | flt_flying_fleet_handler($skip_fleet_update); |
156 | 156 | } |
157 | 157 | |
158 | -if(!defined('IN_AJAX')) { |
|
158 | +if (!defined('IN_AJAX')) { |
|
159 | 159 | print("Scheduled processes is disabled<br />"); |
160 | 160 | } |
161 | 161 | // scheduler_process(); |
@@ -73,23 +73,23 @@ discard block |
||
73 | 73 | function sn_db_connect($external_db_settings = null) { |
74 | 74 | $this->db_disconnect(); |
75 | 75 | |
76 | - if(!empty($external_db_settings) && is_array($external_db_settings)) { |
|
76 | + if (!empty($external_db_settings) && is_array($external_db_settings)) { |
|
77 | 77 | $this->dbsettings = $external_db_settings; |
78 | 78 | } |
79 | 79 | |
80 | - if(empty($this->dbsettings)) { |
|
80 | + if (empty($this->dbsettings)) { |
|
81 | 81 | $this->load_db_settings(); |
82 | 82 | } |
83 | 83 | |
84 | 84 | // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны |
85 | - if(!empty($this->dbsettings)) { |
|
85 | + if (!empty($this->dbsettings)) { |
|
86 | 86 | $driver_name = empty($this->dbsettings['sn_driver']) ? 'db_mysql_v5' : $this->dbsettings['sn_driver']; |
87 | 87 | $this->driver = new $driver_name(); |
88 | 88 | $this->db_prefix = $this->dbsettings['prefix']; |
89 | 89 | |
90 | 90 | $this->connected = $this->connected || $this->driver_connect(); |
91 | 91 | |
92 | - if($this->connected) { |
|
92 | + if ($this->connected) { |
|
93 | 93 | $this->table_list = $this->db_get_table_list(); |
94 | 94 | // TODO Проверка на пустоту |
95 | 95 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | function driver_connect() { |
104 | 104 | global $debug; |
105 | 105 | |
106 | - if(!is_object($this->driver)) { |
|
106 | + if (!is_object($this->driver)) { |
|
107 | 107 | $debug->error_fatal('DB Error - No driver for MySQL found!'); |
108 | 108 | } |
109 | 109 | |
110 | - if(!method_exists($this->driver, 'mysql_connect')) { |
|
110 | + if (!method_exists($this->driver, 'mysql_connect')) { |
|
111 | 111 | $debug->error_fatal('DB Error - WRONG MySQL driver!'); |
112 | 112 | } |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | function db_disconnect() { |
118 | - if($this->connected) { |
|
118 | + if ($this->connected) { |
|
119 | 119 | $this->connected = !$this->driver_disconnect(); |
120 | 120 | $this->connected = false; |
121 | 121 | } |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function replaceTablePlaceholders($query) { |
132 | 132 | $sql = $query; |
133 | - if(strpos($sql, '{{') !== false) { |
|
134 | - foreach($this->table_list as $tableName) { |
|
133 | + if (strpos($sql, '{{') !== false) { |
|
134 | + foreach ($this->table_list as $tableName) { |
|
135 | 135 | $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
136 | 136 | } |
137 | 137 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param $fetch |
145 | 145 | */ |
146 | 146 | public function logQuery($query, $fetch) { |
147 | - if(!classSupernova::$config->debug) { |
|
147 | + if (!classSupernova::$config->debug) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * @return void |
163 | 163 | */ |
164 | 164 | public function commentQuery(&$sql) { |
165 | - if(!defined('DEBUG_SQL_COMMENT')) { |
|
165 | + if (!defined('DEBUG_SQL_COMMENT')) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | $backtrace = debug_backtrace(); |
169 | 169 | $sql_comment = classSupernova::$debug->compact_backtrace($backtrace, defined('DEBUG_SQL_COMMENT_LONG')); |
170 | 170 | |
171 | 171 | $sql_commented = '/* ' . implode("<br />", $sql_comment) . '<br /> */ ' . preg_replace("/\s+/", ' ', $sql); |
172 | - if(defined('DEBUG_SQL_ONLINE')) { |
|
172 | + if (defined('DEBUG_SQL_ONLINE')) { |
|
173 | 173 | classSupernova::$debug->warning($sql_commented, 'SQL Debug', LOG_DEBUG_SQL); |
174 | 174 | } |
175 | 175 | |
176 | - if(defined('DEBUG_SQL_ERROR')) { |
|
176 | + if (defined('DEBUG_SQL_ERROR')) { |
|
177 | 177 | array_unshift($sql_comment, preg_replace("/\s+/", ' ', $sql)); |
178 | 178 | classSupernova::$debug->add_to_array($sql_comment); |
179 | 179 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | public function doquery($query, $table = '', $fetch = false, $skip_query_check = false) { |
185 | - if(!is_string($table)) { |
|
185 | + if (!is_string($table)) { |
|
186 | 186 | $fetch = $table; |
187 | 187 | } |
188 | 188 | |
189 | - if(!$this->connected) { |
|
189 | + if (!$this->connected) { |
|
190 | 190 | $this->sn_db_connect(); |
191 | 191 | } |
192 | 192 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | function security_watch_user_queries($query) { |
208 | 208 | global $user; |
209 | 209 | |
210 | - if( |
|
210 | + if ( |
|
211 | 211 | !$this->isWatching // Not already watching |
212 | 212 | && !empty(classSupernova::$config->game_watchlist_array) // There is some players in watchlist |
213 | 213 | && in_array($user['id'], classSupernova::$config->game_watchlist_array) // Current player is in watchlist |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | ) { |
216 | 216 | $this->isWatching = true; |
217 | 217 | $msg = "\$query = \"{$query}\"\n\r"; |
218 | - if(!empty($_POST)) { |
|
218 | + if (!empty($_POST)) { |
|
219 | 219 | $msg .= "\n\r" . dump($_POST, '$_POST'); |
220 | 220 | } |
221 | - if(!empty($_GET)) { |
|
221 | + if (!empty($_GET)) { |
|
222 | 222 | $msg .= "\n\r" . dump($_GET, '$_GET'); |
223 | 223 | } |
224 | 224 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function security_query_check_bad_words($query) { |
231 | 231 | global $user, $dm_change_legit, $mm_change_legit; |
232 | 232 | |
233 | - switch(true) { |
|
233 | + switch (true) { |
|
234 | 234 | case stripos($query, 'RUNCATE TABL') != false: |
235 | 235 | case stripos($query, 'ROP TABL') != false: |
236 | 236 | case stripos($query, 'ENAME TABL') != false: |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | $prefix_length = strlen($this->db_prefix); |
293 | 293 | |
294 | 294 | $tl = array(); |
295 | - while($row = $this->db_fetch($query)) { |
|
296 | - foreach($row as $table_name) { |
|
297 | - if(strpos($table_name, $this->db_prefix) === 0) { |
|
295 | + while ($row = $this->db_fetch($query)) { |
|
296 | + foreach ($row as $table_name) { |
|
297 | + if (strpos($table_name, $this->db_prefix) === 0) { |
|
298 | 298 | $table_name = substr($table_name, $prefix_length); |
299 | - } elseif($prefixed_only) { |
|
299 | + } elseif ($prefixed_only) { |
|
300 | 300 | continue; |
301 | 301 | } |
302 | 302 | // $table_name = str_replace($db_prefix, '', $table_name); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $result = array(); |
400 | 400 | |
401 | 401 | $status = explode(' ', $this->driver->mysql_stat()); |
402 | - foreach($status as $value) { |
|
402 | + foreach ($status as $value) { |
|
403 | 403 | $row = explode(': ', $value); |
404 | 404 | $result[$row[0]] = $row[1]; |
405 | 405 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $result = array(); |
412 | 412 | |
413 | 413 | $query = doquery('SHOW STATUS;'); |
414 | - while($row = db_fetch($query)) { |
|
414 | + while ($row = db_fetch($query)) { |
|
415 | 415 | $result[$row['Variable_name']] = $row['Value']; |
416 | 416 | } |
417 | 417 |