@@ -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 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | $ally_name_raw = sys_get_param_str_unsafe('name'); |
13 | 13 | $ally_name = db_escape($ally_name_raw); |
14 | 14 | |
15 | -if($ally_tag) |
|
15 | +if ($ally_tag) |
|
16 | 16 | { |
17 | - if(!$ally_name_raw || !$ally_tag_raw) |
|
17 | + if (!$ally_name_raw || !$ally_tag_raw) |
|
18 | 18 | { |
19 | 19 | messageBox($lang['have_not_name'], $lang['make_alliance']); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true); |
23 | - if($query) |
|
23 | + if ($query) |
|
24 | 24 | { |
25 | 25 | messageBox(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
26 | 26 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // $same_user = false; |
48 | 48 | // } |
49 | 49 | |
50 | - if(!$user_data) { |
|
50 | + if (!$user_data) { |
|
51 | 51 | messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); |
52 | 52 | die(); |
53 | 53 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $stat_array = array(); |
59 | 59 | $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); |
60 | 60 | $stat_count = classSupernova::$db->db_affected_rows(); |
61 | - while($row = db_fetch($query)) { |
|
62 | - foreach($stat_fields as $field_db_name => $field_template_name) { |
|
61 | + while ($row = db_fetch($query)) { |
|
62 | + foreach ($stat_fields as $field_db_name => $field_template_name) { |
|
63 | 63 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS |
64 | 64 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $stat_array_date = $stat_array['STAT_DATE']; |
69 | 69 | empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false; |
70 | - foreach($stat_array_date['DATA'] as $key => $value) { |
|
70 | + foreach ($stat_array_date['DATA'] as $key => $value) { |
|
71 | 71 | $template->assign_block_vars('stat_date', array( |
72 | 72 | 'ID' => $key, |
73 | 73 | 'VALUE' => $value, |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | |
78 | 78 | unset($stat_array['STAT_DATE']); |
79 | 79 | $template_data = array(); |
80 | - foreach($stat_array as $stat_type => &$stat_type_data) { |
|
80 | + foreach ($stat_array as $stat_type => &$stat_type_data) { |
|
81 | 81 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; |
82 | 82 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); |
83 | 83 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); |
84 | 84 | $stat_type_data['AVG'] = average($stat_type_data['DATA']); |
85 | - foreach($stat_type_data['DATA'] as $key => $value) { |
|
85 | + foreach ($stat_type_data['DATA'] as $key => $value) { |
|
86 | 86 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; |
87 | 87 | $template_data[$stat_type][$key]['ID'] = $key; |
88 | 88 | $template_data[$stat_type][$key]['VALUE'] = $value; |
89 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
89 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
90 | 90 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - foreach($template_data as $stat_type => $stat_type_data) { |
|
94 | + foreach ($template_data as $stat_type => $stat_type_data) { |
|
95 | 95 | $template->assign_block_vars('stat', array( |
96 | 96 | 'TYPE' => $stat_type, |
97 | 97 | 'TEXT' => $lang['imp_stat_types'][$stat_type], |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | 'MAX' => $stat_array[$stat_type]['MAX'], |
100 | 100 | 'AVG' => $stat_array[$stat_type]['AVG'], |
101 | 101 | )); |
102 | - foreach($stat_type_data as $stat_entry) { |
|
102 | + foreach ($stat_type_data as $stat_entry) { |
|
103 | 103 | $template->assign_block_vars('stat.entry', $stat_entry); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - if($same_user) { |
|
108 | + if ($same_user) { |
|
109 | 109 | rpg_level_up($user, RPG_STRUCTURE); |
110 | 110 | rpg_level_up($user, RPG_RAID); |
111 | 111 | rpg_level_up($user, RPG_TECH); |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | 'builder_xp' => pretty_number($user_data['xpminier']), |
140 | 140 | 'builder_lvl' => pretty_number($user_data['lvl_minier']), |
141 | 141 | 'builder_lvl_st' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'])), |
142 | - 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier']+1)), |
|
142 | + 'builder_lvl_up' => pretty_number(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), |
|
143 | 143 | 'raid_xp' => pretty_number($user_data['xpraid']), |
144 | 144 | 'raid_lvl' => pretty_number($user_data['lvl_raid']), |
145 | - 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid']+1)), |
|
145 | + 'raid_lvl_up' => pretty_number(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), |
|
146 | 146 | 'raids' => pretty_number($user_data['raids']), |
147 | 147 | 'raidswin' => pretty_number($user_data['raidswin']), |
148 | 148 | 'raidsloose' => pretty_number($user_data['raidsloose']), |
149 | 149 | 'tech_xp' => pretty_number($user_data['player_rpg_tech_xp']), |
150 | 150 | 'tech_lvl' => pretty_number($user_data['player_rpg_tech_level']), |
151 | 151 | 'tech_lvl_st' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), |
152 | - 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), |
|
152 | + 'tech_lvl_up' => pretty_number(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), |
|
153 | 153 | |
154 | 154 | 'explore_xp' => pretty_number($user_data['player_rpg_explore_xp']), |
155 | 155 | 'explore_lvl' => pretty_number($user_data['player_rpg_explore_level']), |
156 | 156 | 'explore_lvl_st' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), |
157 | - 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), |
|
158 | - |
|
159 | - 'build_points' => pretty_number( $StatRecord['build_points'] ), |
|
160 | - 'tech_points' => pretty_number( $StatRecord['tech_points'] ), |
|
161 | - 'fleet_points' => pretty_number( $StatRecord['fleet_points'] ), |
|
162 | - 'defs_points' => pretty_number( $StatRecord['defs_points'] ), |
|
163 | - 'res_points' => pretty_number( $StatRecord['res_points'] ), |
|
164 | - 'total_points' => pretty_number( $StatRecord['total_points'] ), |
|
157 | + 'explore_lvl_up' => pretty_number(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), |
|
158 | + |
|
159 | + 'build_points' => pretty_number($StatRecord['build_points']), |
|
160 | + 'tech_points' => pretty_number($StatRecord['tech_points']), |
|
161 | + 'fleet_points' => pretty_number($StatRecord['fleet_points']), |
|
162 | + 'defs_points' => pretty_number($StatRecord['defs_points']), |
|
163 | + 'res_points' => pretty_number($StatRecord['res_points']), |
|
164 | + 'total_points' => pretty_number($StatRecord['total_points']), |
|
165 | 165 | 'user_rank' => $StatRecord['total_rank'], |
166 | 166 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], |
167 | 167 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $language_new = sys_get_param_str('langer', $user['lang']); |
13 | 13 | |
14 | - if($language_new != $user['lang']) { |
|
14 | + if ($language_new != $user['lang']) { |
|
15 | 15 | $lang->lng_switch($language_new); |
16 | 16 | } |
17 | 17 | |
@@ -20,35 +20,35 @@ discard block |
||
20 | 20 | |
21 | 21 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
22 | 22 | |
23 | - if(sys_get_param_str('mode') == 'change') { |
|
24 | - if($user['authlevel'] > 0) { |
|
23 | + if (sys_get_param_str('mode') == 'change') { |
|
24 | + if ($user['authlevel'] > 0) { |
|
25 | 25 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
26 | 26 | DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
27 | 27 | db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
28 | 28 | $user['admin_protection'] = $planet_protection; |
29 | 29 | } |
30 | 30 | |
31 | - if(sys_get_param_int('vacation') && !$config->user_vacation_disable) { |
|
31 | + if (sys_get_param_int('vacation') && !$config->user_vacation_disable) { |
|
32 | 32 | sn_db_transaction_start(); |
33 | - if($user['authlevel'] < 3) { |
|
34 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
33 | + if ($user['authlevel'] < 3) { |
|
34 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
35 | 35 | messageBox($lang['opt_vacation_err_timeout'], $lang['Error'], 'index.php?page=options', 5); |
36 | 36 | die(); |
37 | 37 | } |
38 | 38 | |
39 | - if(fleet_count_flying($user['id'])) { |
|
39 | + if (fleet_count_flying($user['id'])) { |
|
40 | 40 | messageBox($lang['opt_vacation_err_your_fleet'], $lang['Error'], 'index.php?page=options', 5); |
41 | 41 | die(); |
42 | 42 | } |
43 | 43 | |
44 | 44 | $que = que_get($user['id'], false); |
45 | - if(!empty($que)) { |
|
45 | + if (!empty($que)) { |
|
46 | 46 | messageBox($lang['opt_vacation_err_que'], $lang['Error'], 'index.php?page=options', 5); |
47 | 47 | die(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
51 | - foreach($query as $planet) { |
|
51 | + foreach ($query as $planet) { |
|
52 | 52 | DBStaticPlanet::db_planet_set_by_id($planet['id'], |
53 | 53 | "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
54 | 54 | metal_perhour = '{$config->metal_basic_income}', crystal_perhour = '{$config->crystal_basic_income}', deuterium_perhour = '{$config->deuterium_basic_income}', |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | sn_db_transaction_commit(); |
64 | 64 | } |
65 | 65 | |
66 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
67 | - foreach($option_group as $option_name => $option_value) { |
|
68 | - if($user[$option_name] !== null) { |
|
66 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
67 | + foreach ($option_group as $option_name => $option_value) { |
|
68 | + if ($user[$option_name] !== null) { |
|
69 | 69 | $user[$option_name] = sys_get_param_str($option_name); |
70 | 70 | } else { |
71 | 71 | $user[$option_name] = $option_value; |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | |
77 | 77 | |
78 | 78 | $player_options = sys_get_param('options'); |
79 | - if(!empty($player_options)) { |
|
80 | - if($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) { |
|
79 | + if (!empty($player_options)) { |
|
80 | + if ($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) { |
|
81 | 81 | $player_options[PLAYER_OPTION_TUTORIAL_FINISHED] = 0; |
82 | 82 | } |
83 | 83 | |
84 | - array_walk($player_options, function (&$value) { |
|
84 | + array_walk($player_options, function(&$value) { |
|
85 | 85 | // TODO - Когда будет больше параметров - сделать больше проверок |
86 | 86 | $value = intval($value); |
87 | 87 | }); |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | |
91 | 91 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
92 | 92 | $username_safe = db_escape($username); |
93 | - if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
93 | + if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
94 | 94 | // проверка на корректность |
95 | 95 | sn_db_transaction_start(); |
96 | 96 | $name_check = doquery("SELECT * FROM {{player_name_history}} WHERE `player_name` LIKE \"{$username_safe}\" LIMIT 1 FOR UPDATE;", true); |
97 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
97 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
98 | 98 | $user = db_user_by_id($user['id'], true); |
99 | - switch($config->game_user_changename) { |
|
99 | + switch ($config->game_user_changename) { |
|
100 | 100 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
101 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
101 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
102 | 102 | $template_result['.']['result'][] = array( |
103 | 103 | 'STATUS' => ERR_ERROR, |
104 | 104 | 'MESSAGE' => $lang['opt_msg_name_change_err_no_dm'], |
@@ -128,18 +128,18 @@ discard block |
||
128 | 128 | sn_db_transaction_commit(); |
129 | 129 | } |
130 | 130 | |
131 | - if($new_password = sys_get_param('newpass1')) { |
|
131 | + if ($new_password = sys_get_param('newpass1')) { |
|
132 | 132 | try { |
133 | - if($new_password != sys_get_param('newpass2')) { |
|
133 | + if ($new_password != sys_get_param('newpass2')) { |
|
134 | 134 | throw new Exception($lang['opt_err_pass_unmatched'], ERR_WARNING); |
135 | 135 | } |
136 | 136 | |
137 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
137 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
138 | 138 | throw new Exception($lang['opt_err_pass_wrong'], ERR_WARNING); |
139 | 139 | } |
140 | 140 | |
141 | 141 | throw new Exception($lang['opt_msg_pass_changed'], ERR_NONE); |
142 | - } catch(Exception $e) { |
|
142 | + } catch (Exception $e) { |
|
143 | 143 | $template_result['.']['result'][] = array( |
144 | 144 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
145 | 145 | 'MESSAGE' => $e->getMessage() |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
161 | 161 | |
162 | 162 | try { |
163 | - if($user['birthday']) { |
|
163 | + if ($user['birthday']) { |
|
164 | 164 | throw new exception(); |
165 | 165 | } |
166 | 166 | |
167 | 167 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
168 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
168 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
169 | 169 | throw new exception(); |
170 | 170 | } |
171 | 171 | |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
176 | 176 | asort($pos); |
177 | 177 | $i = 0; |
178 | - foreach($pos as &$position) { |
|
178 | + foreach ($pos as &$position) { |
|
179 | 179 | $position = ++$i; |
180 | 180 | } |
181 | 181 | |
182 | 182 | $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
183 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
183 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
184 | 184 | throw new exception(); |
185 | 185 | } |
186 | 186 | |
187 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
187 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
188 | 188 | throw new exception(); |
189 | 189 | } |
190 | 190 | |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
193 | 193 | |
194 | 194 | $year = date('Y', SN_TIME_NOW); |
195 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
195 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
196 | 196 | $year--; |
197 | 197 | } |
198 | 198 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
199 | 199 | |
200 | 200 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
201 | - } catch(exception $e) { |
|
201 | + } catch (exception $e) { |
|
202 | 202 | $user_birthday = ''; |
203 | 203 | } |
204 | 204 | |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | $template_result['.']['result'][] = $avatar_upload_result; |
209 | 209 | |
210 | 210 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
211 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
211 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
212 | 212 | playerTimeDiff::user_time_diff_set(array( |
213 | 213 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
214 | 214 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
215 | 215 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
216 | 216 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
217 | 217 | )); |
218 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
218 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
219 | 219 | playerTimeDiff::user_time_diff_set(array( |
220 | 220 | PLAYER_OPTION_TIME_DIFF => '', |
221 | 221 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'STATUS' => ERR_NONE, |
236 | 236 | 'MESSAGE' => $lang['opt_msg_saved'] |
237 | 237 | ); |
238 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
238 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
239 | 239 | $template_result['.']['result'][] = array( |
240 | 240 | 'STATUS' => ERR_NONE, |
241 | 241 | 'MESSAGE' => $lang['opt_msg_saved'] |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | $template = gettemplate('options', $template); |
259 | 259 | |
260 | 260 | $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
261 | - while(($entry = $dir->read()) !== false) { |
|
262 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
261 | + while (($entry = $dir->read()) !== false) { |
|
262 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
263 | 263 | $template_result['.']['skin_list'][] = array( |
264 | 264 | 'VALUE' => $entry, |
265 | 265 | 'NAME' => $entry, |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | $dir->close(); |
271 | 271 | |
272 | - foreach($lang['opt_planet_sort_options'] as $key => &$value) { |
|
272 | + foreach ($lang['opt_planet_sort_options'] as $key => &$value) { |
|
273 | 273 | $template_result['.']['planet_sort_options'][] = array( |
274 | 274 | 'VALUE' => $key, |
275 | 275 | 'NAME' => $value, |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - foreach($lang['sys_gender_list'] as $key => $value) { |
|
280 | + foreach ($lang['sys_gender_list'] as $key => $value) { |
|
281 | 281 | $template_result['.']['gender_list'][] = array( |
282 | 282 | 'VALUE' => $key, |
283 | 283 | 'NAME' => $value, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | $lang_list = lng_get_list(); |
289 | - foreach($lang_list as $lang_id => $lang_data) { |
|
289 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
290 | 290 | $template_result['.']['languages'][] = array( |
291 | 291 | 'VALUE' => $lang_id, |
292 | 292 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | - if(isset($lang['menu_customize_show_hide_button_state'])) { |
|
299 | - foreach($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
298 | + if (isset($lang['menu_customize_show_hide_button_state'])) { |
|
299 | + foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
300 | 300 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
301 | 301 | 'ID' => $key, |
302 | 302 | 'NAME' => $value, |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | 'PAGE_HEADER' => $lang['opt_header'], |
408 | 408 | )); |
409 | 409 | |
410 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
411 | - if($option_group_id == OPT_MESSAGE) { |
|
412 | - foreach($sn_message_class_list as $message_class_id => $message_class_data) { |
|
413 | - if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
410 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
411 | + if ($option_group_id == OPT_MESSAGE) { |
|
412 | + foreach ($sn_message_class_list as $message_class_id => $message_class_data) { |
|
413 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
414 | 414 | $option_name = $message_class_data['name']; |
415 | 415 | |
416 | 416 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | } else { |
425 | - foreach($option_group as $option_name => $option_value) { |
|
426 | - if(array_key_exists($option_name, $user_option_types)) { |
|
425 | + foreach ($option_group as $option_name => $option_value) { |
|
426 | + if (array_key_exists($option_name, $user_option_types)) { |
|
427 | 427 | $option_type = $user_option_types[$option_name]; |
428 | 428 | } else { |
429 | 429 | $option_type = 'switch'; |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | // @version 1.0 |
5 | 5 | // @copyright 2008 by Chlorel for XNova |
6 | 6 | |
7 | -if(SN_IN_FLEET !== true) { |
|
7 | +if (SN_IN_FLEET !== true) { |
|
8 | 8 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $template = gettemplate('fleet1', true); |
12 | 12 | |
13 | 13 | $ships = sys_get_param('ships', array()); |
14 | -if(!is_array($ships)) { |
|
14 | +if (!is_array($ships)) { |
|
15 | 15 | $ships = array(); |
16 | 16 | } |
17 | 17 | |
18 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
18 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
19 | 19 | $template->assign_block_vars('possible_planet_type_id', array( |
20 | 20 | 'ID' => $possible_planet_type_id, |
21 | 21 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'START_NAME' => $planetrow['name'], |
29 | 29 | ); |
30 | 30 | |
31 | -if(!empty($TargetPlanet)) { |
|
31 | +if (!empty($TargetPlanet)) { |
|
32 | 32 | $template_route += array( |
33 | 33 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
34 | 34 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $template->assign_block_vars('fleets', $template_route); |
40 | 40 | |
41 | 41 | $sn_groups_fleet = sn_get_groups('fleet'); |
42 | -foreach($ships as $ship_id => $ship_count) { |
|
43 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
42 | +foreach ($ships as $ship_id => $ship_count) { |
|
43 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
44 | 44 | $ship_info = get_unit_param($ship_id); |
45 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
45 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
46 | 46 | $page .= $lang['fl_noenought']; |
47 | 47 | } else { |
48 | 48 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if(empty($fleet['fleetarray'])) { |
|
64 | +if (empty($fleet['fleetarray'])) { |
|
65 | 65 | messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
66 | 66 | } |
67 | 67 | |
68 | 68 | // Building list of shortcuts |
69 | 69 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
70 | -while($shortcut = db_fetch($query)) { |
|
70 | +while ($shortcut = db_fetch($query)) { |
|
71 | 71 | $template->assign_block_vars('shortcut', array( |
72 | 72 | 'NAME' => $shortcut['title'], |
73 | 73 | 'GALAXY' => $shortcut['galaxy'], |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Building list of own planets & moons |
84 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
85 | -if(count($colonies) > 1) { |
|
84 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
85 | +if (count($colonies) > 1) { |
|
86 | 86 | // while($row = db_fetch($colonies)) |
87 | - foreach($colonies as $row) { |
|
87 | + foreach ($colonies as $row) { |
|
88 | 88 | $template->assign_block_vars('colonies', array( |
89 | 89 | 'NAME' => $row['name'], |
90 | 90 | 'GALAXY' => $row['galaxy'], |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | //ACS Start |
100 | 100 | //Need to look for acs attacks. |
101 | 101 | $aks_madnessred = doquery('SELECT * FROM {{aks}};'); |
102 | -while($row = db_fetch($aks_madnessred)) { |
|
102 | +while ($row = db_fetch($aks_madnessred)) { |
|
103 | 103 | $members = explode(',', $row['eingeladen']); |
104 | - foreach($members as $a => $b) { |
|
104 | + foreach ($members as $a => $b) { |
|
105 | 105 | if ($b == $user['id']) { |
106 | 106 | $template->assign_block_vars('acss', array( |
107 | 107 | 'ID' => $row['id'], |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | function sn_eco_build($que_type, &$auser, &$planet) { |
19 | 19 | global $lang, $config, $template_result; |
20 | 20 | |
21 | - if($ally_id = sys_get_param_id('ally_id')) { |
|
21 | + if ($ally_id = sys_get_param_id('ally_id')) { |
|
22 | 22 | define('SN_IN_ALLY', true); |
23 | 23 | $ranks = ally_get_ranks($auser['ally']); |
24 | - if($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) { |
|
24 | + if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) { |
|
25 | 25 | $user = &$auser['ally']['player']; |
26 | 26 | $planet = array( |
27 | 27 | 'metal' => $user['metal'], |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - if(!$user) { |
|
34 | + if (!$user) { |
|
35 | 35 | $user = &$auser; |
36 | 36 | } |
37 | 37 | |
38 | - switch($action = sys_get_param_escaped('action')) { |
|
38 | + switch ($action = sys_get_param_escaped('action')) { |
|
39 | 39 | case 'create': // Add unit to que for build |
40 | 40 | case 'create_autoconvert': // Add unit to que for build |
41 | 41 | case 'destroy': // Add unit to que for remove |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | $group_missile = sn_get_groups('missile'); |
54 | 54 | $silo_capacity_free = 0; |
55 | - if($que_type == QUE_STRUCTURES) { |
|
55 | + if ($que_type == QUE_STRUCTURES) { |
|
56 | 56 | $build_unit_list = sn_get_groups('build_allow'); |
57 | 57 | $build_unit_list = $build_unit_list[$planet['planet_type']]; |
58 | 58 | $artifact_id = ART_NANO_BUILDER; |
59 | 59 | $page_header = $lang['tech'][UNIT_STRUCTURES]; |
60 | - } elseif($que_type == QUE_RESEARCH) { |
|
61 | - if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
|
60 | + } elseif ($que_type == QUE_RESEARCH) { |
|
61 | + if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
|
62 | 62 | messageBox($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]); |
63 | 63 | } |
64 | 64 | |
65 | - if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) { |
|
65 | + if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) { |
|
66 | 66 | messageBox($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]); |
67 | 67 | } |
68 | 68 | $build_unit_list = sn_get_groups('tech'); |
69 | 69 | $artifact_id = ART_HEURISTIC_CHIP; |
70 | 70 | $page_header = $lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''); |
71 | - } elseif($que_type == QUE_MERCENARY) { |
|
71 | + } elseif ($que_type == QUE_MERCENARY) { |
|
72 | 72 | // if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) { |
73 | 73 | // messageBox($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]); |
74 | 74 | // } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $artifact_id = 0; |
81 | 81 | $page_header = $lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''); |
82 | 82 | } else { |
83 | - if(mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) { |
|
83 | + if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) { |
|
84 | 84 | messageBox($lang['need_hangar'], $lang['tech'][STRUC_FACTORY_HANGAR]); |
85 | 85 | } |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $artifact_id = 0; |
90 | 90 | |
91 | 91 | $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY); |
92 | - foreach($group_missile as $unit_id) { |
|
92 | + foreach ($group_missile as $unit_id) { |
|
93 | 93 | $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE); |
94 | 94 | } |
95 | 95 | $silo_capacity_free = max(0, $silo_capacity_free); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | |
108 | 108 | $template = gettemplate('buildings_builds', true); |
109 | - if(!empty($operation_result)) { |
|
109 | + if (!empty($operation_result)) { |
|
110 | 110 | $template_result['.']['result'][] = $operation_result; |
111 | 111 | } |
112 | 112 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | $record_index = 0; |
138 | 138 | |
139 | - foreach($build_unit_list as $unit_id) { |
|
139 | + foreach ($build_unit_list as $unit_id) { |
|
140 | 140 | $level_base = mrc_get_level($user, $planet, $unit_id, false, true); |
141 | 141 | $level_effective = mrc_get_level($user, $planet, $unit_id); |
142 | 142 | $level_in_que = $in_que[$unit_id]; |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE]; |
160 | 160 | // Restricting $can_build by free silo capacity |
161 | 161 | $can_build = ($unit_is_missile = in_array($unit_id, $group_missile)) ? min($can_build, floor($silo_capacity_free / $unit_info[P_UNIT_SIZE])) : $can_build; |
162 | - if(!$can_build) { |
|
163 | - if(!$build_data['CAN'][BUILD_CREATE]) { |
|
162 | + if (!$can_build) { |
|
163 | + if (!$build_data['CAN'][BUILD_CREATE]) { |
|
164 | 164 | $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES; |
165 | - } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) { |
|
165 | + } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) { |
|
166 | 166 | $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL; |
167 | - } elseif($unit_info[P_MAX_STACK]) { |
|
167 | + } elseif ($unit_info[P_MAX_STACK]) { |
|
168 | 168 | $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED; |
169 | 169 | } |
170 | 170 | } |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | 'MAP_IS_RESOURCE' => !empty($unit_info[P_UNIT_PRODUCTION]), |
233 | 233 | ); |
234 | 234 | |
235 | - if($unit_stackable) { |
|
235 | + if ($unit_stackable) { |
|
236 | 236 | $level_production_base = array( |
237 | 237 | 'ACTUAL_SHIELD' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])), |
238 | 238 | 'ACTUAL_ARMOR' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])), |
239 | 239 | 'ACTUAL_WEAPON' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])), |
240 | 240 | ); |
241 | 241 | |
242 | - if($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) { |
|
242 | + if ($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) { |
|
243 | 243 | $ship_data = get_ship_data($unit_id, $user); |
244 | 244 | |
245 | 245 | $level_production_base += array( |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | ); |
250 | 250 | } |
251 | 251 | |
252 | - if($unit_info[P_UNIT_PRODUCTION]) { |
|
253 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
254 | - if($resource_income = |
|
252 | + if ($unit_info[P_UNIT_PRODUCTION]) { |
|
253 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
254 | + if ($resource_income = |
|
255 | 255 | floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc(1, 10, $user, $planet) |
256 | 256 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
257 | 257 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | $production['.']['resource'][] = $level_production_base; |
264 | - } elseif($unit_info[P_UNIT_PRODUCTION]) { |
|
264 | + } elseif ($unit_info[P_UNIT_PRODUCTION]) { |
|
265 | 265 | $level_production_base = array(); |
266 | 266 | $element_level_start = $level_effective + $in_que[$unit_id]; |
267 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
268 | - if($resource_income = |
|
267 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
268 | + if ($resource_income = |
|
269 | 269 | floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($element_level_start, 10, $user, $planet) |
270 | 270 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
271 | 271 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1; |
278 | - for($i = 0; $i < 6; $i++) { |
|
278 | + for ($i = 0; $i < 6; $i++) { |
|
279 | 279 | $level_production = array('LEVEL' => $level_start + $i); |
280 | - foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
281 | - if( |
|
280 | + foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) { |
|
281 | + if ( |
|
282 | 282 | $resource_income = floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($level_start + $i, 10, $user, $planet) |
283 | 283 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
284 | 284 | * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1))) |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | $production['.']['resource'][] = $level_production; |
291 | 291 | } |
292 | - } elseif($unit_id == TECH_ASTROTECH) { |
|
292 | + } elseif ($unit_id == TECH_ASTROTECH) { |
|
293 | 293 | $element_level_start = $level_effective + $in_que[$unit_id]; |
294 | 294 | $level_production_base = array( |
295 | 295 | UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start), |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | ); |
298 | 298 | |
299 | 299 | $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1; |
300 | - for($i = 0; $i < 6; $i++) { |
|
300 | + for ($i = 0; $i < 6; $i++) { |
|
301 | 301 | $level_production = array('LEVEL' => $level_start + $i); |
302 | 302 | $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i); |
303 | 303 | $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX]; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $template_result['.']['production'][] = $production; |
319 | 319 | } |
320 | 320 | |
321 | - foreach($lang['player_option_building_sort'] as $sort_id => $sort_text) { |
|
321 | + foreach ($lang['player_option_building_sort'] as $sort_id => $sort_text) { |
|
322 | 322 | $template->assign_block_vars('sort_values', array( |
323 | 323 | 'VALUE' => $sort_id, |
324 | 324 | 'TEXT' => $sort_text, |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | |
328 | 328 | $sort_option = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)]; |
329 | 329 | $sort_option_inverse = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)]; |
330 | - if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
331 | - switch($sort_option) { |
|
330 | + if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
331 | + switch ($sort_option) { |
|
332 | 332 | case PLAYER_OPTION_SORT_NAME: |
333 | 333 | $sort_option_field = 'NAME'; |
334 | 334 | break; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | break; |
344 | 344 | } |
345 | 345 | $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1; |
346 | - usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
346 | + usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
347 | 347 | return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : ( |
348 | 348 | $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0 |
349 | 349 | ); |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | // @version 1.0 |
6 | 6 | // @copyright 2008 by Chlorel for XNova |
7 | 7 | |
8 | -if($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
8 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
9 | 9 | define('IN_AJAX', true); |
10 | - if(!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
10 | + if (!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
11 | 11 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort); |
12 | 12 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0)); |
13 | 13 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | die(); |
17 | 17 | } |
18 | 18 | |
19 | -if(SN_IN_FLEET !== true) { |
|
19 | +if (SN_IN_FLEET !== true) { |
|
20 | 20 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
21 | 21 | } |
22 | 22 | |
23 | 23 | lng_include('overview'); |
24 | 24 | |
25 | -if(!$planetrow) { |
|
25 | +if (!$planetrow) { |
|
26 | 26 | messageBox($lang['fl_noplanetrow'], $lang['fl_error']); |
27 | 27 | } |
28 | 28 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | $record_index = 0; |
32 | 32 | $ship_list = array(); |
33 | -foreach(sn_get_groups('fleet') as $n => $unit_id) { |
|
33 | +foreach (sn_get_groups('fleet') as $n => $unit_id) { |
|
34 | 34 | $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true); |
35 | - if($unit_level > 0) { |
|
35 | + if ($unit_level > 0) { |
|
36 | 36 | $ship_data = get_ship_data($unit_id, $user); |
37 | 37 | $ship_list[$unit_id] = array( |
38 | 38 | '__INDEX' => $record_index++, |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT]; |
54 | 54 | $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]; |
55 | -if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
56 | - switch($fleet_ship_sort) { |
|
55 | +if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
56 | + switch ($fleet_ship_sort) { |
|
57 | 57 | case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break; |
58 | 58 | case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break; |
59 | 59 | case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break; |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | }); |
69 | 69 | } |
70 | 70 | |
71 | -foreach($ship_list as $ship_data) { |
|
71 | +foreach ($ship_list as $ship_data) { |
|
72 | 72 | $template->assign_block_vars('ships', $ship_data); |
73 | 73 | } |
74 | 74 | |
75 | -foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
75 | +foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
76 | 76 | $template->assign_block_vars('ship_sort_list', array( |
77 | 77 | 'VALUE' => $sort_id, |
78 | 78 | 'TEXT' => $sort_text, |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | function getSkinPathTemplate($userSkinPath) { |
15 | 15 | static $template_names = array(); |
16 | 16 | |
17 | - if(!isset($template_names[$userSkinPath])) { |
|
17 | + if (!isset($template_names[$userSkinPath])) { |
|
18 | 18 | $template_names[$userSkinPath] = file_exists(SN_ROOT_PHYSICAL . $userSkinPath . '_template.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $userSkinPath . '_template.ini') : TEMPLATE_NAME; |
19 | 19 | } |
20 | 20 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | function messageBoxAdminAccessDenied($level = AUTH_LEVEL_ADMINISTRATOR) { |
61 | 61 | global $user, $lang; |
62 | 62 | |
63 | - if($user['authlevel'] < $level) { |
|
63 | + if ($user['authlevel'] < $level) { |
|
64 | 64 | messageBoxAdmin($lang['adm_err_denied'], $lang['admin_title_access_denied'], SN_ROOT_VIRTUAL . 'overview.php'); |
65 | 65 | } |
66 | 66 | } |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @param $extra |
71 | 71 | */ |
72 | 72 | function tpl_menu_merge_extra(&$menu, &$extra) { |
73 | - if(empty($menu) || empty($extra)) { |
|
73 | + if (empty($menu) || empty($extra)) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
77 | - foreach($extra as $menu_item_id => $menu_item) { |
|
78 | - if(empty($menu_item['LOCATION'])) { |
|
77 | + foreach ($extra as $menu_item_id => $menu_item) { |
|
78 | + if (empty($menu_item['LOCATION'])) { |
|
79 | 79 | $menu[$menu_item_id] = $menu_item; |
80 | 80 | continue; |
81 | 81 | } |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | unset($menu_item['LOCATION']); |
85 | 85 | |
86 | 86 | $is_positioned = $item_location[0]; |
87 | - if($is_positioned == '+' || $is_positioned == '-') { |
|
87 | + if ($is_positioned == '+' || $is_positioned == '-') { |
|
88 | 88 | $item_location = substr($item_location, 1); |
89 | 89 | } else { |
90 | 90 | $is_positioned = ''; |
91 | 91 | } |
92 | 92 | |
93 | - if($item_location) { |
|
93 | + if ($item_location) { |
|
94 | 94 | $menu_keys = array_keys($menu); |
95 | 95 | $insert_position = array_search($item_location, $menu_keys); |
96 | - if($insert_position === false) { |
|
96 | + if ($insert_position === false) { |
|
97 | 97 | $insert_position = count($menu) - 1; |
98 | 98 | $is_positioned = '+'; |
99 | 99 | $item_location = ''; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $spliced = array_splice($menu, $insert_position, count($menu) - $insert_position); |
107 | 107 | $menu[$menu_item_id] = $menu_item; |
108 | 108 | |
109 | - if(!$is_positioned && $item_location) { |
|
109 | + if (!$is_positioned && $item_location) { |
|
110 | 110 | unset($spliced[$item_location]); |
111 | 111 | } |
112 | 112 | $menu = array_merge($menu, $spliced); |
@@ -122,24 +122,24 @@ discard block |
||
122 | 122 | function tpl_menu_assign_to_template(&$sn_menu, &$template) { |
123 | 123 | global $lang; |
124 | 124 | |
125 | - if(empty($sn_menu) || !is_array($sn_menu)) { |
|
125 | + if (empty($sn_menu) || !is_array($sn_menu)) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | - foreach($sn_menu as $menu_item_id => $menu_item) { |
|
130 | - if(!$menu_item) { |
|
129 | + foreach ($sn_menu as $menu_item_id => $menu_item) { |
|
130 | + if (!$menu_item) { |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | - if(is_string($menu_item_id)) { |
|
134 | + if (is_string($menu_item_id)) { |
|
135 | 135 | $menu_item['ID'] = $menu_item_id; |
136 | 136 | } |
137 | 137 | |
138 | - if($menu_item['TYPE'] == 'lang') { |
|
138 | + if ($menu_item['TYPE'] == 'lang') { |
|
139 | 139 | $lang_string = &$lang; |
140 | - if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
141 | - for($i = 1; $i < count($matches); $i++) { |
|
142 | - if(defined($matches[$i])) { |
|
140 | + if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
141 | + for ($i = 1; $i < count($matches); $i++) { |
|
142 | + if (defined($matches[$i])) { |
|
143 | 143 | $matches[$i] = constant($matches[$i]); |
144 | 144 | } |
145 | 145 | $lang_string = &$lang_string[$matches[$i]]; |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | $menu_item['ALT'] = htmlentities($menu_item['ALT']); |
152 | 152 | $menu_item['TITLE'] = htmlentities($menu_item['TITLE']); |
153 | 153 | |
154 | - if(!empty($menu_item['ICON'])) { |
|
155 | - if(is_string($menu_item['ICON'])) { |
|
154 | + if (!empty($menu_item['ICON'])) { |
|
155 | + if (is_string($menu_item['ICON'])) { |
|
156 | 156 | $menu_item['ICON_PATH'] = $menu_item['ICON']; |
157 | 157 | } else { |
158 | 158 | $menu_item['ICON'] = $menu_item_id; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'MENU_START_HIDE' => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'), |
185 | 185 | )); |
186 | 186 | |
187 | - if(isset($template_result['MENU_CUSTOMIZE'])) { |
|
187 | + if (isset($template_result['MENU_CUSTOMIZE'])) { |
|
188 | 188 | $template->assign_vars(array( |
189 | 189 | 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], |
190 | 190 | 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | )); |
199 | 199 | } |
200 | 200 | |
201 | - if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
201 | + if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
202 | 202 | tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra); |
203 | 203 | tpl_menu_assign_to_template($sn_menu_admin, $template); |
204 | 204 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return mixed |
221 | 221 | */ |
222 | 222 | function display($page, $title = '') { |
223 | - if(!defined('SN_TIME_RENDER_START')) { |
|
223 | + if (!defined('SN_TIME_RENDER_START')) { |
|
224 | 224 | define('SN_TIME_RENDER_START', microtime(true)); |
225 | 225 | } |
226 | 226 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $exitStatus = true; |
245 | 245 | $template_result['LOGIN_LOGOUT'] = $inLoginLogout = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true; |
246 | 246 | |
247 | - if(is_object($page)) { |
|
247 | + if (is_object($page)) { |
|
248 | 248 | isset($page->_rootref['PAGE_TITLE']) && empty($title) ? $title = $page->_rootref['PAGE_TITLE'] : false; |
249 | 249 | !$title && !empty($page->_rootref['PAGE_HEADER']) ? $title = $page->_rootref['PAGE_HEADER'] : false; |
250 | 250 | !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false; |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | $isRenderGlobal = is_object($page) && isset($template_result['GLOBAL_DISPLAY_HEADER']) ? $template_result['GLOBAL_DISPLAY_HEADER'] : true; |
254 | 254 | |
255 | 255 | // Global header |
256 | - if($isRenderGlobal) { |
|
256 | + if ($isRenderGlobal) { |
|
257 | 257 | renderHeader($page, $title, $template_result, $inLoginLogout, $user, $config, $lang, $planetrow); |
258 | 258 | } |
259 | 259 | |
260 | 260 | // Page content |
261 | 261 | !is_array($page) ? $page = array($page) : false; |
262 | 262 | $result_added = false; |
263 | - foreach($page as $page_item) { |
|
263 | + foreach ($page as $page_item) { |
|
264 | 264 | /** |
265 | 265 | * @var template $page_item |
266 | 266 | */ |
267 | - if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
267 | + if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
268 | 268 | $resultTemplate = gettemplate('_result_message'); |
269 | 269 | $resultTemplate->_tpldata = $page_item->_tpldata; |
270 | 270 | displayP($resultTemplate); |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | // Global footer |
284 | - if($isRenderGlobal) { |
|
284 | + if ($isRenderGlobal) { |
|
285 | 285 | renderFooter(); |
286 | 286 | } |
287 | 287 | |
288 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
288 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
289 | 289 | |
290 | 290 | sn_db_disconnect(); |
291 | 291 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param $planetrow |
304 | 304 | */ |
305 | 305 | function renderHeader($page, $title, &$template_result, $inLoginLogout, &$user, $config, $lang, $planetrow) { |
306 | - if(classSupernova::$headerRendered) { |
|
306 | + if (classSupernova::$headerRendered) { |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 | |
@@ -461,10 +461,10 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function cssAddFileName($cssFileName, &$cssArray) { |
463 | 463 | $result = false; |
464 | - if(file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.min.css')) { |
|
464 | + if (file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.min.css')) { |
|
465 | 465 | $cssArray[$cssFileName . '.min.css'] = ''; |
466 | 466 | $result = true; |
467 | - } elseif(file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.css')) { |
|
467 | + } elseif (file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.css')) { |
|
468 | 468 | $cssArray[$cssFileName . '.css'] = ''; |
469 | 469 | $result = true; |
470 | 470 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @param string $type |
557 | 557 | */ |
558 | 558 | function tpl_topnav_event_build(&$template, $fleet_flying_list, $type = 'fleet') { |
559 | - if(empty($fleet_flying_list)) { |
|
559 | + if (empty($fleet_flying_list)) { |
|
560 | 560 | return; |
561 | 561 | } |
562 | 562 | |
@@ -565,19 +565,19 @@ discard block |
||
565 | 565 | $fleet_event_count = 0; |
566 | 566 | $fleet_flying_sorter = array(); |
567 | 567 | $fleet_flying_events = array(); |
568 | - foreach($fleet_flying_list as &$fleet_flying_row) { |
|
568 | + foreach ($fleet_flying_list as &$fleet_flying_row) { |
|
569 | 569 | $will_return = true; |
570 | - if($fleet_flying_row['fleet_mess'] == 0) { |
|
570 | + if ($fleet_flying_row['fleet_mess'] == 0) { |
|
571 | 571 | // cut fleets on Hold and Expedition |
572 | - if($fleet_flying_row['fleet_start_time'] >= SN_TIME_NOW) { |
|
572 | + if ($fleet_flying_row['fleet_start_time'] >= SN_TIME_NOW) { |
|
573 | 573 | $fleet_flying_row['fleet_mission'] == MT_RELOCATE ? $will_return = false : false; |
574 | 574 | tpl_topnav_event_build_helper($fleet_flying_row['fleet_start_time'], EVENT_FLEET_ARRIVE, $lang['sys_event_arrive'], 'fleet_end_', !$will_return, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
575 | 575 | } |
576 | - if($fleet_flying_row['fleet_end_stay']) { |
|
576 | + if ($fleet_flying_row['fleet_end_stay']) { |
|
577 | 577 | tpl_topnav_event_build_helper($fleet_flying_row['fleet_end_stay'], EVENT_FLEET_STAY, $lang['sys_event_stay'], 'fleet_end_', false, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
578 | 578 | } |
579 | 579 | } |
580 | - if($will_return) { |
|
580 | + if ($will_return) { |
|
581 | 581 | tpl_topnav_event_build_helper($fleet_flying_row['fleet_end_time'], EVENT_FLEET_RETURN, $lang['sys_event_return'], 'fleet_start_', true, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
582 | 582 | } |
583 | 583 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | asort($fleet_flying_sorter); |
586 | 586 | |
587 | 587 | $fleet_flying_count = count($fleet_flying_list); |
588 | - foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
588 | + foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
589 | 589 | $fleet_event = &$fleet_flying_events[$fleet_event_id]; |
590 | 590 | $template->assign_block_vars("flying_{$type}s", array( |
591 | 591 | 'TIME' => max(0, $fleet_time - SN_TIME_NOW), |
@@ -615,15 +615,15 @@ discard block |
||
615 | 615 | function sn_tpl_render_topnav(&$user, $planetrow, $template) { |
616 | 616 | global $lang, $config, $sn_module_list, $template_result, $sn_mvc; |
617 | 617 | |
618 | - if(!is_array($user)) { |
|
618 | + if (!is_array($user)) { |
|
619 | 619 | return ''; |
620 | 620 | } |
621 | 621 | |
622 | 622 | $GET_mode = sys_get_param_str('mode'); |
623 | 623 | |
624 | 624 | $ThisUsersPlanets = DBStaticPlanet::db_planet_list_sorted($user); |
625 | - foreach($ThisUsersPlanets as $CurPlanet) { |
|
626 | - if($CurPlanet['destruyed']) { |
|
625 | + foreach ($ThisUsersPlanets as $CurPlanet) { |
|
626 | + if ($CurPlanet['destruyed']) { |
|
627 | 627 | continue; |
628 | 628 | } |
629 | 629 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | 'QUE_ID' => QUE_RESEARCH, |
668 | 668 | 'QUE_HTML' => 'topnav', |
669 | 669 | |
670 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
670 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
671 | 671 | |
672 | 672 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
673 | 673 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | 'QUE_STRUCTURES' => QUE_STRUCTURES, |
750 | 750 | )); |
751 | 751 | |
752 | - if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
752 | + if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
753 | 753 | tpl_set_resource_info($template, $planetrow); |
754 | 754 | $template->assign_vars(array( |
755 | 755 | 'SN_RENDER_NAVBAR_PLANET' => true, |
@@ -844,12 +844,12 @@ discard block |
||
844 | 844 | * @param template|string $template |
845 | 845 | */ |
846 | 846 | function displayP($template) { |
847 | - if(is_object($template)) { |
|
848 | - if(empty($template->parsed)) { |
|
847 | + if (is_object($template)) { |
|
848 | + if (empty($template->parsed)) { |
|
849 | 849 | parsetemplate($template); |
850 | 850 | } |
851 | 851 | |
852 | - foreach($template->files as $section => $filename) { |
|
852 | + foreach ($template->files as $section => $filename) { |
|
853 | 853 | $template->display($section); |
854 | 854 | } |
855 | 855 | } else { |
@@ -866,8 +866,8 @@ discard block |
||
866 | 866 | function templateObjectParse($template, $array = false) { |
867 | 867 | global $user; |
868 | 868 | |
869 | - if(!empty($array) && is_array($array)) { |
|
870 | - foreach($array as $key => $data) { |
|
869 | + if (!empty($array) && is_array($array)) { |
|
870 | + foreach ($array as $key => $data) { |
|
871 | 871 | $template->assign_var($key, $data); |
872 | 872 | } |
873 | 873 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | * @return mixed |
891 | 891 | */ |
892 | 892 | function parsetemplate($template, $array = false) { |
893 | - if(is_object($template)) { |
|
893 | + if (is_object($template)) { |
|
894 | 894 | return templateObjectParse($template, $array); |
895 | 895 | } else { |
896 | 896 | $search[] = '#\{L_([a-z0-9\-_]*?)\[([a-z0-9\-_]*?)\]\}#Ssie'; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | !empty($sn_mvc['i18n']['']) ? lng_load_i18n($sn_mvc['i18n']['']) : false; |
936 | 936 | $sn_page_name ? lng_load_i18n($sn_mvc['i18n'][$sn_page_name]) : false; |
937 | 937 | |
938 | - foreach($files as &$filename) { |
|
938 | + foreach ($files as &$filename) { |
|
939 | 939 | $filename = $filename . $template_ex; |
940 | 940 | } |
941 | 941 | |
@@ -960,13 +960,13 @@ discard block |
||
960 | 960 | 'LANG' => $language ? $language : '', |
961 | 961 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
962 | 962 | |
963 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
963 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
964 | 964 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
965 | 965 | )); |
966 | 966 | |
967 | - foreach(lng_get_list() as $lng_id => $lng_data) { |
|
968 | - if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
969 | - foreach($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
967 | + foreach (lng_get_list() as $lng_id => $lng_data) { |
|
968 | + if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
969 | + foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
970 | 970 | $lng_data1 = $lng_data; |
971 | 971 | $lng_data1 = array_merge($lng_data1, $lang_variant); |
972 | 972 | $template->assign_block_vars('language', $lng_data1); |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $fleet_flying_list = array(); |
987 | 987 | |
988 | 988 | $fleet_flying_list[0] = fleet_list_by_owner_id($user['id']); |
989 | - foreach($fleet_flying_list[0] as $fleet_id => $fleet_flying_row) { |
|
989 | + foreach ($fleet_flying_list[0] as $fleet_id => $fleet_flying_row) { |
|
990 | 990 | $fleet_flying_list[$fleet_flying_row['fleet_mission']][$fleet_id] = &$fleet_flying_list[0][$fleet_id]; |
991 | 991 | } |
992 | 992 | |
@@ -1005,8 +1005,8 @@ discard block |
||
1005 | 1005 | $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']]; |
1006 | 1006 | |
1007 | 1007 | $que_length = 0; |
1008 | - if(!empty($que)) { |
|
1009 | - foreach($que as $que_item) { |
|
1008 | + if (!empty($que)) { |
|
1009 | + foreach ($que as $que_item) { |
|
1010 | 1010 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
1011 | 1011 | } |
1012 | 1012 | $que_length = count($que); |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) { |
1024 | 1024 | global $lang; |
1025 | 1025 | |
1026 | - foreach($density_price_chart as $density_price_index => &$density_price_data) { |
|
1026 | + foreach ($density_price_chart as $density_price_index => &$density_price_data) { |
|
1027 | 1027 | $density_cost = $density_price_data; |
1028 | 1028 | $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false); |
1029 | 1029 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | function tpl_assign_select(&$template, $name, $values) { |
1048 | 1048 | !is_array($values) ? $values = array($values => $values) : false; |
1049 | 1049 | |
1050 | - foreach($values as $key => $value) { |
|
1050 | + foreach ($values as $key => $value) { |
|
1051 | 1051 | $template->assign_block_vars($name, array( |
1052 | 1052 | 'KEY' => htmlentities($key, ENT_COMPAT, 'UTF-8'), |
1053 | 1053 | 'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'), |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $title |
27 | 27 | * @param string $redirectTo |
28 | 28 | * @param int $timeout |
29 | - * @param bool|true $showHeader |
|
29 | + * @param boolean $showHeader |
|
30 | 30 | */ |
31 | 31 | function messageBox($message, $title = '', $redirectTo = '', $timeout = 5, $showHeader = true) { |
32 | 32 | global $lang, $template_result; |
@@ -60,6 +60,9 @@ discard block |
||
60 | 60 | messageBox($message, $title, $redirectTo, $timeout, false); |
61 | 61 | } |
62 | 62 | |
63 | +/** |
|
64 | + * @param integer $level |
|
65 | + */ |
|
63 | 66 | function messageBoxAdminAccessDenied($level = AUTH_LEVEL_ADMINISTRATOR) { |
64 | 67 | global $user, $lang; |
65 | 68 | |
@@ -215,10 +218,6 @@ discard block |
||
215 | 218 | /** |
216 | 219 | * @param template|string $page |
217 | 220 | * @param string $title |
218 | - * @param bool|true $isDisplayTopNav |
|
219 | - * @param string $metatags |
|
220 | - * @param bool|false $AdminPage |
|
221 | - * @param bool|true $isDisplayMenu |
|
222 | 221 | * |
223 | 222 | * @return mixed |
224 | 223 | */ |
@@ -233,11 +232,6 @@ discard block |
||
233 | 232 | /** |
234 | 233 | * @param template|string $page |
235 | 234 | * @param string $title |
236 | - * @param bool|true $isDisplayTopNav |
|
237 | - * @param string $metatags |
|
238 | - * @param bool|false $AdminPage |
|
239 | - * @param bool|true $isDisplayMenu |
|
240 | - * @param bool|int|string $exitStatus - Код или сообщение выхода |
|
241 | 235 | */ |
242 | 236 | function sn_display($page, $title = '') { |
243 | 237 | global $debug, $user, $planetrow, $config, $lang, $template_result, $sn_mvc, $sn_page_name; |
@@ -299,7 +293,7 @@ discard block |
||
299 | 293 | * @param $page |
300 | 294 | * @param $title |
301 | 295 | * @param $template_result |
302 | - * @param $inLoginLogout |
|
296 | + * @param boolean $inLoginLogout |
|
303 | 297 | * @param $user |
304 | 298 | * @param $config |
305 | 299 | * @param $lang |
@@ -423,7 +417,7 @@ discard block |
||
423 | 417 | } |
424 | 418 | |
425 | 419 | /** |
426 | - * @return mixed|string |
|
420 | + * @return string |
|
427 | 421 | */ |
428 | 422 | function playerFontSize() { |
429 | 423 | $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE]; |
@@ -458,7 +452,7 @@ discard block |
||
458 | 452 | /** |
459 | 453 | * Checks if minified/full-size CSS file exists - and adds it if any |
460 | 454 | * |
461 | - * @param $cssFileName |
|
455 | + * @param string $cssFileName |
|
462 | 456 | * @param &$cssArray |
463 | 457 | * |
464 | 458 | * @return bool |
@@ -531,10 +525,10 @@ discard block |
||
531 | 525 | |
532 | 526 | /** |
533 | 527 | * @param $time |
534 | - * @param $event |
|
528 | + * @param integer $event |
|
535 | 529 | * @param $msg |
536 | - * @param $prefix |
|
537 | - * @param $is_decrease |
|
530 | + * @param string $prefix |
|
531 | + * @param boolean $is_decrease |
|
538 | 532 | * @param $fleet_flying_row |
539 | 533 | * @param $fleet_flying_sorter |
540 | 534 | * @param $fleet_flying_events |
@@ -830,7 +824,7 @@ discard block |
||
830 | 824 | } |
831 | 825 | |
832 | 826 | /** |
833 | - * @param template|string $template |
|
827 | + * @param template $template |
|
834 | 828 | */ |
835 | 829 | function templateRenderToHtml($template) { |
836 | 830 | $output = null; |
@@ -865,7 +859,7 @@ discard block |
||
865 | 859 | * @param template $template |
866 | 860 | * @param array|bool $array |
867 | 861 | * |
868 | - * @return mixed |
|
862 | + * @return template |
|
869 | 863 | */ |
870 | 864 | function templateObjectParse($template, $array = false) { |
871 | 865 | global $user; |
@@ -888,7 +882,7 @@ discard block |
||
888 | 882 | } |
889 | 883 | |
890 | 884 | /** |
891 | - * @param template|string $template |
|
885 | + * @param template $template |
|
892 | 886 | * @param array|bool $array |
893 | 887 | * |
894 | 888 | * @return mixed |
@@ -911,7 +905,7 @@ discard block |
||
911 | 905 | } |
912 | 906 | |
913 | 907 | /** |
914 | - * @param array|string $files |
|
908 | + * @param string $files |
|
915 | 909 | * @param template|null $template |
916 | 910 | * @param string|null $template_path - path to template |
917 | 911 | * |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | // header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); |
6 | 6 | // @header("{$serverProtocol} 200 OK"); |
7 | -echo "File {$redirectFrom} not found on server. Contact administration if you think that this is error"; |
|
7 | +echo "file {$redirectFrom} not found on server. Contact administration if you think that this is error"; |
|
8 | 8 | die(); |
9 | 9 | ?> */ |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
20 | 20 | if (!intval($sensorLevel)) { |
21 | - messageBox ($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
21 | + messageBox($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ($planetrow['planet_type'] != PT_MOON) { |
25 | - messageBox ($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
25 | + messageBox($lang['phalanx_onlyformoons'], $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 | - messageBox ($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
43 | + messageBox($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cost = $sensorLevel * 1000; |
@@ -51,14 +51,14 @@ 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 | messageBox($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
57 | 57 | } |
58 | 58 | |
59 | -if($planet_scanned['destruyed']) |
|
59 | +if ($planet_scanned['destruyed']) |
|
60 | 60 | { |
61 | - messageBox ($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
61 | + messageBox($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}"); |