@@ -11,24 +11,24 @@ discard block |
||
11 | 11 | * @copyright 2008 by Pada for XNova.project.es |
12 | 12 | */ |
13 | 13 | |
14 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
14 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
15 | 15 | |
16 | 16 | lng_include('overview'); |
17 | 17 | lng_include('universe'); |
18 | 18 | |
19 | 19 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
20 | 20 | if (!intval($sensorLevel)) { |
21 | - message (classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
21 | + message(classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ($planetrow['planet_type'] != PT_MOON) { |
25 | - message (classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
25 | + message(classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $scan_galaxy = sys_get_param_int('galaxy'); |
29 | 29 | $scan_system = sys_get_param_int('system'); |
30 | 30 | $scan_planet = sys_get_param_int('planet'); |
31 | -$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
31 | +$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
32 | 32 | $id = sys_get_param_id('id'); |
33 | 33 | |
34 | 34 | $source_galaxy = $planetrow['galaxy']; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $sensorRange = GetPhalanxRange($sensorLevel); |
39 | 39 | |
40 | 40 | $system_distance = abs($source_system - $scan_system); |
41 | -if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
41 | +if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
42 | 42 | { |
43 | - message (classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
43 | + message(classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cost = $sensorLevel * 1000; |
@@ -51,20 +51,20 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
54 | -if(!$planet_scanned['id']) |
|
54 | +if (!$planet_scanned['id']) |
|
55 | 55 | { |
56 | 56 | message(classLocale::$lang['phalanx_planet_not_exists'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
57 | 57 | } |
58 | 58 | |
59 | -if($planet_scanned['destruyed']) |
|
59 | +if ($planet_scanned['destruyed']) |
|
60 | 60 | { |
61 | - message (classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
61 | + message(classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | DBStaticPlanet::db_planet_update_adjust_by_id( |
65 | 65 | $user['current_planet'], |
66 | 66 | array( |
67 | - 'deuterium' => - $cost, |
|
67 | + 'deuterium' => -$cost, |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | //define('SN_RENDER_NAVBAR_PLANET', false); |
32 | 32 | |
33 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
33 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
34 | 34 | |
35 | 35 | //$ccc = 0; |
36 | 36 | //foreach(DBStaticUser::db_user_list_non_bots() as $ip) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $result = array(); |
51 | 51 | |
52 | -switch($mode = sys_get_param_str('mode')) { |
|
52 | +switch ($mode = sys_get_param_str('mode')) { |
|
53 | 53 | case 'manage': |
54 | 54 | sn_sys_sector_buy('overview.php?mode=manage'); |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $template = gettemplate('planet_manage', true); |
60 | 60 | $planet_id = sys_get_param_id('planet_id'); |
61 | 61 | |
62 | - if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
62 | + if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
63 | 63 | $planetrow['name'] = $new_name_unsafe; |
64 | 64 | DBStaticPlanet::db_planet_update_set_by_id( |
65 | 65 | $planetrow['id'], |
@@ -67,21 +67,21 @@ discard block |
||
67 | 67 | 'name' => $new_name_unsafe, |
68 | 68 | ) |
69 | 69 | ); |
70 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
70 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
71 | 71 | try { |
72 | 72 | sn_db_transaction_start(); |
73 | 73 | $user = DBStaticUser::db_user_by_id($user['id'], true, '*'); |
74 | 74 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*'); |
75 | 75 | |
76 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
76 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
77 | 77 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
78 | 78 | } |
79 | 79 | |
80 | - if($planetrow['id'] == $user['id_planet']) { |
|
80 | + if ($planetrow['id'] == $user['id_planet']) { |
|
81 | 81 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
82 | 82 | } |
83 | 83 | |
84 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
84 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
85 | 85 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
86 | 86 | } |
87 | 87 | |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | ); |
107 | 107 | sn_db_transaction_commit(); |
108 | 108 | sys_redirect('overview.php?mode=manage'); |
109 | - } catch(exception $e) { |
|
109 | + } catch (exception $e) { |
|
110 | 110 | sn_db_transaction_rollback(); |
111 | 111 | $result[] = array( |
112 | 112 | 'STATUS' => $e->getCode(), |
113 | 113 | 'MESSAGE' => $e->getMessage(), |
114 | 114 | ); |
115 | 115 | } |
116 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
116 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
117 | 117 | try { |
118 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
118 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
119 | 119 | 'galaxy' => sys_get_param_int('new_galaxy'), |
120 | 120 | 'system' => sys_get_param_int('new_system'), |
121 | 121 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // $planetrow = $global_data['planet']; |
133 | 133 | |
134 | 134 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
135 | - if($can_teleport['result'] != ERR_NONE) { |
|
135 | + if ($can_teleport['result'] != ERR_NONE) { |
|
136 | 136 | throw new exception($can_teleport['message'], $can_teleport['result']); |
137 | 137 | } |
138 | 138 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | array() |
152 | 152 | ); |
153 | 153 | |
154 | - if($planetrow['id'] == $user['id_planet']) { |
|
154 | + if ($planetrow['id'] == $user['id_planet']) { |
|
155 | 155 | DBStaticUser::db_user_set_by_id( |
156 | 156 | $user['id'], |
157 | 157 | array( |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
172 | 172 | ); |
173 | 173 | sys_redirect('overview.php?mode=manage'); |
174 | - } catch(exception $e) { |
|
174 | + } catch (exception $e) { |
|
175 | 175 | sn_db_transaction_rollback(); |
176 | 176 | $result[] = array( |
177 | 177 | 'STATUS' => $e->getCode(), |
178 | 178 | 'MESSAGE' => $e->getMessage(), |
179 | 179 | ); |
180 | 180 | } |
181 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
181 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
182 | 182 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
183 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
184 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
183 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
184 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
185 | 185 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
186 | 186 | DBStaticPlanet::db_planet_update_set_by_id( |
187 | 187 | $user['current_planet'], |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
208 | 208 | } |
209 | 209 | } else { |
210 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
210 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
211 | 211 | } |
212 | - } elseif( |
|
212 | + } elseif ( |
|
213 | 213 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
214 | 214 | && ( |
215 | 215 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
225 | 225 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
226 | 226 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
227 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
228 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
227 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
228 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
229 | 229 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
230 | 230 | } else { |
231 | 231 | $planetrow['PLANET_GOVERNOR_LEVEL'] = 1; |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | lng_include('mrc_mercenary'); |
259 | 259 | int_planet_pretemplate($planetrow, $template); |
260 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
261 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
260 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
261 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
262 | 262 | continue; |
263 | 263 | } |
264 | 264 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
311 | 311 | )); |
312 | 312 | |
313 | - foreach($result as &$a_result) { |
|
313 | + foreach ($result as &$a_result) { |
|
314 | 314 | $template->assign_block_vars('result', $a_result); |
315 | 315 | } |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | default: |
321 | 321 | sn_sys_sector_buy(); |
322 | 322 | |
323 | - if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
323 | + if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
324 | 324 | $planetrow['name'] = $new_name_unsafe; |
325 | 325 | DBStaticPlanet::db_planet_update_set_by_id( |
326 | 326 | $planetrow['id'], |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | $planet_count = 0; |
357 | 357 | $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*'); |
358 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
358 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
359 | 359 | sn_db_transaction_start(); |
360 | 360 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
361 | 361 | sn_db_transaction_commit(); |
@@ -366,16 +366,16 @@ discard block |
||
366 | 366 | |
367 | 367 | $planet_fleet_id = 0; |
368 | 368 | $fleet_list = $template_planet['fleet_list']; |
369 | - if($fleet_list['own']['count']) { |
|
369 | + if ($fleet_list['own']['count']) { |
|
370 | 370 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
371 | 371 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
372 | 372 | // $fleet_id++;tpl_parse_fleet_sn |
373 | 373 | } |
374 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
374 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
375 | 375 | continue; |
376 | 376 | } |
377 | 377 | $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']); |
378 | - if($moon) { |
|
378 | + if ($moon) { |
|
379 | 379 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
380 | 380 | } else { |
381 | 381 | $moon_fill = 0; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | tpl_assign_fleet($template, $fleets); |
416 | 416 | |
417 | 417 | $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']); |
418 | - if($lune) { |
|
418 | + if ($lune) { |
|
419 | 419 | $template->assign_vars(array( |
420 | 420 | 'MOON_ID' => $lune['id'], |
421 | 421 | 'MOON_IMG' => $lune['image'], |
@@ -427,15 +427,15 @@ discard block |
||
427 | 427 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
428 | 428 | |
429 | 429 | $planet_recyclers_orbiting = 0; |
430 | - foreach(Fleet::$snGroupRecyclers as $recycler_id) { |
|
430 | + foreach (Fleet::$snGroupRecyclers as $recycler_id) { |
|
431 | 431 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
432 | 432 | } |
433 | 433 | |
434 | 434 | int_planet_pretemplate($planetrow, $template); |
435 | 435 | |
436 | 436 | $sn_group_ques = sn_get_groups('ques'); |
437 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
438 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
437 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
438 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
439 | 439 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
440 | 440 | $template->assign_block_vars('ques', array( |
441 | 441 | 'ID' => $que_id, |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
444 | 444 | )); |
445 | 445 | |
446 | - if(!empty($this_que)) { |
|
447 | - foreach($this_que as $que_item) { |
|
446 | + if (!empty($this_que)) { |
|
447 | + foreach ($this_que as $que_item) { |
|
448 | 448 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
449 | 449 | } |
450 | 450 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | 'LENGTH' => $que_hangar_length, |
459 | 459 | )); |
460 | 460 | |
461 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
461 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
462 | 462 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
463 | 463 | $template->assign_block_vars('ques', array( |
464 | 464 | 'ID' => SUBQUE_DEFENSE, |
@@ -470,12 +470,12 @@ discard block |
||
470 | 470 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
471 | 471 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
472 | 472 | |
473 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
473 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
474 | 474 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
475 | 475 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
476 | 476 | } |
477 | 477 | |
478 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
478 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
479 | 479 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
480 | 480 | } |
481 | 481 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | )); |
533 | 533 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
534 | 534 | |
535 | - foreach($result as &$a_result) { |
|
535 | + foreach ($result as &$a_result) { |
|
536 | 536 | $template->assign_block_vars('result', $a_result); |
537 | 537 | } |
538 | 538 |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | define('INSTALL', false); |
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | |
7 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
7 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
8 | 8 | |
9 | 9 | // if($user['authlevel'] < 2) |
10 | -if($user['authlevel'] < 3) |
|
10 | +if ($user['authlevel'] < 3) |
|
11 | 11 | { |
12 | 12 | AdminMessage(classLocale::$lang['adm_err_denied']); |
13 | 13 | } |
14 | 14 | AdminMessage('Временно не работает'); |
15 | 15 | |
16 | -require("includes/admin_planet_edit.inc" . DOT_PHP_EX); |
|
16 | +require("includes/admin_planet_edit.inc".DOT_PHP_EX); |
|
17 | 17 | |
18 | 18 | $template = gettemplate('admin/admin_planet_edit', true); |
19 | 19 | |
@@ -21,30 +21,30 @@ discard block |
||
21 | 21 | $planet_id = sys_get_param_id('planet_id'); |
22 | 22 | |
23 | 23 | $unit_list = sys_get_param('unit_list'); |
24 | -if(sys_get_param('change_data') && !empty($unit_list)) |
|
24 | +if (sys_get_param('change_data') && !empty($unit_list)) |
|
25 | 25 | { |
26 | 26 | $query_string = array(); |
27 | - foreach($unit_list as $unit_id => $unit_amount) |
|
27 | + foreach ($unit_list as $unit_id => $unit_amount) |
|
28 | 28 | { |
29 | - if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
29 | + if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
30 | 30 | { |
31 | 31 | $query_string[] = $unit_query_string; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - if(!empty($query_string)) |
|
35 | + if (!empty($query_string)) |
|
36 | 36 | { |
37 | - classSupernova::$db->doUpdateReallyComplex("UPDATE {{" . TABLE_PLANETS . "}} SET " . implode(', ', $query_string) . " WHERE `id` = {$planet_id}"); |
|
37 | + classSupernova::$db->doUpdateReallyComplex("UPDATE {{".TABLE_PLANETS."}} SET ".implode(', ', $query_string)." WHERE `id` = {$planet_id}"); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if($planet_id) |
|
41 | +if ($planet_id) |
|
42 | 42 | { |
43 | 43 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
44 | 44 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
45 | 45 | } |
46 | 46 | |
47 | -foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
47 | +foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
48 | 48 | { |
49 | 49 | $template->assign_block_vars('page_menu', array( |
50 | 50 | 'ID' => $page_mode, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $template->assign_vars(array( |
56 | 56 | 'MODE' => $mode, |
57 | 57 | 'PLANET_ID' => $planet_id, |
58 | - 'PLANET_NAME' => empty($edit_planet_row) ? '' : classLocale::$lang['sys_planet_type'][$edit_planet_row['planet_type']] . ' ' . uni_render_planet($edit_planet_row), |
|
58 | + 'PLANET_NAME' => empty($edit_planet_row) ? '' : classLocale::$lang['sys_planet_type'][$edit_planet_row['planet_type']].' '.uni_render_planet($edit_planet_row), |
|
59 | 59 | 'PAGE_HINT' => classLocale::$lang['adm_planet_edit_hint'], |
60 | 60 | )); |
61 | 61 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_admin) { |
|
7 | +if (!$user_admin) { |
|
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
9 | 9 | } |
10 | 10 | |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
21 | 21 | |
22 | 22 | |
23 | -if(sys_get_param_str('isSaveOptions')) { |
|
23 | +if (sys_get_param_str('isSaveOptions')) { |
|
24 | 24 | require_once('includes/includes/sys_avatar.php'); |
25 | 25 | |
26 | 26 | $fieldChange = array(); |
27 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
27 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
28 | 28 | $fieldChange['ally_tag'] = $new_tag; |
29 | 29 | DBStaticUser::db_user_set_by_id( |
30 | 30 | $ally['ally_user_id'], |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | ) |
34 | 34 | ); |
35 | 35 | } |
36 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
36 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
37 | 37 | $fieldChange['ally_name'] = $new_name; |
38 | 38 | } |
39 | 39 | |
40 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
40 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
41 | 41 | $fieldChange['ally_owner_range'] = $new_owner_rank; |
42 | 42 | } |
43 | 43 | |
44 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
44 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
45 | 45 | $fieldChange['ally_web'] = $new_web; |
46 | 46 | } |
47 | 47 | |
48 | - if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
48 | + if (($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
49 | 49 | $fieldChange['ally_request_notallow'] = sys_get_param_int('request_notallow', $ally['ally_request_notallow']); |
50 | 50 | } |
51 | 51 | |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | 'AVATAR_UPLOAD_STATUS' => $avatar_upload_result['STATUS'], |
56 | 56 | 'AVATAR_UPLOAD_MESSAGE' => $avatar_upload_result['MESSAGE'], |
57 | 57 | )); |
58 | - if($new_image != $ally['ally_image']) { |
|
58 | + if ($new_image != $ally['ally_image']) { |
|
59 | 59 | $fieldChange['ally_image'] = $new_image; |
60 | 60 | } |
61 | 61 | |
62 | - if(!empty($fieldChange)) { |
|
62 | + if (!empty($fieldChange)) { |
|
63 | 63 | classSupernova::$db->doUpdateRowSet( |
64 | 64 | TABLE_ALLIANCE, |
65 | 65 | $fieldChange, |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
72 | 72 | } |
73 | -} elseif(sys_get_param_str('isSaveText')) { |
|
73 | +} elseif (sys_get_param_str('isSaveText')) { |
|
74 | 74 | $text_unsafe = sys_get_param_str_unsafe('text'); |
75 | 75 | DBStaticAlly::db_ally_update_texts($text_unsafe, $ally['id'], $text_list[$allyTextID]['db_field']); |
76 | 76 | $ally[$text_list[$allyTextID]['db_field']] = db_escape($text_unsafe); |
77 | -} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
78 | - if(!$isAllyOwner) { |
|
77 | +} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
78 | + if (!$isAllyOwner) { |
|
79 | 79 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $newLeader = DBStaticUser::db_user_by_id($idNewLeader, false, `ally_id`); |
83 | - if($newLeader['ally_id'] == $user['ally_id']) { |
|
83 | + if ($newLeader['ally_id'] == $user['ally_id']) { |
|
84 | 84 | sn_db_transaction_start(); |
85 | 85 | DBStaticUser::db_user_set_by_id( |
86 | 86 | $user['id'], |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | sn_db_transaction_commit(); |
100 | 100 | sys_redirect('alliance.php'); |
101 | 101 | } |
102 | -} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
103 | - if(!$isAllyOwner) { |
|
102 | +} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
103 | + if (!$isAllyOwner) { |
|
104 | 104 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
105 | 105 | } |
106 | 106 | sn_db_transaction_start(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $request = DBStaticAlly::db_ally_request_count_by_id($ally); |
124 | 124 | |
125 | 125 | $template->assign_vars(array( |
126 | - 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
126 | + 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
127 | 127 | 'text' => $ally[$text_list[$allyTextID]['db_field']], |
128 | 128 | 'request_type' => classLocale::$lang[$text_list[$allyTextID]['text_type']], |
129 | 129 | 't' => $allyTextID, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $userAllyAdmins = DBStaticUser::db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
157 | 157 | unset($tmp); |
158 | 158 | // while ($userAllyAdmin = db_fetch($userAllyAdmins)) |
159 | - foreach($userAllyAdmins as $userAllyAdmin) { |
|
159 | + foreach ($userAllyAdmins as $userAllyAdmin) { |
|
160 | 160 | // pdump($userAllyAdmin); |
161 | 161 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
162 | 162 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | $template->assign_var('adminMembers', $tmp); |
165 | 165 | } |
166 | 166 | |
167 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
168 | - if(!$sn_ali_admin_action_locale['title']) { |
|
167 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
168 | + if (!$sn_ali_admin_action_locale['title']) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | $template->assign_block_vars('admin_actions', array( |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | // Pretty Safe |
3 | 3 | // TODO: Add ally_tag to usertable |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | 6 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | $ally_name_unsafe = sys_get_param_str_unsafe('name'); |
12 | 12 | $ally_name = db_escape($ally_name_unsafe); |
13 | 13 | |
14 | -if($ally_tag) { |
|
15 | - if(!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
14 | +if ($ally_tag) { |
|
15 | + if (!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
16 | 16 | message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name); |
20 | - if($query) { |
|
20 | + if ($query) { |
|
21 | 21 | message(str_replace('%s', $query['ally_tag'] == $ally_tag_unsafe ? $ally_tag_unsafe : $ally_name_unsafe, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']); |
22 | 22 | } |
23 | 23 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | |
37 | 37 | $ally_user = classSupernova::$gc->cacheOperator->db_ins_record(LOC_USER, array( |
38 | - 'username' => "[" . $ally_tag_unsafe . "]", |
|
38 | + 'username' => "[".$ally_tag_unsafe."]", |
|
39 | 39 | 'register_time' => SN_TIME_NOW, |
40 | 40 | 'user_as_ally' => $ally_id, |
41 | 41 | )); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['requests_admin']); |
9 | 9 | } |
10 | 10 | |
11 | -if($d = sys_get_param_id('d')) { |
|
11 | +if ($d = sys_get_param_id('d')) { |
|
12 | 12 | DBStaticAlly::db_ally_request_deny($d); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $id_user = sys_get_param_id('id_user'); |
16 | 16 | |
17 | -if($id_user) { |
|
17 | +if ($id_user) { |
|
18 | 18 | DBStaticUser::db_user_set_by_id( |
19 | 19 | $id_user, |
20 | 20 | array( |
@@ -54,16 +54,16 @@ |
||
54 | 54 | $comment = call_user_func_array('sprintf', $comment); |
55 | 55 | } |
56 | 56 | // mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
57 | - classSupernova::$auth->account->metamatter_change($change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
|
57 | + classSupernova::$auth->account->metamatter_change($change_type, -$metamatter_to_reduce, 'ММ в ТМ: '.(-$dark_matter).' ТМ = '.$dark_matter_exists.' ТМ + '.$metamatter_to_reduce.' ММ. '.$comment); |
|
58 | 58 | $dark_matter = -$dark_matter_exists; |
59 | 59 | } |
60 | 60 | } else { |
61 | 61 | $changeset['dark_matter_total'] = +$dark_matter; |
62 | 62 | } |
63 | - if($dark_matter) { |
|
63 | + if ($dark_matter) { |
|
64 | 64 | $changeset[$sn_data_dark_matter_db_name] = +$dark_matter; |
65 | 65 | } |
66 | - if(!empty($changeset)) { |
|
66 | + if (!empty($changeset)) { |
|
67 | 67 | DBStaticUser::db_user_adjust_by_id($user_id, $changeset); |
68 | 68 | } |
69 | 69 | $rows_affected = classSupernova::$db->db_affected_rows(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $language_new = sys_get_param_str('langer', $user['lang']); |
14 | 14 | |
15 | - if($language_new != $user['lang']) { |
|
15 | + if ($language_new != $user['lang']) { |
|
16 | 16 | classLocale::$lang->lng_switch($language_new); |
17 | 17 | } |
18 | 18 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | |
22 | 22 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
23 | 23 | |
24 | - if(sys_get_param_str('mode') == 'change') { |
|
25 | - if($user['authlevel'] > 0) { |
|
24 | + if (sys_get_param_str('mode') == 'change') { |
|
25 | + if ($user['authlevel'] > 0) { |
|
26 | 26 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
27 | 27 | DBStaticPlanet::db_planet_set_by_owner( |
28 | 28 | $user['id'], |
@@ -39,27 +39,27 @@ discard block |
||
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
42 | - if(sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
42 | + if (sys_get_param_int('vacation') && !classSupernova::$config->user_vacation_disable) { |
|
43 | 43 | sn_db_transaction_start(); |
44 | - if($user['authlevel'] < 3) { |
|
45 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
44 | + if ($user['authlevel'] < 3) { |
|
45 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
46 | 46 | message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
47 | 47 | die(); |
48 | 48 | } |
49 | 49 | |
50 | - if(FleetList::fleet_count_flying($user['id'])) { |
|
50 | + if (FleetList::fleet_count_flying($user['id'])) { |
|
51 | 51 | message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
52 | 52 | die(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | $que = que_get($user['id'], false); |
56 | - if(!empty($que)) { |
|
56 | + if (!empty($que)) { |
|
57 | 57 | message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5); |
58 | 58 | die(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $query = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
62 | - foreach($query as $planet) { |
|
62 | + foreach ($query as $planet) { |
|
63 | 63 | $classConfig = classSupernova::$config; |
64 | 64 | DBStaticPlanet::db_planet_update_set_by_id( |
65 | 65 | $planet['id'], |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | sn_db_transaction_commit(); |
88 | 88 | } |
89 | 89 | |
90 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
91 | - foreach($option_group as $option_name => $option_value) { |
|
92 | - if($user[$option_name] !== null) { |
|
90 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
91 | + foreach ($option_group as $option_name => $option_value) { |
|
92 | + if ($user[$option_name] !== null) { |
|
93 | 93 | $user[$option_name] = sys_get_param_str($option_name); |
94 | 94 | } else { |
95 | 95 | $user[$option_name] = $option_value; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | |
102 | 102 | $player_options = sys_get_param('options'); |
103 | - if(!empty($player_options)) { |
|
104 | - array_walk($player_options, function (&$value) { |
|
103 | + if (!empty($player_options)) { |
|
104 | + array_walk($player_options, function(&$value) { |
|
105 | 105 | // TODO - Когда будет больше параметров - сделать больше проверок |
106 | 106 | $value = intval($value); |
107 | 107 | }); |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | |
113 | 113 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
114 | 114 | $username_safe = db_escape($username); |
115 | - if($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
115 | + if ($username && $user['username'] != $username && classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
116 | 116 | // проверка на корректность |
117 | 117 | sn_db_transaction_start(); |
118 | 118 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
119 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
119 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
120 | 120 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
121 | - switch(classSupernova::$config->game_user_changename) { |
|
121 | + switch (classSupernova::$config->game_user_changename) { |
|
122 | 122 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
123 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
123 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < classSupernova::$config->game_user_changename_cost) { |
|
124 | 124 | $template_result['.']['result'][] = array( |
125 | 125 | 'STATUS' => ERR_ERROR, |
126 | 126 | 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'], |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | sn_db_transaction_commit(); |
157 | 157 | } |
158 | 158 | |
159 | - if($new_password = sys_get_param('newpass1')) { |
|
159 | + if ($new_password = sys_get_param('newpass1')) { |
|
160 | 160 | try { |
161 | - if($new_password != sys_get_param('newpass2')) { |
|
161 | + if ($new_password != sys_get_param('newpass2')) { |
|
162 | 162 | throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING); |
163 | 163 | } |
164 | 164 | |
165 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
165 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
166 | 166 | throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING); |
167 | 167 | } |
168 | 168 | |
169 | 169 | throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE); |
170 | - } catch(Exception $e) { |
|
170 | + } catch (Exception $e) { |
|
171 | 171 | $template_result['.']['result'][] = array( |
172 | 172 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
173 | 173 | 'MESSAGE' => $e->getMessage() |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
190 | 190 | |
191 | 191 | try { |
192 | - if($user['birthday']) { |
|
192 | + if ($user['birthday']) { |
|
193 | 193 | throw new exception(); |
194 | 194 | } |
195 | 195 | |
196 | 196 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
197 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
197 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
198 | 198 | throw new exception(); |
199 | 199 | } |
200 | 200 | |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
205 | 205 | asort($pos); |
206 | 206 | $i = 0; |
207 | - foreach($pos as &$position) { |
|
207 | + foreach ($pos as &$position) { |
|
208 | 208 | $position = ++$i; |
209 | 209 | } |
210 | 210 | |
211 | - $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
|
212 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
211 | + $regexp = "/".preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE)."/"; |
|
212 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
213 | 213 | throw new exception(); |
214 | 214 | } |
215 | 215 | |
216 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
216 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
217 | 217 | throw new exception(); |
218 | 218 | } |
219 | 219 | |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
222 | 222 | |
223 | 223 | $year = date('Y', SN_TIME_NOW); |
224 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
224 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
225 | 225 | $year--; |
226 | 226 | } |
227 | 227 | $user['user_birthday_celebrated'] = "{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"; |
228 | 228 | |
229 | - } catch(Exception $e) { |
|
229 | + } catch (Exception $e) { |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | require_once('includes/includes/sys_avatar.php'); |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | $template_result['.']['result'][] = $avatar_upload_result; |
236 | 236 | |
237 | 237 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
238 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
238 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
239 | 239 | playerTimeDiff::user_time_diff_set(array( |
240 | 240 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
241 | 241 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
242 | 242 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
243 | 243 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
244 | 244 | )); |
245 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
245 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
246 | 246 | playerTimeDiff::user_time_diff_set(array( |
247 | 247 | PLAYER_OPTION_TIME_DIFF => '', |
248 | 248 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | 'STATUS' => ERR_NONE, |
274 | 274 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
275 | 275 | ); |
276 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
276 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
277 | 277 | $template_result['.']['result'][] = array( |
278 | 278 | 'STATUS' => ERR_NONE, |
279 | 279 | 'MESSAGE' => classLocale::$lang['opt_msg_saved'] |
@@ -296,9 +296,9 @@ discard block |
||
296 | 296 | |
297 | 297 | $template = gettemplate('options', $template); |
298 | 298 | |
299 | - $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
|
300 | - while(($entry = $dir->read()) !== false) { |
|
301 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
299 | + $dir = dir(SN_ROOT_PHYSICAL.'skins'); |
|
300 | + while (($entry = $dir->read()) !== false) { |
|
301 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
302 | 302 | $template_result['.']['skin_list'][] = array( |
303 | 303 | 'VALUE' => $entry, |
304 | 304 | 'NAME' => $entry, |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | $dir->close(); |
310 | 310 | |
311 | - foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
311 | + foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) { |
|
312 | 312 | $template_result['.']['planet_sort_options'][] = array( |
313 | 313 | 'VALUE' => $key, |
314 | 314 | 'NAME' => $value, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
319 | - foreach(classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
319 | + foreach (classLocale::$lang['sys_gender_list'] as $key => $value) { |
|
320 | 320 | $template_result['.']['gender_list'][] = array( |
321 | 321 | 'VALUE' => $key, |
322 | 322 | 'NAME' => $value, |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | $lang_list = lng_get_list(); |
328 | - foreach($lang_list as $lang_id => $lang_data) { |
|
328 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
329 | 329 | $template_result['.']['languages'][] = array( |
330 | 330 | 'VALUE' => $lang_id, |
331 | 331 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | - if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
338 | - foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
337 | + if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) { |
|
338 | + foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
339 | 339 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
340 | 340 | 'ID' => $key, |
341 | 341 | 'NAME' => $value, |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | 'PAGE_HEADER' => classLocale::$lang['opt_header'], |
443 | 443 | )); |
444 | 444 | |
445 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
446 | - if($option_group_id == OPT_MESSAGE) { |
|
447 | - foreach(DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
448 | - if($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
445 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
446 | + if ($option_group_id == OPT_MESSAGE) { |
|
447 | + foreach (DBStaticMessages::$snMessageClassList as $message_class_id => $message_class_data) { |
|
448 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && classSupernova::$config->game_email_pm)) { |
|
449 | 449 | $option_name = $message_class_data['name']; |
450 | 450 | |
451 | 451 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | } else { |
460 | - foreach($option_group as $option_name => $option_value) { |
|
461 | - if(array_key_exists($option_name, $user_option_types)) { |
|
460 | + foreach ($option_group as $option_name => $option_value) { |
|
461 | + if (array_key_exists($option_name, $user_option_types)) { |
|
462 | 462 | $option_type = $user_option_types[$option_name]; |
463 | 463 | } else { |
464 | 464 | $option_type = 'switch'; |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
5 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
6 | 6 | classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
9 | -$page_title .= ' - ' . classLocale::$lang["eco_mrk_{$submode}"]; |
|
9 | +$page_title .= ' - '.classLocale::$lang["eco_mrk_{$submode}"]; |
|
10 | 10 | |
11 | 11 | $template = gettemplate('market_fleet', true); |
12 | 12 | $template->assign_vars(array( |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | 'rpg_cost' => $rpg_cost, |
15 | 15 | )); |
16 | 16 | |
17 | -if(is_array($shipList)) { |
|
18 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
17 | +if (is_array($shipList)) { |
|
18 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
19 | 19 | $intError = MARKET_NO_DM; |
20 | 20 | } |
21 | 21 | |
@@ -28,32 +28,32 @@ discard block |
||
28 | 28 | // Блокируем запись о запасах кораблей у трейдера |
29 | 29 | db_config_get_stockman_fleet(); |
30 | 30 | |
31 | - $message .= classLocale::$lang["eco_mrk_{$submode}_ships"] . '<ul>'; |
|
31 | + $message .= classLocale::$lang["eco_mrk_{$submode}_ships"].'<ul>'; |
|
32 | 32 | $total = array(); |
33 | - foreach($shipList as $shipID => &$shipCount) { |
|
33 | + foreach ($shipList as $shipID => &$shipCount) { |
|
34 | 34 | $shipCount = ceil(floatval($shipCount)); |
35 | - if(!$shipCount) { |
|
35 | + if (!$shipCount) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | - if($shipCount < 0) { |
|
39 | + if ($shipCount < 0) { |
|
40 | 40 | classSupernova::$debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
41 | 41 | $intError = MARKET_NEGATIVE_SHIPS; |
42 | 42 | break; |
43 | 43 | } |
44 | 44 | |
45 | - if($mode == MARKET_SCRAPPER) { |
|
45 | + if ($mode == MARKET_SCRAPPER) { |
|
46 | 46 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
47 | - } elseif($mode == MARKET_STOCKMAN) { |
|
47 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
48 | 48 | $amount = $stock[$shipID]; |
49 | 49 | } |
50 | 50 | |
51 | - if($amount < $shipCount) { |
|
51 | + if ($amount < $shipCount) { |
|
52 | 52 | $intError = $error_no_stock; |
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | - if(!in_array($shipID, Fleet::$snGroupFleet)) { |
|
56 | + if (!in_array($shipID, Fleet::$snGroupFleet)) { |
|
57 | 57 | classSupernova::$debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
58 | 58 | $intError = MARKET_NOT_A_SHIP; |
59 | 59 | break; |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
70 | 70 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
71 | 71 | |
72 | - foreach($resTemp as $resID => $resCount) { |
|
72 | + foreach ($resTemp as $resID => $resCount) { |
|
73 | 73 | $total[$resID] += $resCount; |
74 | 74 | } |
75 | 75 | |
76 | - $message .= "<li>{$classLocale['tech'][$shipID]}: " . pretty_number($shipCount); |
|
76 | + $message .= "<li>{$classLocale['tech'][$shipID]}: ".pretty_number($shipCount); |
|
77 | 77 | } |
78 | 78 | |
79 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | - foreach($total as $resID => $resCount) { |
|
81 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
79 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | + foreach ($total as $resID => $resCount) { |
|
81 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
82 | 82 | $intError = MARKET_NO_RESOURCES; |
83 | 83 | classSupernova::$debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
84 | 84 | break; |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
90 | 90 | |
91 | 91 | $qry = array(); |
92 | - if($intError == MARKET_DEAL) { |
|
93 | - $message .= '</ul>' . classLocale::$lang["eco_mrk_{$submode}_res"] . '<ul>'; |
|
94 | - foreach($total as $resID => $resCount) { |
|
95 | - if(!$resCount) { |
|
92 | + if ($intError == MARKET_DEAL) { |
|
93 | + $message .= '</ul>'.classLocale::$lang["eco_mrk_{$submode}_res"].'<ul>'; |
|
94 | + foreach ($total as $resID => $resCount) { |
|
95 | + if (!$resCount) { |
|
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $qry[pname_resource_name($resID)] = $resCount; |
100 | - $message .= "<li>" . classLocale::$lang['sys_' . pname_resource_name($resID)] . ": " . pretty_number(abs($resCount)); |
|
100 | + $message .= "<li>".classLocale::$lang['sys_'.pname_resource_name($resID)].": ".pretty_number(abs($resCount)); |
|
101 | 101 | } |
102 | 102 | $message .= "</ul>"; |
103 | 103 | |
@@ -125,38 +125,38 @@ discard block |
||
125 | 125 | 'MESSAGE' => classLocale::$lang['eco_mrk_errors'][$intError], |
126 | 126 | )); |
127 | 127 | |
128 | - foreach($shipList as $shipID => $shipCount) { |
|
128 | + foreach ($shipList as $shipID => $shipCount) { |
|
129 | 129 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
133 | 133 | $message = ''; |
134 | 134 | |
135 | -if(!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) { |
|
136 | - classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, Fleet::$snGroupFleet))); |
|
135 | +if (!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) { |
|
136 | + classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, Fleet::$snGroupFleet))); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | tpl_set_resource_info($template, $planetrow, array()); |
140 | 140 | |
141 | -if(!$array) { |
|
141 | +if (!$array) { |
|
142 | 142 | $array = array(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $group_fleet = Fleet::$snGroupFleet; |
146 | -foreach($array as $key => $value) { |
|
147 | - if($mode == MARKET_SCRAPPER) { |
|
146 | +foreach ($array as $key => $value) { |
|
147 | + if ($mode == MARKET_SCRAPPER) { |
|
148 | 148 | $shipID = $value; |
149 | 149 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
150 | - } elseif($mode == MARKET_STOCKMAN) { |
|
150 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
151 | 151 | $shipID = $key; |
152 | 152 | $amount = $value; |
153 | 153 | } |
154 | 154 | |
155 | - if(!in_array($shipID, $group_fleet)) { |
|
155 | + if (!in_array($shipID, $group_fleet)) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - if($amount > 0) { |
|
159 | + if ($amount > 0) { |
|
160 | 160 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
161 | 161 | $template->assign_block_vars('ships', array( |
162 | 162 | 'ID' => $shipID, |