@@ -23,39 +23,39 @@ discard block |
||
23 | 23 | $mode = sys_get_param_str('mode'); |
24 | 24 | |
25 | 25 | $announce = array(); |
26 | -if($user['authlevel'] >= 3) { |
|
27 | - if(!empty($text)) { |
|
26 | +if ($user['authlevel'] >= 3) { |
|
27 | + if (!empty($text)) { |
|
28 | 28 | $announce_time = strtotime($announce_time, SN_TIME_NOW); |
29 | 29 | $announce_time = $announce_time ? $announce_time : SN_TIME_NOW; |
30 | 30 | |
31 | - if($mode == 'edit') { |
|
31 | + if ($mode == 'edit') { |
|
32 | 32 | db_news_update_set($announce_time, $text, $detail_url, $announce_id); |
33 | 33 | db_survey_delete_by_id($announce_id); |
34 | 34 | } else { |
35 | 35 | db_news_insert_set($announce_time, $text, $detail_url, $user); |
36 | 36 | $announce_id = db_insert_id(); |
37 | 37 | } |
38 | - if(($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
38 | + if (($survey_question = sys_get_param_str('survey_question')) && ($survey_answers = sys_get_param('survey_answers'))) { |
|
39 | 39 | $survey_answers = explode("\r\n", $survey_answers); |
40 | 40 | $survey_until = strtotime($survey_until = sys_get_param_str('survey_until'), SN_TIME_NOW); |
41 | 41 | $survey_until = date(FMT_DATE_TIME_SQL, $survey_until ? $survey_until : SN_TIME_NOW + PERIOD_DAY * 1); |
42 | 42 | db_survey_insert($announce_id, $survey_question, $survey_until); |
43 | 43 | $survey_id = db_insert_id(); |
44 | - foreach($survey_answers as $survey_answer) { |
|
44 | + foreach ($survey_answers as $survey_answer) { |
|
45 | 45 | $survey_answer = db_escape(trim($survey_answer)); |
46 | - if(empty($survey_answer)) { |
|
46 | + if (empty($survey_answer)) { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | db_survey_answer_insert($survey_id, $survey_answer); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - if($announce_time <= SN_TIME_NOW) { |
|
54 | - if($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
53 | + if ($announce_time <= SN_TIME_NOW) { |
|
54 | + if ($announce_time > $config->var_news_last && $announce_time == SN_TIME_NOW) { |
|
55 | 55 | $config->db_saveItem('var_news_last', $announce_time); |
56 | 56 | } |
57 | 57 | |
58 | - if(sys_get_param_int('news_mass_mail')) { |
|
58 | + if (sys_get_param_int('news_mass_mail')) { |
|
59 | 59 | $text = sys_get_param('text') . ($detail_url ? " <a href=\"{$detail_url}\"><span class=\"positive\">{$lang['news_more']}</span></a>" : ''); |
60 | 60 | msg_send_simple_message('*', 0, 0, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['news_title'], $text); |
61 | 61 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | $survey_answers = ''; |
69 | - switch($mode) { |
|
69 | + switch ($mode) { |
|
70 | 70 | case 'del': |
71 | 71 | db_news_delete_by_id($announce_id); |
72 | 72 | $mode = ''; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $template->assign_var('ID', $announce_id); |
77 | 77 | case 'copy': |
78 | 78 | $announce = db_news_with_survey_select_by_id($announce_id); |
79 | - if($announce['survey_id']) { |
|
79 | + if ($announce['survey_id']) { |
|
80 | 80 | $query = db_survey_answer_text_select_by_news($announce); |
81 | - while($row = db_fetch($query)) { |
|
81 | + while ($row = db_fetch($query)) { |
|
82 | 82 | $survey_answers[] = $row['survey_answer_text']; |
83 | 83 | } |
84 | 84 | $survey_answers = implode("\r\n", $survey_answers); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | $language_new = sys_get_param_str('langer', $user['lang']); |
24 | 24 | |
25 | - if($language_new != $user['lang']) { |
|
25 | + if ($language_new != $user['lang']) { |
|
26 | 26 | $lang->lng_switch($language_new); |
27 | 27 | } |
28 | 28 | |
@@ -31,35 +31,35 @@ discard block |
||
31 | 31 | |
32 | 32 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
33 | 33 | |
34 | - if(sys_get_param_str('mode') == 'change') { |
|
35 | - if($user['authlevel'] > 0) { |
|
34 | + if (sys_get_param_str('mode') == 'change') { |
|
35 | + if ($user['authlevel'] > 0) { |
|
36 | 36 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
37 | 37 | db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
38 | 38 | db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
39 | 39 | $user['admin_protection'] = $planet_protection; |
40 | 40 | } |
41 | 41 | |
42 | - if(sys_get_param_int('vacation') && !$config->user_vacation_disable) { |
|
42 | + if (sys_get_param_int('vacation') && !$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($lang['opt_vacation_err_timeout'], $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($lang['opt_vacation_err_your_fleet'], $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($lang['opt_vacation_err_que'], $lang['Error'], 'index.php?page=options', 5); |
58 | 58 | die(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
62 | - foreach($query as $planet) { |
|
62 | + foreach ($query as $planet) { |
|
63 | 63 | // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW); |
64 | 64 | // $planet = $planet['planet']; |
65 | 65 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | sn_db_transaction_commit(); |
78 | 78 | } |
79 | 79 | |
80 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
81 | - foreach($option_group as $option_name => $option_value) { |
|
82 | - if($user[$option_name] !== null) { |
|
80 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
81 | + foreach ($option_group as $option_name => $option_value) { |
|
82 | + if ($user[$option_name] !== null) { |
|
83 | 83 | $user[$option_name] = sys_get_param_str($option_name); |
84 | 84 | } else { |
85 | 85 | $user[$option_name] = $option_value; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | $player_options = sys_get_param('options'); |
93 | - if(!empty($player_options)) { |
|
94 | - array_walk($player_options, function (&$value) { |
|
93 | + if (!empty($player_options)) { |
|
94 | + array_walk($player_options, function(&$value) { |
|
95 | 95 | // TODO - Когда будет больше параметров - сделать больше проверок |
96 | 96 | $value = intval($value); |
97 | 97 | }); |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | |
103 | 103 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
104 | 104 | $username_safe = db_escape($username); |
105 | - 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)) { |
|
105 | + 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)) { |
|
106 | 106 | // проверка на корректность |
107 | 107 | sn_db_transaction_start(); |
108 | 108 | $name_check = db_player_name_history_get_name_by_name($username_safe); |
109 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
109 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
110 | 110 | $user = db_user_by_id($user['id'], true); |
111 | - switch($config->game_user_changename) { |
|
111 | + switch ($config->game_user_changename) { |
|
112 | 112 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
113 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
113 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
114 | 114 | $template_result['.']['result'][] = array( |
115 | 115 | 'STATUS' => ERR_ERROR, |
116 | 116 | 'MESSAGE' => $lang['opt_msg_name_change_err_no_dm'], |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | sn_db_transaction_commit(); |
141 | 141 | } |
142 | 142 | |
143 | - if($new_password = sys_get_param('newpass1')) { |
|
143 | + if ($new_password = sys_get_param('newpass1')) { |
|
144 | 144 | try { |
145 | - if($new_password != sys_get_param('newpass2')) { |
|
145 | + if ($new_password != sys_get_param('newpass2')) { |
|
146 | 146 | throw new Exception($lang['opt_err_pass_unmatched'], ERR_WARNING); |
147 | 147 | } |
148 | 148 | |
149 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
149 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
150 | 150 | throw new Exception($lang['opt_err_pass_wrong'], ERR_WARNING); |
151 | 151 | } |
152 | 152 | |
153 | 153 | throw new Exception($lang['opt_msg_pass_changed'], ERR_NONE); |
154 | - } catch(Exception $e) { |
|
154 | + } catch (Exception $e) { |
|
155 | 155 | $template_result['.']['result'][] = array( |
156 | 156 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
157 | 157 | 'MESSAGE' => $e->getMessage() |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
193 | 193 | |
194 | 194 | try { |
195 | - if($user['birthday']) { |
|
195 | + if ($user['birthday']) { |
|
196 | 196 | throw new exception(); |
197 | 197 | } |
198 | 198 | |
199 | 199 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
200 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
200 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
201 | 201 | throw new exception(); |
202 | 202 | } |
203 | 203 | |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
208 | 208 | asort($pos); |
209 | 209 | $i = 0; |
210 | - foreach($pos as &$position) { |
|
210 | + foreach ($pos as &$position) { |
|
211 | 211 | $position = ++$i; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
215 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
215 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
216 | 216 | throw new exception(); |
217 | 217 | } |
218 | 218 | |
219 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
219 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
220 | 220 | throw new exception(); |
221 | 221 | } |
222 | 222 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
225 | 225 | |
226 | 226 | $year = date('Y', SN_TIME_NOW); |
227 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
227 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
228 | 228 | $year--; |
229 | 229 | } |
230 | 230 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
231 | 231 | |
232 | 232 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
233 | - } catch(exception $e) { |
|
233 | + } catch (exception $e) { |
|
234 | 234 | $user_birthday = ''; |
235 | 235 | } |
236 | 236 | |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $template_result['.']['result'][] = $avatar_upload_result; |
241 | 241 | |
242 | 242 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
243 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
243 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
244 | 244 | playerTimeDiff::user_time_diff_set(array( |
245 | 245 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
246 | 246 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
247 | 247 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
248 | 248 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
249 | 249 | )); |
250 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
250 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
251 | 251 | playerTimeDiff::user_time_diff_set(array( |
252 | 252 | PLAYER_OPTION_TIME_DIFF => '', |
253 | 253 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | 'STATUS' => ERR_NONE, |
268 | 268 | 'MESSAGE' => $lang['opt_msg_saved'] |
269 | 269 | ); |
270 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
270 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
271 | 271 | $template_result['.']['result'][] = array( |
272 | 272 | 'STATUS' => ERR_NONE, |
273 | 273 | 'MESSAGE' => $lang['opt_msg_saved'] |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | // ); |
296 | 296 | |
297 | 297 | $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
298 | - while(($entry = $dir->read()) !== false) { |
|
299 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
298 | + while (($entry = $dir->read()) !== false) { |
|
299 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
300 | 300 | $template_result['.']['skin_list'][] = array( |
301 | 301 | 'VALUE' => $entry, |
302 | 302 | 'NAME' => $entry, |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | $dir->close(); |
308 | 308 | |
309 | - foreach($lang['opt_planet_sort_options'] as $key => &$value) { |
|
309 | + foreach ($lang['opt_planet_sort_options'] as $key => &$value) { |
|
310 | 310 | $template_result['.']['planet_sort_options'][] = array( |
311 | 311 | 'VALUE' => $key, |
312 | 312 | 'NAME' => $value, |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | ); |
323 | 323 | } |
324 | 324 | */ |
325 | - foreach($lang['sys_gender_list'] as $key => $value) { |
|
325 | + foreach ($lang['sys_gender_list'] as $key => $value) { |
|
326 | 326 | $template_result['.']['gender_list'][] = array( |
327 | 327 | 'VALUE' => $key, |
328 | 328 | 'NAME' => $value, |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | $lang_list = lng_get_list(); |
334 | - foreach($lang_list as $lang_id => $lang_data) { |
|
334 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
335 | 335 | $template_result['.']['languages'][] = array( |
336 | 336 | 'VALUE' => $lang_id, |
337 | 337 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | |
343 | - if(isset($lang['menu_customize_show_hide_button_state'])) { |
|
344 | - foreach($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
343 | + if (isset($lang['menu_customize_show_hide_button_state'])) { |
|
344 | + foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
345 | 345 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
346 | 346 | 'ID' => $key, |
347 | 347 | 'NAME' => $value, |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | 'PAGE_HEADER' => $lang['opt_header'], |
452 | 452 | )); |
453 | 453 | |
454 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
455 | - if($option_group_id == OPT_MESSAGE) { |
|
456 | - foreach($sn_message_class_list as $message_class_id => $message_class_data) { |
|
457 | - if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
454 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
455 | + if ($option_group_id == OPT_MESSAGE) { |
|
456 | + foreach ($sn_message_class_list as $message_class_id => $message_class_data) { |
|
457 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
458 | 458 | $option_name = $message_class_data['name']; |
459 | 459 | |
460 | 460 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | } |
467 | 467 | } |
468 | 468 | } else { |
469 | - foreach($option_group as $option_name => $option_value) { |
|
470 | - if(array_key_exists($option_name, $user_option_types)) { |
|
469 | + foreach ($option_group as $option_name => $option_value) { |
|
470 | + if (array_key_exists($option_name, $user_option_types)) { |
|
471 | 471 | $option_type = $user_option_types[$option_name]; |
472 | 472 | } else { |
473 | 473 | $option_type = 'switch'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS; |
37 | 37 | |
38 | 38 | $mode = sys_get_param_int('mode'); |
39 | - switch($mode) { |
|
39 | + switch ($mode) { |
|
40 | 40 | case CHAT_MODE_ALLY: |
41 | 41 | $template_result['ALLY'] = intval($user['ally_id']); |
42 | 42 | $page_title = $lang['chat_ally']; |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $template_result['.']['smiles'] = array(); |
52 | - foreach($supernova->design['smiles'] as $auth_level => $replaces) { |
|
53 | - if($auth_level > $user_auth_level) { |
|
52 | + foreach ($supernova->design['smiles'] as $auth_level => $replaces) { |
|
53 | + if ($auth_level > $user_auth_level) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - foreach($replaces as $bbcode => $filename) { |
|
57 | + foreach ($replaces as $bbcode => $filename) { |
|
58 | 58 | $template_result['.']['smiles'][] = array( |
59 | 59 | 'BBCODE' => $bbcode, |
60 | 60 | 'FILENAME' => $filename, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | define('IN_AJAX', true); |
78 | 78 | $skip_fleet_update = true; |
79 | 79 | |
80 | - if($config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) { |
|
80 | + if ($config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) { |
|
81 | 81 | die(); |
82 | 82 | } |
83 | 83 | |
84 | - if(($message = sys_get_param_str('message')) && $user['username']) { |
|
84 | + if (($message = sys_get_param_str('message')) && $user['username']) { |
|
85 | 85 | $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
86 | 86 | $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id)))); |
87 | 87 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $skip_fleet_update = true; |
103 | 103 | |
104 | 104 | $history = sys_get_param_str('history'); |
105 | - if(!$history) { |
|
105 | + if (!$history) { |
|
106 | 106 | $config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO); |
107 | 107 | } |
108 | 108 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $last_message = ''; |
111 | 111 | $alliance = 0; |
112 | 112 | $template_result['.']['chat'] = array(); |
113 | - if(!$history && $config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) { |
|
113 | + if (!$history && $config->_MODE != CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout) { |
|
114 | 114 | $result['disable'] = true; |
115 | 115 | $template_result['.']['chat'][] = array( |
116 | 116 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | |
124 | 124 | $where_add = ''; |
125 | 125 | $last_message = 0; |
126 | - if($history) { |
|
126 | + if ($history) { |
|
127 | 127 | $rows = db_chat_message_count_by_ally($alliance); |
128 | 128 | $page_count = ceil($rows['CNT'] / $page_limit); |
129 | 129 | |
130 | - for($i = 0; $i < $page_count; $i++) { |
|
130 | + for ($i = 0; $i < $page_count; $i++) { |
|
131 | 131 | $template_result['.']['page'][] = array( |
132 | 132 | 'NUMBER' => $i |
133 | 133 | ); |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | |
142 | 142 | $start_row = $page * $page_limit; |
143 | 143 | $query = db_chat_message_get_page($alliance, $where_add, $start_row, $page_limit); |
144 | - while($chat_row = db_fetch($query)) { |
|
144 | + while ($chat_row = db_fetch($query)) { |
|
145 | 145 | // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick |
146 | 146 | $chat_row['user'] = player_nick_render_to_html($chat_row['user']); |
147 | 147 | $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8'); |
148 | 148 | $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']); |
149 | - if(!$history) { |
|
149 | + if (!$history) { |
|
150 | 150 | $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>"; |
151 | 151 | } |
152 | 152 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $template = gettemplate('chat_messages', $template); |
172 | 172 | $template->assign_recursive($template_result); |
173 | 173 | |
174 | - if($history) { |
|
174 | + if ($history) { |
|
175 | 175 | display($template, "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true); |
176 | 176 | } else { |
177 | 177 | $result['last_message'] = $last_message; |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | function sn_function_call($func_name, $func_arg = array()) { |
15 | 15 | global $functions; // All data in $functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
16 | 16 | |
17 | - if(is_array($functions[$func_name]) && !is_callable($functions[$func_name])) { |
|
17 | + if (is_array($functions[$func_name]) && !is_callable($functions[$func_name])) { |
|
18 | 18 | // Chain-callable functions should be made as following: |
19 | 19 | // 1. Never use incomplete calls with parameters "by default" |
20 | 20 | // 2. Reserve last parameter for cumulative result |
21 | 21 | // 3. Use same format for original value and cumulative result (if there is original value) |
22 | 22 | // 4. Honor cumulative result |
23 | 23 | // 5. Return cumulative result |
24 | - foreach($functions[$func_name] as $func_chain_name) { |
|
24 | + foreach ($functions[$func_name] as $func_chain_name) { |
|
25 | 25 | // По идее - это уже тут не нужно, потому что оно все должно быть callable к этому моменту |
26 | 26 | // Но для старых модулей... |
27 | - if(is_callable($func_chain_name)) { |
|
27 | + if (is_callable($func_chain_name)) { |
|
28 | 28 | $result = call_user_func_array($func_chain_name, $func_arg); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | } else { |
32 | 32 | // TODO: This is left for backward compatibility. Appropriate code should be rewrote! |
33 | 33 | $func_name = isset($functions[$func_name]) && is_callable($functions[$func_name]) ? $functions[$func_name] : ('sn_' . $func_name); |
34 | - if(is_callable($func_name)) { |
|
34 | + if (is_callable($func_name)) { |
|
35 | 35 | $result = call_user_func_array($func_name, $func_arg); |
36 | 36 | } |
37 | 37 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * @param string $page_name - имя страницы, для которого должен был быть выполнен хук |
47 | 47 | */ |
48 | 48 | function execute_hooks(&$hook_list, &$template, $hook_type = null, $page_name = null) { |
49 | - if(!empty($hook_list)) { |
|
50 | - foreach($hook_list as $hook) { |
|
51 | - if(is_callable($hook_call = (is_string($hook) ? $hook : (is_array($hook) ? $hook['callable'] : $hook->callable)))) { |
|
49 | + if (!empty($hook_list)) { |
|
50 | + foreach ($hook_list as $hook) { |
|
51 | + if (is_callable($hook_call = (is_string($hook) ? $hook : (is_array($hook) ? $hook['callable'] : $hook->callable)))) { |
|
52 | 52 | $template = call_user_func($hook_call, $template, $hook_type, $page_name); |
53 | 53 | } |
54 | 54 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | |
149 | 149 | function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) { |
150 | 150 | $n = floatval($n); |
151 | - if(is_int($floor)) { |
|
151 | + if (is_int($floor)) { |
|
152 | 152 | $n = round($n, $floor); // , PHP_ROUND_HALF_DOWN |
153 | - } elseif($floor === true) { |
|
153 | + } elseif ($floor === true) { |
|
154 | 154 | $n = floor($n); |
155 | 155 | $floor = 0; |
156 | 156 | } else { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $ret = $n; |
161 | 161 | |
162 | 162 | $suffix = ''; |
163 | - if($limit) { |
|
164 | - if($ret > 0) { |
|
165 | - while($ret > $limit) { |
|
163 | + if ($limit) { |
|
164 | + if ($ret > 0) { |
|
165 | + while ($ret > $limit) { |
|
166 | 166 | $suffix .= 'k'; |
167 | 167 | $ret = round($ret / 1000); |
168 | 168 | } |
169 | 169 | } else { |
170 | - while($ret < -$limit) { |
|
170 | + while ($ret < -$limit) { |
|
171 | 171 | $suffix .= 'k'; |
172 | 172 | $ret = round($ret / 1000); |
173 | 173 | } |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | $ret = number_format($ret, $floor, ',', '.'); |
178 | 178 | $ret .= $suffix; |
179 | 179 | |
180 | - if($color !== false) { |
|
181 | - if($color === true) { |
|
180 | + if ($color !== false) { |
|
181 | + if ($color === true) { |
|
182 | 182 | $class = $n == 0 ? 'zero' : ($n > 0 ? 'positive' : 'negative'); |
183 | - } elseif($color >= 0) { |
|
183 | + } elseif ($color >= 0) { |
|
184 | 184 | $class = $n == $color ? 'zero' : ($n < $color ? 'positive' : 'negative'); |
185 | 185 | } else { |
186 | 186 | $class = ($n == -$color) ? 'zero' : ($n < -$color ? 'negative' : 'positive'); |
187 | 187 | } |
188 | 188 | |
189 | - if(!isset($style)) { |
|
189 | + if (!isset($style)) { |
|
190 | 190 | $ret = "<span class='{$class}'>{$ret}</span>"; |
191 | 191 | } else { |
192 | 192 | $ret = $style ? $ret = $class : $ret = array('text' => $ret, 'class' => $class); |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | |
312 | 312 | function sys_get_param_phone($param_name, $default = '') { |
313 | 313 | $phone_raw = sys_get_param_str_unsafe($param_name, $default = ''); |
314 | - if($phone_raw) { |
|
314 | + if ($phone_raw) { |
|
315 | 315 | $phone = $phone_raw[0] == '+' ? '+' : ''; |
316 | - for($i = 0; $i < strlen($phone_raw); $i++) { |
|
316 | + for ($i = 0; $i < strlen($phone_raw); $i++) { |
|
317 | 317 | $ord = ord($phone_raw[$i]); |
318 | - if($ord >= 48 && $ord <= 57) { |
|
318 | + if ($ord >= 48 && $ord <= 57) { |
|
319 | 319 | $phone .= $phone_raw[$i]; |
320 | 320 | } |
321 | 321 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | function CheckAbandonPlanetState(&$planet) { |
335 | - if($planet['destruyed'] && $planet['destruyed'] <= SN_TIME_NOW) { |
|
335 | + if ($planet['destruyed'] && $planet['destruyed'] <= SN_TIME_NOW) { |
|
336 | 336 | db_planet_delete_by_id($planet['id']); |
337 | 337 | } |
338 | 338 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | global $config; |
342 | 342 | |
343 | 343 | static $rate, $sn_group_resources_all, $sn_group_resources_loot; |
344 | - if(!$rate) { |
|
344 | + if (!$rate) { |
|
345 | 345 | $sn_group_resources_all = sn_get_groups('resources_all'); |
346 | 346 | $sn_group_resources_loot = sn_get_groups('resources_loot'); |
347 | 347 | |
@@ -351,19 +351,19 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | $unit_cost_data = get_unit_param($unit_id, 'cost'); |
354 | - if(!is_array($unit_cost_data)) { |
|
354 | + if (!is_array($unit_cost_data)) { |
|
355 | 355 | return array('total' => 0); |
356 | 356 | } |
357 | 357 | $factor = isset($unit_cost_data['factor']) ? $unit_cost_data['factor'] : 1; |
358 | 358 | $cost_array = array(BUILD_CREATE => array(), 'total' => 0); |
359 | 359 | $unit_level = $unit_level > 0 ? $unit_level : 0; |
360 | - foreach($unit_cost_data as $resource_id => $resource_amount) { |
|
361 | - if(!in_array($resource_id, $sn_group_resources_all)) { |
|
360 | + foreach ($unit_cost_data as $resource_id => $resource_amount) { |
|
361 | + if (!in_array($resource_id, $sn_group_resources_all)) { |
|
362 | 362 | continue; |
363 | 363 | } |
364 | 364 | // $cost_array[BUILD_CREATE][$resource_id] = $resource_amount * ($factor == 1 ? $unit_level : ((pow($factor, $unit_level) - $factor) / ($factor - 1))); |
365 | 365 | $cost_array[BUILD_CREATE][$resource_id] = round($resource_amount * ($factor == 1 ? $unit_level : ((1 - pow($factor, $unit_level)) / (1 - $factor)))); |
366 | - if(in_array($resource_id, $sn_group_resources_loot)) { |
|
366 | + if (in_array($resource_id, $sn_group_resources_loot)) { |
|
367 | 367 | $cost_array['total'] += $cost_array[BUILD_CREATE][$resource_id] * $rate[$resource_id]; |
368 | 368 | } |
369 | 369 | } |
@@ -438,19 +438,19 @@ discard block |
||
438 | 438 | $mercenary_level = 0; |
439 | 439 | $unit_db_name = pname_resource_name($unit_id); |
440 | 440 | |
441 | - if(in_array($unit_id, sn_get_groups(array('plans', 'mercenaries', 'tech', 'artifacts')))) { |
|
441 | + if (in_array($unit_id, sn_get_groups(array('plans', 'mercenaries', 'tech', 'artifacts')))) { |
|
442 | 442 | $unit = classSupernova::db_get_unit_by_location($user['id'], LOC_USER, $user['id'], $unit_id); |
443 | 443 | $mercenary_level = is_array($unit) && $unit['unit_level'] ? $unit['unit_level'] : 0; |
444 | - } elseif(in_array($unit_id, sn_get_groups(array('structures', 'fleet', 'defense')))) { |
|
444 | + } elseif (in_array($unit_id, sn_get_groups(array('structures', 'fleet', 'defense')))) { |
|
445 | 445 | $unit = classSupernova::db_get_unit_by_location(is_array($user) ? $user['id'] : $planet['id_owner'], LOC_PLANET, $planet['id'], $unit_id); |
446 | 446 | $mercenary_level = is_array($unit) && $unit['unit_level'] ? $unit['unit_level'] : 0; |
447 | - } elseif(in_array($unit_id, sn_get_groups('governors'))) { |
|
447 | + } elseif (in_array($unit_id, sn_get_groups('governors'))) { |
|
448 | 448 | $mercenary_level = $unit_id == $planet['PLANET_GOVERNOR_ID'] ? $planet['PLANET_GOVERNOR_LEVEL'] : 0; |
449 | - } elseif($unit_id == RES_DARK_MATTER) { |
|
449 | + } elseif ($unit_id == RES_DARK_MATTER) { |
|
450 | 450 | $mercenary_level = $user[$unit_db_name] + ($plain || $user['user_as_ally'] ? 0 : classSupernova::$auth->account->account_metamatter); |
451 | - } elseif($unit_id == RES_METAMATTER) { |
|
451 | + } elseif ($unit_id == RES_METAMATTER) { |
|
452 | 452 | $mercenary_level = classSupernova::$auth->account->account_metamatter; //$user[$unit_db_name]; |
453 | - } elseif(in_array($unit_id, sn_get_groups(array('resources_loot'))) || $unit_id == UNIT_SECTOR) { |
|
453 | + } elseif (in_array($unit_id, sn_get_groups(array('resources_loot'))) || $unit_id == UNIT_SECTOR) { |
|
454 | 454 | $mercenary_level = !empty($planet) ? $planet[$unit_db_name] : $user[$unit_db_name]; |
455 | 455 | } |
456 | 456 | |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | function mrc_modify_value(&$user, $planet = array(), $mercenaries, $value) { return sn_function_call(__FUNCTION__, array(&$user, $planet, $mercenaries, $value)); } |
461 | 461 | |
462 | 462 | function sn_mrc_modify_value(&$user, $planet = array(), $mercenaries, $value, $base_value = null) { |
463 | - if(!is_array($mercenaries)) { |
|
463 | + if (!is_array($mercenaries)) { |
|
464 | 464 | $mercenaries = array($mercenaries); |
465 | 465 | } |
466 | 466 | |
467 | 467 | $base_value = isset($base_value) ? $base_value : $value; |
468 | 468 | |
469 | - foreach($mercenaries as $mercenary_id) { |
|
469 | + foreach ($mercenaries as $mercenary_id) { |
|
470 | 470 | $mercenary_level = mrc_get_level($user, $planet, $mercenary_id); |
471 | 471 | |
472 | 472 | $mercenary = get_unit_param($mercenary_id); |
473 | 473 | $mercenary_bonus = $mercenary['bonus']; |
474 | 474 | |
475 | - switch($mercenary['bonus_type']) { |
|
475 | + switch ($mercenary['bonus_type']) { |
|
476 | 476 | case BONUS_PERCENT_CUMULATIVE: |
477 | 477 | $value *= 1 + $mercenary_level * $mercenary_bonus / 100; |
478 | 478 | break; |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $allowed_length = strlen($allowed_chars); |
504 | 504 | |
505 | 505 | $random_string = ''; |
506 | - for($i = 0; $i < $length; $i++) { |
|
506 | + for ($i = 0; $i < $length; $i++) { |
|
507 | 507 | $random_string .= $allowed_chars[mt_rand(0, $allowed_length - 1)]; |
508 | 508 | } |
509 | 509 | |
@@ -523,12 +523,12 @@ discard block |
||
523 | 523 | |
524 | 524 | $options = ''; |
525 | 525 | $option_list = array(); |
526 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
526 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
527 | 527 | $option_list[$option_group_id] = array(); |
528 | - foreach($option_group as $option_name => $option_value) { |
|
529 | - if(!isset($user[$option_name])) { |
|
528 | + foreach ($option_group as $option_name => $option_value) { |
|
529 | + if (!isset($user[$option_name])) { |
|
530 | 530 | $user[$option_name] = $option_value; |
531 | - } elseif($user[$option_name] == '') { |
|
531 | + } elseif ($user[$option_name] == '') { |
|
532 | 532 | $user[$option_name] = 0; |
533 | 533 | } |
534 | 534 | $options .= "{$option_name}^{$user[$option_name]}|"; |
@@ -548,16 +548,16 @@ discard block |
||
548 | 548 | $option_list = array(); |
549 | 549 | $option_string_list = explode('|', $user['options']); |
550 | 550 | |
551 | - foreach($option_string_list as $option_string) { |
|
551 | + foreach ($option_string_list as $option_string) { |
|
552 | 552 | list($option_name, $option_value) = explode('^', $option_string); |
553 | 553 | $option_list[$option_name] = $option_value; |
554 | 554 | } |
555 | 555 | |
556 | 556 | $final_list = array(); |
557 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
557 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
558 | 558 | $final_list[$option_group_id] = array(); |
559 | - foreach($option_group as $option_name => $option_value) { |
|
560 | - if(!isset($option_list[$option_name])) { |
|
559 | + foreach ($option_group as $option_name => $option_value) { |
|
560 | + if (!isset($option_list[$option_name])) { |
|
561 | 561 | $option_list[$option_name] = $option_value; |
562 | 562 | } |
563 | 563 | $user[$option_name] = $final_list[$option_group_id][$option_name] = $option_list[$option_name]; |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | |
572 | 572 | function sys_unit_str2arr($fleet_string) { |
573 | 573 | $fleet_array = array(); |
574 | - if(!empty($fleet_string)) { |
|
574 | + if (!empty($fleet_string)) { |
|
575 | 575 | $arrTemp = explode(';', $fleet_string); |
576 | - foreach($arrTemp as $temp) { |
|
577 | - if($temp) { |
|
576 | + foreach ($arrTemp as $temp) { |
|
577 | + if ($temp) { |
|
578 | 578 | $temp = explode(',', $temp); |
579 | - if(!empty($temp[0]) && !empty($temp[1])) { |
|
579 | + if (!empty($temp[0]) && !empty($temp[1])) { |
|
580 | 580 | $fleet_array[$temp[0]] += $temp[1]; |
581 | 581 | } |
582 | 582 | } |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | |
589 | 589 | function sys_unit_arr2str($unit_list) { |
590 | 590 | $fleet_string = array(); |
591 | - if(isset($unit_list)) { |
|
592 | - if(!is_array($unit_list)) { |
|
591 | + if (isset($unit_list)) { |
|
592 | + if (!is_array($unit_list)) { |
|
593 | 593 | $unit_list = array($unit_list => 1); |
594 | 594 | } |
595 | 595 | |
596 | - foreach($unit_list as $unit_id => $unit_count) { |
|
597 | - if($unit_id && $unit_count) { |
|
596 | + foreach ($unit_list as $unit_id => $unit_count) { |
|
597 | + if ($unit_id && $unit_count) { |
|
598 | 598 | $fleet_string[] = "{$unit_id},{$unit_count}"; |
599 | 599 | } |
600 | 600 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $body = str_replace("\r\n", "\n", $body); |
622 | 622 | $body = str_replace("\n", "\r\n", $body); |
623 | 623 | |
624 | - if($html) { |
|
624 | + if ($html) { |
|
625 | 625 | $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>'; |
626 | 626 | } |
627 | 627 | |
@@ -665,21 +665,21 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | function sn_ali_fill_user_ally(&$user) { |
668 | - if(!$user['ally_id']) { |
|
668 | + if (!$user['ally_id']) { |
|
669 | 669 | return; |
670 | 670 | } |
671 | 671 | |
672 | - if(!isset($user['ally'])) { |
|
672 | + if (!isset($user['ally'])) { |
|
673 | 673 | $user['ally'] = db_ally_get_by_id($user['ally_id']); |
674 | 674 | } |
675 | 675 | |
676 | - if(!isset($user['ally']['player'])) { |
|
676 | + if (!isset($user['ally']['player'])) { |
|
677 | 677 | $user['ally']['player'] = db_user_by_id($user['ally']['ally_user_id'], true, '*', false); |
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
681 | 681 | function sn_get_url_contents($url) { |
682 | - if(function_exists('curl_init')) { |
|
682 | + if (function_exists('curl_init')) { |
|
683 | 683 | $crl = curl_init(); |
684 | 684 | $timeout = 5; |
685 | 685 | curl_setopt($crl, CURLOPT_URL, $url); |
@@ -714,10 +714,10 @@ discard block |
||
714 | 714 | |
715 | 715 | function get_ship_data($ship_id, $user) { |
716 | 716 | $ship_data = array(); |
717 | - if(in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) { |
|
718 | - foreach(get_unit_param($ship_id, 'engine') as $engine_info) { |
|
717 | + if (in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) { |
|
718 | + foreach (get_unit_param($ship_id, 'engine') as $engine_info) { |
|
719 | 719 | $tech_level = intval(mrc_get_level($user, false, $engine_info['tech'])); |
720 | - if(empty($ship_data) || $tech_level >= $engine_info['min_level']) { |
|
720 | + if (empty($ship_data) || $tech_level >= $engine_info['min_level']) { |
|
721 | 721 | $ship_data = $engine_info; |
722 | 722 | $ship_data['tech_level'] = $tech_level; |
723 | 723 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | return $ship_data; |
730 | 730 | } |
731 | 731 | |
732 | -if(!function_exists('strptime')) { |
|
732 | +if (!function_exists('strptime')) { |
|
733 | 733 | function strptime($date, $format) { |
734 | 734 | $masks = array( |
735 | 735 | '%d' => '(?P<d>[0-9]{2})', |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | ); |
743 | 743 | |
744 | 744 | $rexep = "#" . strtr(preg_quote($format), $masks) . "#"; |
745 | - if(preg_match($rexep, $date, $out)) { |
|
745 | + if (preg_match($rexep, $date, $out)) { |
|
746 | 746 | $ret = array( |
747 | - "tm_sec" => (int)$out['S'], |
|
748 | - "tm_min" => (int)$out['M'], |
|
749 | - "tm_hour" => (int)$out['H'], |
|
750 | - "tm_mday" => (int)$out['d'], |
|
747 | + "tm_sec" => (int) $out['S'], |
|
748 | + "tm_min" => (int) $out['M'], |
|
749 | + "tm_hour" => (int) $out['H'], |
|
750 | + "tm_mday" => (int) $out['d'], |
|
751 | 751 | "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, |
752 | 752 | "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0, |
753 | 753 | ); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | function sn_sys_sector_buy($redirect = 'overview.php') { |
763 | 763 | global $lang, $user, $planetrow; |
764 | 764 | |
765 | - if(!sys_get_param_str('sector_buy') || $planetrow['planet_type'] != PT_PLANET) { |
|
765 | + if (!sys_get_param_str('sector_buy') || $planetrow['planet_type'] != PT_PLANET) { |
|
766 | 766 | return; |
767 | 767 | } |
768 | 768 | |
@@ -775,9 +775,9 @@ discard block |
||
775 | 775 | // $planetrow = $planetrow['planet']; |
776 | 776 | $sector_cost = eco_get_build_data($user, $planetrow, UNIT_SECTOR, mrc_get_level($user, $planetrow, UNIT_SECTOR), true); |
777 | 777 | $sector_cost = $sector_cost[BUILD_CREATE][RES_DARK_MATTER]; |
778 | - if($sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER)) { |
|
778 | + if ($sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER)) { |
|
779 | 779 | $planet_name_text = uni_render_planet($planetrow); |
780 | - if(rpg_points_change($user['id'], RPG_SECTOR, -$sector_cost, sprintf($lang['sys_sector_purchase_log'], |
|
780 | + if (rpg_points_change($user['id'], RPG_SECTOR, -$sector_cost, sprintf($lang['sys_sector_purchase_log'], |
|
781 | 781 | $user['username'], $user['id'], $planet_name_text, $lang['sys_planet_type'][$planetrow['planet_type']], $planetrow['id'], $sector_cost) |
782 | 782 | )) { |
783 | 783 | $sector_db_name = pname_resource_name(UNIT_SECTOR); |
@@ -792,30 +792,30 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | function sn_sys_handler_add(&$functions, $handler_list, $class_module_name = '', $sub_type = '') { |
795 | - if(isset($handler_list) && is_array($handler_list) && !empty($handler_list)) { |
|
796 | - foreach($handler_list as $function_name => $function_data) { |
|
797 | - if(is_string($function_data)) { |
|
795 | + if (isset($handler_list) && is_array($handler_list) && !empty($handler_list)) { |
|
796 | + foreach ($handler_list as $function_name => $function_data) { |
|
797 | + if (is_string($function_data)) { |
|
798 | 798 | $override_with = &$function_data; |
799 | - } elseif(isset($function_data['callable'])) { |
|
799 | + } elseif (isset($function_data['callable'])) { |
|
800 | 800 | $override_with = &$function_data['callable']; |
801 | 801 | } |
802 | 802 | |
803 | 803 | $overwrite = $override_with[0] == '*'; |
804 | - if($overwrite) { |
|
804 | + if ($overwrite) { |
|
805 | 805 | $override_with = substr($override_with, 1); |
806 | 806 | } |
807 | 807 | |
808 | - if(($point_position = strpos($override_with, '.')) === false && $class_module_name) { |
|
808 | + if (($point_position = strpos($override_with, '.')) === false && $class_module_name) { |
|
809 | 809 | $override_with = array($class_module_name, $override_with); |
810 | - } elseif($point_position == 0) { |
|
810 | + } elseif ($point_position == 0) { |
|
811 | 811 | $override_with = substr($override_with, 1); |
812 | - } elseif($point_position > 0) { |
|
812 | + } elseif ($point_position > 0) { |
|
813 | 813 | $override_with = array(substr($override_with, 0, $point_position), substr($override_with, $point_position + 1)); |
814 | 814 | } |
815 | 815 | |
816 | - if($overwrite) { |
|
816 | + if ($overwrite) { |
|
817 | 817 | $functions[$function_name] = array(); |
818 | - } elseif(!isset($functions[$function_name])) { |
|
818 | + } elseif (!isset($functions[$function_name])) { |
|
819 | 819 | $functions[$function_name] = array(); |
820 | 820 | $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : ''); |
821 | 821 | //if(is_callable($sn_function_name)) |
@@ -834,15 +834,15 @@ discard block |
||
834 | 834 | function player_nick_render_to_html($result, $options = false) { |
835 | 835 | // TODO - обрабатывать разные случаи: $user, $render_nick_array, $string |
836 | 836 | |
837 | - if(is_string($result) && strpos($result, ':{i:')) { |
|
837 | + if (is_string($result) && strpos($result, ':{i:')) { |
|
838 | 838 | $result = player_nick_uncompact($result); |
839 | 839 | } |
840 | 840 | |
841 | - if(is_array($result)) { |
|
842 | - if(isset($result['id'])) { |
|
841 | + if (is_array($result)) { |
|
842 | + if (isset($result['id'])) { |
|
843 | 843 | $result = player_nick_render_current_to_array($result, $options); |
844 | 844 | } |
845 | - if(!isset($result[NICK_HTML])) { |
|
845 | + if (!isset($result[NICK_HTML])) { |
|
846 | 846 | $result = player_nick_render_array_to_html($result); |
847 | 847 | } |
848 | 848 | unset($result[NICK_HTML]); |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | try { |
866 | 866 | $result = unserialize($nick_string); |
867 | 867 | // ksort($result); // Всегда ksort-ый в player_nick_compact() |
868 | - } catch(exception $e) { |
|
868 | + } catch (exception $e) { |
|
869 | 869 | $result = strpos($nick_string, ':{i:') ? null : $nick_string; // fallback if it is already string - for old chat strings, for example |
870 | 870 | } |
871 | 871 | |
@@ -878,20 +878,20 @@ discard block |
||
878 | 878 | global $config, $user; |
879 | 879 | |
880 | 880 | // ALL STRING ARE UNSAFE!!! |
881 | - if(isset($nick_array[NICK_BIRTHSDAY])) { |
|
881 | + if (isset($nick_array[NICK_BIRTHSDAY])) { |
|
882 | 882 | $result[NICK_BIRTHSDAY] = '<img src="design/images/birthday.png" />'; |
883 | 883 | } |
884 | 884 | |
885 | - if(isset($nick_array[NICK_VACATION])) { |
|
885 | + if (isset($nick_array[NICK_VACATION])) { |
|
886 | 886 | $result[NICK_VACATION] = '<img src="design/images/icon_vacation.png" />'; |
887 | 887 | } |
888 | 888 | |
889 | - if(isset($nick_array[NICK_GENDER])) { |
|
889 | + if (isset($nick_array[NICK_GENDER])) { |
|
890 | 890 | $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />'; |
891 | 891 | } |
892 | 892 | |
893 | - if(isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) { |
|
894 | - switch($nick_array[NICK_AUTH_LEVEL]) { |
|
893 | + if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) { |
|
894 | + switch ($nick_array[NICK_AUTH_LEVEL]) { |
|
895 | 895 | case 4: |
896 | 896 | $highlight = $config->chat_highlight_developer; |
897 | 897 | break; |
@@ -912,20 +912,20 @@ discard block |
||
912 | 912 | $highlight = isset($nick_array[NICK_PREMIUM]) ? $config->chat_highlight_premium : ''; |
913 | 913 | } |
914 | 914 | |
915 | - if($highlight) { |
|
915 | + if ($highlight) { |
|
916 | 916 | list($result[NICK_HIGHLIGHT], $result[NICK_HIGHLIGHT_END]) = explode('$1', $highlight); |
917 | 917 | } |
918 | 918 | // $result = preg_replace("#(.+)#", $highlight, $result); |
919 | 919 | } |
920 | 920 | |
921 | - if(isset($nick_array[NICK_CLASS])) { |
|
921 | + if (isset($nick_array[NICK_CLASS])) { |
|
922 | 922 | $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>'; |
923 | 923 | $result[NICK_CLASS_END] = '</span>'; |
924 | 924 | } |
925 | 925 | |
926 | 926 | $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]); |
927 | 927 | |
928 | - if(isset($nick_array[NICK_ALLY])) { |
|
928 | + if (isset($nick_array[NICK_ALLY])) { |
|
929 | 929 | $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']'; |
930 | 930 | } |
931 | 931 | |
@@ -949,32 +949,32 @@ discard block |
||
949 | 949 | */ |
950 | 950 | |
951 | 951 | |
952 | - if($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) { |
|
952 | + if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) { |
|
953 | 953 | $result[NICK_BIRTHSDAY] = ''; |
954 | 954 | } |
955 | 955 | |
956 | - if($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['gender']) && $options['gender'])) { |
|
956 | + if ($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['gender']) && $options['gender'])) { |
|
957 | 957 | $result[NICK_GENDER] = $render_user['gender'] == GENDER_UNKNOWN ? 'unknown' : ($render_user['gender'] == GENDER_FEMALE ? 'female' : 'male'); |
958 | 958 | } |
959 | 959 | |
960 | - if(($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['vacancy']) && $options['vacancy'])) && $render_user['vacation']) { |
|
960 | + if (($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['vacancy']) && $options['vacancy'])) && $render_user['vacation']) { |
|
961 | 961 | $result[NICK_VACATION] = $render_user['vacation']; |
962 | 962 | } |
963 | 963 | |
964 | - if($options === true || (isset($options['color']) && $options['color'])) { |
|
965 | - if($user_auth_level = $render_user['authlevel']) { |
|
964 | + if ($options === true || (isset($options['color']) && $options['color'])) { |
|
965 | + if ($user_auth_level = $render_user['authlevel']) { |
|
966 | 966 | $result[NICK_AUTH_LEVEL] = $user_auth_level; |
967 | 967 | } |
968 | - if($user_premium = mrc_get_level($render_user, false, UNIT_PREMIUM)) { |
|
968 | + if ($user_premium = mrc_get_level($render_user, false, UNIT_PREMIUM)) { |
|
969 | 969 | $result[NICK_PREMIUM] = $user_premium; |
970 | 970 | } |
971 | 971 | } |
972 | 972 | |
973 | - if((isset($options['class']) && $options['class'])) { |
|
973 | + if ((isset($options['class']) && $options['class'])) { |
|
974 | 974 | $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class']; |
975 | 975 | } |
976 | 976 | |
977 | - if($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) { |
|
977 | + if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) { |
|
978 | 978 | $result[NICK_ALLY] = $render_user['ally_tag']; |
979 | 979 | } |
980 | 980 | |
@@ -992,25 +992,25 @@ discard block |
||
992 | 992 | |
993 | 993 | $user_skip_list = array(); |
994 | 994 | |
995 | - if($config->stats_hide_admins) { |
|
995 | + if ($config->stats_hide_admins) { |
|
996 | 996 | $user_skip_list[] = '`authlevel` > 0'; |
997 | 997 | } |
998 | 998 | |
999 | - if($config->stats_hide_player_list) { |
|
999 | + if ($config->stats_hide_player_list) { |
|
1000 | 1000 | $temp = explode(',', $config->stats_hide_player_list); |
1001 | - foreach($temp as $user_id) { |
|
1001 | + foreach ($temp as $user_id) { |
|
1002 | 1002 | $user_id = floatval($user_id); |
1003 | - if($user_id) { |
|
1003 | + if ($user_id) { |
|
1004 | 1004 | $user_skip_list[] = '`id` = ' . $user_id; |
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - if(!empty($user_skip_list)) { |
|
1009 | + if (!empty($user_skip_list)) { |
|
1010 | 1010 | $user_skip_list = implode(' OR ', $user_skip_list); |
1011 | 1011 | $user_skip_query = db_user_list($user_skip_list); |
1012 | - if(!empty($user_skip_query)) { |
|
1013 | - foreach($user_skip_query as $user_skip_row) { |
|
1012 | + if (!empty($user_skip_query)) { |
|
1013 | + foreach ($user_skip_query as $user_skip_row) { |
|
1014 | 1014 | $result[$user_skip_row['id']] = $user_skip_row['id']; |
1015 | 1015 | } |
1016 | 1016 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | |
1042 | 1042 | function sn_sn_get_groups($groups, &$result) { |
1043 | 1043 | $result = is_array($result) ? $result : array(); |
1044 | - foreach($groups = is_array($groups) ? $groups : array($groups) as $group_name) { |
|
1044 | + foreach ($groups = is_array($groups) ? $groups : array($groups) as $group_name) { |
|
1045 | 1045 | $result += is_array($a_group = get_unit_param(UNIT_GROUP, $group_name)) ? $a_group : array(); |
1046 | 1046 | } |
1047 | 1047 | |
@@ -1069,8 +1069,8 @@ discard block |
||
1069 | 1069 | $sn_data_unit = get_unit_param($unit_id); |
1070 | 1070 | |
1071 | 1071 | $result = is_array($result) ? $result : array(); |
1072 | - if($sn_data_unit[$field] && !($sn_data_unit[P_UNIT_TYPE] == UNIT_MERCENARIES && $config->empire_mercenary_temporary)) { |
|
1073 | - foreach($sn_data_unit[$field] as $require_id => $require_level) { |
|
1072 | + if ($sn_data_unit[$field] && !($sn_data_unit[P_UNIT_TYPE] == UNIT_MERCENARIES && $config->empire_mercenary_temporary)) { |
|
1073 | + foreach ($sn_data_unit[$field] as $require_id => $require_level) { |
|
1074 | 1074 | $level_got = mrc_get_level($user, $planetrow, $require_id); |
1075 | 1075 | $level_basic = mrc_get_level($user, $planetrow, $require_id, false, true); |
1076 | 1076 | $result[] = array( |
@@ -1094,16 +1094,16 @@ discard block |
||
1094 | 1094 | |
1095 | 1095 | $ranks = array(); |
1096 | 1096 | |
1097 | - if($ally['ranklist']) { |
|
1097 | + if ($ally['ranklist']) { |
|
1098 | 1098 | $str_ranks = explode(';', $ally['ranklist']); |
1099 | - foreach($str_ranks as $str_rank) { |
|
1100 | - if(!$str_rank) { |
|
1099 | + foreach ($str_ranks as $str_rank) { |
|
1100 | + if (!$str_rank) { |
|
1101 | 1101 | continue; |
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | $tmp = explode(',', $str_rank); |
1105 | 1105 | $rank_id = count($ranks); |
1106 | - foreach($ally_rights as $key => $value) { |
|
1106 | + foreach ($ally_rights as $key => $value) { |
|
1107 | 1107 | $ranks[$rank_id][$value] = $tmp[$key]; |
1108 | 1108 | } |
1109 | 1109 | } |
@@ -1119,8 +1119,8 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | function array_merge_recursive_numeric($array1, $array2) { |
1122 | - if(!empty($array2) && is_array($array2)) { |
|
1123 | - foreach($array2 as $key => $value) { |
|
1122 | + if (!empty($array2) && is_array($array2)) { |
|
1123 | + foreach ($array2 as $key => $value) { |
|
1124 | 1124 | // if(!isset($array1[$key]) || !is_array($array1[$key])) { |
1125 | 1125 | // $array1[$key] = $value; |
1126 | 1126 | // } else { |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | function sn_sys_array_cumulative_sum(&$array) { |
1137 | 1137 | $accum = 0; |
1138 | - foreach($array as &$value) { |
|
1138 | + foreach ($array as &$value) { |
|
1139 | 1139 | $accum += $value; |
1140 | 1140 | $value = $accum; |
1141 | 1141 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $sn_data_density = sn_get_groups('planet_density'); |
1146 | 1146 | $density_price_chart = array(); |
1147 | 1147 | |
1148 | - foreach($sn_data_density as $density_id => $density_data) { |
|
1148 | + foreach ($sn_data_density as $density_id => $density_data) { |
|
1149 | 1149 | // Отсекаем записи с RARITY = 0 - служебные записи и супер-ядра |
1150 | 1150 | $density_data[UNIT_PLANET_DENSITY_RARITY] ? $density_price_chart[$density_id] = $density_data[UNIT_PLANET_DENSITY_RARITY] : false; |
1151 | 1151 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | |
1154 | 1154 | $total_rarity = array_sum($density_price_chart); |
1155 | 1155 | |
1156 | - foreach($density_price_chart as &$density_data) { |
|
1156 | + foreach ($density_price_chart as &$density_data) { |
|
1157 | 1157 | $density_data = ceil($total_rarity / $density_data * $planet_row['field_max'] * PLANET_DENSITY_TO_DARK_MATTER_RATE); |
1158 | 1158 | } |
1159 | 1159 | |
@@ -1161,18 +1161,18 @@ discard block |
||
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | function sn_sys_planet_core_transmute(&$user, &$planetrow) { |
1164 | - if(!sys_get_param_str('transmute')) { |
|
1164 | + if (!sys_get_param_str('transmute')) { |
|
1165 | 1165 | return array(); |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | global $lang; |
1169 | 1169 | |
1170 | 1170 | try { |
1171 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
1171 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
1172 | 1172 | throw new exception($lang['ov_core_err_not_a_planet'], ERR_ERROR); |
1173 | 1173 | } |
1174 | 1174 | |
1175 | - if($planetrow['density_index'] == ($new_density_index = sys_get_param_id('density_type'))) { |
|
1175 | + if ($planetrow['density_index'] == ($new_density_index = sys_get_param_id('density_type'))) { |
|
1176 | 1176 | throw new exception($lang['ov_core_err_same_density'], ERR_WARNING); |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $planet_density_index = $planetrow['density_index']; |
1187 | 1187 | |
1188 | 1188 | $density_price_chart = planet_density_price_chart($planetrow); |
1189 | - if(!isset($density_price_chart[$new_density_index])) { |
|
1189 | + if (!isset($density_price_chart[$new_density_index])) { |
|
1190 | 1190 | // Hack attempt |
1191 | 1191 | throw new exception($lang['ov_core_err_denisty_type_wrong'], ERR_ERROR); |
1192 | 1192 | } |
@@ -1195,13 +1195,13 @@ discard block |
||
1195 | 1195 | // $transmute_cost = get_unit_param(UNIT_PLANET_DENSITY, 'cost'); |
1196 | 1196 | // $transmute_cost = $transmute_cost[RES_DARK_MATTER] * $density_price_chart[$new_density_index]; |
1197 | 1197 | $transmute_cost = $density_price_chart[$new_density_index]; |
1198 | - if($user_dark_matter < $transmute_cost) { |
|
1198 | + if ($user_dark_matter < $transmute_cost) { |
|
1199 | 1199 | throw new exception($lang['ov_core_err_no_dark_matter'], ERR_ERROR); |
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | $sn_data_planet_density = sn_get_groups('planet_density'); |
1203 | - foreach($sn_data_planet_density as $key => $value) { |
|
1204 | - if($key == $new_density_index) { |
|
1203 | + foreach ($sn_data_planet_density as $key => $value) { |
|
1204 | + if ($key == $new_density_index) { |
|
1205 | 1205 | break; |
1206 | 1206 | } |
1207 | 1207 | $prev_density_index = $key; |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | 'STATUS' => ERR_NONE, |
1233 | 1233 | 'MESSAGE' => sprintf($lang['ov_core_err_none'], $lang['uni_planet_density_types'][$planet_density_index], $lang['uni_planet_density_types'][$new_density_index], $new_density), |
1234 | 1234 | ); |
1235 | - } catch(exception $e) { |
|
1235 | + } catch (exception $e) { |
|
1236 | 1236 | sn_db_transaction_rollback(); |
1237 | 1237 | $result = array( |
1238 | 1238 | 'STATUS' => $e->getCode(), |
@@ -1247,8 +1247,8 @@ discard block |
||
1247 | 1247 | global $sn_module_list; |
1248 | 1248 | |
1249 | 1249 | $active_modules = 0; |
1250 | - if(isset($sn_module_list[$group]) && is_array($sn_module_list[$group])) { |
|
1251 | - foreach($sn_module_list[$group] as $payment_module) { |
|
1250 | + if (isset($sn_module_list[$group]) && is_array($sn_module_list[$group])) { |
|
1251 | + foreach ($sn_module_list[$group] as $payment_module) { |
|
1252 | 1252 | $active_modules += $payment_module->manifest['active']; |
1253 | 1253 | } |
1254 | 1254 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | function get_resource_exchange() { |
1260 | 1260 | static $rates; |
1261 | 1261 | |
1262 | - if(!$rates) { |
|
1262 | + if (!$rates) { |
|
1263 | 1263 | global $config; |
1264 | 1264 | |
1265 | 1265 | $rates = array( |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | RES_DARK_MATTER => 'rpg_exchange_darkMatter', |
1270 | 1270 | ); |
1271 | 1271 | |
1272 | - foreach($rates as &$rate) { |
|
1272 | + foreach ($rates as &$rate) { |
|
1273 | 1273 | $rate = $config->$rate; |
1274 | 1274 | } |
1275 | 1275 | } |
@@ -1280,12 +1280,12 @@ discard block |
||
1280 | 1280 | function get_unit_cost_in(&$cost, $in_resource = RES_METAL) { |
1281 | 1281 | static $rates; |
1282 | 1282 | |
1283 | - if(!$rates) { |
|
1283 | + if (!$rates) { |
|
1284 | 1284 | $rates = get_resource_exchange(); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $metal_cost = 0; |
1288 | - foreach($cost as $resource_id => $resource_value) { |
|
1288 | + foreach ($cost as $resource_id => $resource_value) { |
|
1289 | 1289 | $metal_cost += $rates[$resource_id] * $resource_value; |
1290 | 1290 | } |
1291 | 1291 | |
@@ -1295,8 +1295,8 @@ discard block |
||
1295 | 1295 | function get_player_max_expeditons(&$user, $astrotech = -1) { return sn_function_call(__FUNCTION__, array(&$user, $astrotech, &$result)); } |
1296 | 1296 | |
1297 | 1297 | function sn_get_player_max_expeditons(&$user, $astrotech = -1, &$result = 0) { |
1298 | - if($astrotech == -1) { |
|
1299 | - if(!isset($user[UNIT_PLAYER_EXPEDITIONS_MAX])) { |
|
1298 | + if ($astrotech == -1) { |
|
1299 | + if (!isset($user[UNIT_PLAYER_EXPEDITIONS_MAX])) { |
|
1300 | 1300 | $astrotech = mrc_get_level($user, false, TECH_ASTROTECH); |
1301 | 1301 | $user[UNIT_PLAYER_EXPEDITIONS_MAX] = $astrotech >= 1 ? floor(sqrt($astrotech - 1)) : 0; |
1302 | 1302 | } |
@@ -1314,8 +1314,8 @@ discard block |
||
1314 | 1314 | function get_player_max_colonies(&$user, $astrotech = -1) { |
1315 | 1315 | global $config; |
1316 | 1316 | |
1317 | - if($astrotech == -1) { |
|
1318 | - if(!isset($user[UNIT_PLAYER_COLONIES_MAX])) { |
|
1317 | + if ($astrotech == -1) { |
|
1318 | + if (!isset($user[UNIT_PLAYER_COLONIES_MAX])) { |
|
1319 | 1319 | |
1320 | 1320 | $expeditions = get_player_max_expeditons($user); |
1321 | 1321 | $astrotech = mrc_get_level($user, false, TECH_ASTROTECH); |
@@ -1360,10 +1360,10 @@ discard block |
||
1360 | 1360 | |
1361 | 1361 | // pdump($powerup_unit, '$powerup_unit'); |
1362 | 1362 | $level_current = $term_original = $time_left = 0; |
1363 | - if($is_upgrade) { |
|
1363 | + if ($is_upgrade) { |
|
1364 | 1364 | $time_finish = strtotime($powerup_unit['unit_time_finish']); |
1365 | 1365 | $time_left = max(0, $time_finish - SN_TIME_NOW); |
1366 | - if($time_left > 0) { |
|
1366 | + if ($time_left > 0) { |
|
1367 | 1367 | $term_original = $time_finish - strtotime($powerup_unit['unit_time_start']); |
1368 | 1368 | $level_current = $powerup_unit['unit_level']; |
1369 | 1369 | } |
@@ -1371,22 +1371,22 @@ discard block |
||
1371 | 1371 | |
1372 | 1372 | $level_max = $level_max > $powerup_data[P_MAX_STACK] ? $level_max : $powerup_data[P_MAX_STACK]; |
1373 | 1373 | $original_cost = 0; |
1374 | - for($i = 1; $i <= $level_max; $i++) { |
|
1374 | + for ($i = 1; $i <= $level_max; $i++) { |
|
1375 | 1375 | $base_cost = eco_get_total_cost($powerup_id, $i); |
1376 | 1376 | $base_cost = $base_cost[BUILD_CREATE][RES_DARK_MATTER]; |
1377 | - foreach($sn_powerup_buy_discounts as $period => $discount) { |
|
1377 | + foreach ($sn_powerup_buy_discounts as $period => $discount) { |
|
1378 | 1378 | $upgrade_price = floor($base_cost * $discount * $period / PERIOD_MONTH); |
1379 | 1379 | $result[$i][$period] = $upgrade_price; |
1380 | 1380 | $original_cost = $is_upgrade && $i == $level_current && $period <= $term_original ? $upgrade_price : $original_cost; |
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - if($is_upgrade && $time_left) { |
|
1384 | + if ($is_upgrade && $time_left) { |
|
1385 | 1385 | $term_original = round($term_original / PERIOD_DAY); |
1386 | 1386 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
1387 | 1387 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
1388 | 1388 | |
1389 | - array_walk_recursive($result, function (&$value) use ($cost_left) { |
|
1389 | + array_walk_recursive($result, function(&$value) use ($cost_left) { |
|
1390 | 1390 | $value -= $cost_left; |
1391 | 1391 | }); |
1392 | 1392 | } |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | |
1445 | 1445 | function print_rr($var, $capture = false) { |
1446 | 1446 | $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>'; |
1447 | - if($capture) { |
|
1447 | + if ($capture) { |
|
1448 | 1448 | return $print; |
1449 | 1449 | } else { |
1450 | 1450 | print($print); |
@@ -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 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_can_negotiate) { |
|
7 | +if (!$user_can_negotiate) { |
|
8 | 8 | message($lang['Denied_access'], $lang['ali_dip_title']); |
9 | 9 | } |
10 | 10 | |
@@ -15,24 +15,24 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if(sys_get_param_str('ali_dip_offer_make')) { |
|
18 | +if (sys_get_param_str('ali_dip_offer_make')) { |
|
19 | 19 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
20 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) { |
|
20 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) { |
|
21 | 21 | message($lang['ali_dip_err_wrong_offer'], $page_title); |
22 | 22 | } |
23 | 23 | |
24 | 24 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
25 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) { |
|
25 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) { |
|
26 | 26 | message($lang['ali_dip_err_same_ally'], $page_title); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $contr_ally_row = db_ally_get_by_id($alliance_negotiation_contr_ally_id); |
30 | - if(!$contr_ally_row) { |
|
30 | + if (!$contr_ally_row) { |
|
31 | 31 | message($lang['ali_dip_err_no_ally'], $page_title); |
32 | 32 | } |
33 | 33 | |
34 | 34 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
35 | - if($alliance_negotiation_relation == $relation_current_id) { |
|
35 | + if ($alliance_negotiation_relation == $relation_current_id) { |
|
36 | 36 | message(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
37 | 37 | } |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
45 | 45 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
46 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) { |
|
46 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) { |
|
47 | 47 | sn_db_perform('{{alliance_negotiation}}', |
48 | 48 | array( |
49 | 49 | 'alliance_negotiation_ally_id' => $user['ally_id'], |
@@ -70,33 +70,33 @@ discard block |
||
70 | 70 | } |
71 | 71 | } else { |
72 | 72 | $offer_id = sys_get_param_id('offer_id'); |
73 | - if($offer_id) { |
|
73 | + if ($offer_id) { |
|
74 | 74 | $offer_answer = sys_get_param_str('answer'); |
75 | 75 | |
76 | 76 | $negotiation = db_ally_negotiation_get_by_offer_id($offer_id); |
77 | - if(!$negotiation) { |
|
77 | + if (!$negotiation) { |
|
78 | 78 | message($lang['ali_dip_err_offer_none'], $page_title); |
79 | - } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) { |
|
79 | + } elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) { |
|
80 | 80 | // TODO: Add log of hack attempt |
81 | 81 | message($lang['ali_dip_err_offer_alien'], $page_title); |
82 | - } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) { |
|
83 | - if($offer_answer == 'accept') { |
|
82 | + } elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) { |
|
83 | + if ($offer_answer == 'accept') { |
|
84 | 84 | // TODO: Add log of hack attempt |
85 | 85 | message($lang['ali_dip_err_offer_accept_own'], $page_title); |
86 | - } elseif($offer_answer == 'deny') { |
|
86 | + } elseif ($offer_answer == 'deny') { |
|
87 | 87 | db_ally_negotiation_delete_by_offer_id($offer_id); |
88 | 88 | } |
89 | 89 | } else { |
90 | - if($offer_answer == 'accept') { |
|
90 | + if ($offer_answer == 'accept') { |
|
91 | 91 | $accept_offer = true; |
92 | - } elseif($offer_answer == 'deny') { |
|
92 | + } elseif ($offer_answer == 'deny') { |
|
93 | 93 | db_ally_negotiation_update_status_1($offer_id); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | -if($accept_offer) { |
|
99 | +if ($accept_offer) { |
|
100 | 100 | sn_db_transaction_start(); |
101 | 101 | |
102 | 102 | // TODO: Make sn_db_perform() multirow |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | sn_db_transaction_commit(); |
126 | 126 | } |
127 | 127 | |
128 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) { |
|
128 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) { |
|
129 | 129 | $template->assign_block_vars('relation', array( |
130 | 130 | 'ID' => $diplomacy_relation_id, |
131 | 131 | 'TEXT' => $lang['ali_dip_relations'][$diplomacy_relation_id], |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | $query = db_ally_list_get_by_not_user_ally($user); |
137 | -while($alliance = db_fetch($query)) { |
|
137 | +while ($alliance = db_fetch($query)) { |
|
138 | 138 | $template->assign_block_vars('alliance', array( |
139 | 139 | 'ID' => $alliance['id'], |
140 | 140 | 'NAME' => js_safe_string($alliance['ally_name']), |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $query = db_ally_negotiation_list($user); |
146 | -while($offer = db_fetch($query)) { |
|
146 | +while ($offer = db_fetch($query)) { |
|
147 | 147 | $template->assign_block_vars('offer', array( |
148 | 148 | 'ID' => $offer['alliance_negotiation_id'], |
149 | 149 | 'NAME' => $offer['ally_name'], |
@@ -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 | $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_raw = sys_get_param_str_unsafe('name'); |
12 | 12 | $ally_name = db_escape($ally_name_raw); |
13 | 13 | |
14 | -if($ally_tag) { |
|
15 | - if(!$ally_name_raw || !$ally_tag_raw) { |
|
14 | +if ($ally_tag) { |
|
15 | + if (!$ally_name_raw || !$ally_tag_raw) { |
|
16 | 16 | message($lang['have_not_name'], $lang['make_alliance']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $query = 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_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
22 | 22 | } |
23 | 23 |
@@ -1,17 +1,17 @@ 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 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | 7 | $template = gettemplate('ali_info', true); |
8 | 8 | |
9 | -if($mode == 'exit') { |
|
10 | - if($ally['ally_owner'] == $user['id']) { |
|
9 | +if ($mode == 'exit') { |
|
10 | + if ($ally['ally_owner'] == $user['id']) { |
|
11 | 11 | message($lang['Owner_cant_go_out'], $lang['Alliance']); |
12 | 12 | } |
13 | 13 | |
14 | - if(sys_get_param_int('ali_info_leave_confirm')) { |
|
14 | + if (sys_get_param_int('ali_info_leave_confirm')) { |
|
15 | 15 | sn_db_transaction_start(); |
16 | 16 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_tag` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
17 | 17 | db_ally_list_recalc_counts(); |
@@ -19,20 +19,20 @@ discard block |
||
19 | 19 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
20 | 20 | message(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
21 | 21 | } |
22 | -} elseif($mode == 'ainfo') { |
|
22 | +} elseif ($mode == 'ainfo') { |
|
23 | 23 | $tag = sys_get_param_str('tag'); |
24 | 24 | $id_ally = sys_get_param_id('a'); |
25 | - if($tag) { |
|
25 | + if ($tag) { |
|
26 | 26 | $ally = db_ally_get_by_tag($tag); |
27 | - } elseif($id_ally) { |
|
27 | + } elseif ($id_ally) { |
|
28 | 28 | $ally = db_ally_get_by_id($id_ally); |
29 | 29 | } |
30 | 30 | |
31 | - if(!$ally) { |
|
31 | + if (!$ally) { |
|
32 | 32 | message($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
33 | 33 | } |
34 | 34 | |
35 | - if(!$ally['ally_description']) { |
|
35 | + if (!$ally['ally_description']) { |
|
36 | 36 | $ally['ally_description'] = $lang['Ally_nodescription']; |
37 | 37 | } |
38 | 38 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | } else { |
45 | 45 | $page_header = $lang['your_alliance']; |
46 | 46 | |
47 | - if($ally['ally_owner'] == $user['id']) { |
|
47 | + if ($ally['ally_owner'] == $user['id']) { |
|
48 | 48 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
49 | - } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
49 | + } elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) { |
|
50 | 50 | $range = $ranks[$user['ally_rank_id']]['name']; |
51 | 51 | } else { |
52 | 52 | $range = $lang['member']; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | )); |
88 | 88 | |
89 | 89 | $relations = ali_relations($ally['id']); |
90 | -foreach($relations as $relation) { |
|
91 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
90 | +foreach ($relations as $relation) { |
|
91 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) { |
|
92 | 92 | $template->assign_block_vars('relation', array( |
93 | 93 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
94 | 94 | 'RELATION' => $lang['ali_dip_relations'][$relation['alliance_diplomacy_relation']], |
@@ -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 | $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($lang['Denied_access'], $lang['ally_admin']); |
9 | 9 | } |
10 | 10 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
23 | 23 | |
24 | 24 | |
25 | -if(sys_get_param_str('isSaveOptions')) { |
|
25 | +if (sys_get_param_str('isSaveOptions')) { |
|
26 | 26 | require_once('includes/includes/sys_avatar.php'); |
27 | 27 | |
28 | 28 | $new_image = $ally['ally_image']; |
@@ -34,46 +34,46 @@ discard block |
||
34 | 34 | // $template->assign_block_vars('result', $avatar_upload_result); |
35 | 35 | |
36 | 36 | $ally_changeset = array(); |
37 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
37 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
38 | 38 | $new_tag = db_escape($new_tag); |
39 | 39 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
40 | 40 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
41 | 41 | } |
42 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
42 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
43 | 43 | $new_name = db_escape($new_name); |
44 | 44 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
45 | 45 | } |
46 | 46 | |
47 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
47 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
48 | 48 | $new_owner_rank = db_escape($new_owner_rank); |
49 | 49 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
50 | 50 | } |
51 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
51 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
52 | 52 | $new_web = db_escape($new_web); |
53 | 53 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
54 | 54 | } |
55 | 55 | $new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow']); |
56 | 56 | $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
57 | - if($new_image != $ally['ally_image']) { |
|
57 | + if ($new_image != $ally['ally_image']) { |
|
58 | 58 | $new_image = intval($new_image); |
59 | 59 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
60 | 60 | } |
61 | 61 | |
62 | - if(!empty($ally_changeset)) { |
|
62 | + if (!empty($ally_changeset)) { |
|
63 | 63 | db_ally_update_by_changeset($ally_changeset, $ally); |
64 | 64 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
65 | 65 | } |
66 | -} elseif(sys_get_param_str('isSaveText')) { |
|
66 | +} elseif (sys_get_param_str('isSaveText')) { |
|
67 | 67 | $text = sys_get_param_str_both('text'); |
68 | 68 | db_ally_update_texts($text_list, $allyTextID, $text, $ally); |
69 | 69 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
70 | -} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
71 | - if(!$isAllyOwner) { |
|
70 | +} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
71 | + if (!$isAllyOwner) { |
|
72 | 72 | message($lang['Denied_access'], $lang['ally_admin']); |
73 | 73 | } |
74 | 74 | |
75 | 75 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
76 | - if($newLeader['ally_id'] == $user['ally_id']) { |
|
76 | + if ($newLeader['ally_id'] == $user['ally_id']) { |
|
77 | 77 | sn_db_transaction_start(); |
78 | 78 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
79 | 79 | db_ally_update_owner($idNewLeader, $user); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | sn_db_transaction_commit(); |
82 | 82 | sys_redirect('alliance.php'); |
83 | 83 | } |
84 | -} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
85 | - if(!$isAllyOwner) { |
|
84 | +} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
85 | + if (!$isAllyOwner) { |
|
86 | 86 | message($lang['Denied_access'], $lang['ally_admin']); |
87 | 87 | } |
88 | 88 | sn_db_transaction_start(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
129 | 129 | unset($tmp); |
130 | 130 | // while ($userAllyAdmin = db_fetch($userAllyAdmins)) |
131 | - foreach($userAllyAdmins as $userAllyAdmin) { |
|
131 | + foreach ($userAllyAdmins as $userAllyAdmin) { |
|
132 | 132 | // pdump($userAllyAdmin); |
133 | 133 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
134 | 134 | } |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | $template->assign_var('adminMembers', $tmp); |
137 | 137 | } |
138 | 138 | |
139 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
140 | - if(!$sn_ali_admin_action_locale['title']) { |
|
139 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
140 | + if (!$sn_ali_admin_action_locale['title']) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | $template->assign_block_vars('admin_actions', array( |
@@ -1,18 +1,18 @@ |
||
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 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | 7 | $template = gettemplate('ali_search', true); |
8 | 8 | |
9 | 9 | $ali_search_text = sys_get_param_str('searchtext'); |
10 | -if($ali_search_text) { |
|
10 | +if ($ali_search_text) { |
|
11 | 11 | $template->assign_var('SEARCH_TEXT', $ali_search_text); |
12 | 12 | |
13 | 13 | $search = db_ally_search_by_name_or_tag($ali_search_text); |
14 | - if(db_num_rows($search)) { |
|
15 | - while($ally_row = db_fetch($search)) { |
|
14 | + if (db_num_rows($search)) { |
|
15 | + while ($ally_row = db_fetch($search)) { |
|
16 | 16 | $template->assign_block_vars('alliances', array( |
17 | 17 | 'ID' => $ally_row['id'], |
18 | 18 | 'TAG' => $ally_row['ally_tag'], |