@@ -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 | - message (classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
21 | + message(classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ($planetrow['planet_type'] != PT_MOON) { |
25 | - message (classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
25 | + message(classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $scan_galaxy = sys_get_param_int('galaxy'); |
29 | 29 | $scan_system = sys_get_param_int('system'); |
30 | 30 | $scan_planet = sys_get_param_int('planet'); |
31 | -$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
31 | +$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
32 | 32 | $id = sys_get_param_id('id'); |
33 | 33 | |
34 | 34 | $source_galaxy = $planetrow['galaxy']; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $sensorRange = GetPhalanxRange($sensorLevel); |
39 | 39 | |
40 | 40 | $system_distance = abs($source_system - $scan_system); |
41 | -if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
41 | +if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
42 | 42 | { |
43 | - message (classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
43 | + message(classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cost = $sensorLevel * 1000; |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $planet_scanned = db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
54 | -if(!$planet_scanned['id']) |
|
54 | +if (!$planet_scanned['id']) |
|
55 | 55 | { |
56 | 56 | message(classLocale::$lang['phalanx_planet_not_exists'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
57 | 57 | } |
58 | 58 | |
59 | -if($planet_scanned['destruyed']) |
|
59 | +if ($planet_scanned['destruyed']) |
|
60 | 60 | { |
61 | - message (classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
61 | + message(classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}"); |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) |
|
17 | +if ($user['authlevel'] < 3) |
|
18 | 18 | { |
19 | 19 | AdminMessage(classLocale::$lang['adm_err_denied']); |
20 | 20 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | // Afficher les templates |
36 | 36 | if (isset($GET_result)) { |
37 | - switch ($GET_result){ |
|
37 | + switch ($GET_result) { |
|
38 | 38 | case 'usr_search': |
39 | - $SelUser = db_user_by_username('%'. $Pattern .'%', false, '*', true, true); |
|
39 | + $SelUser = db_user_by_username('%' . $Pattern . '%', false, '*', true, true); |
|
40 | 40 | $UsrMain = db_planet_by_id($SelUser['id_planet'], false, 'name'); |
41 | 41 | |
42 | 42 | $bloc = classLocale::$lang; |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | $bloc['answer2'] = $SelUser['username']; |
45 | 45 | $bloc['answer3'] = $SelUser['user_lastip']; |
46 | 46 | $bloc['answer4'] = $SelUser['email']; |
47 | - $bloc['answer5'] = classLocale::$lang['adm_usr_level'][ $SelUser['authlevel'] ]; |
|
48 | - $bloc['answer6'] = classLocale::$lang['adm_usr_genre'][ $SelUser['gender'] ]; |
|
49 | - $bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name']; |
|
50 | - $bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] "; |
|
47 | + $bloc['answer5'] = classLocale::$lang['adm_usr_level'][$SelUser['authlevel']]; |
|
48 | + $bloc['answer6'] = classLocale::$lang['adm_usr_genre'][$SelUser['gender']]; |
|
49 | + $bloc['answer7'] = "[" . $SelUser['id_planet'] . "] " . $UsrMain['name']; |
|
50 | + $bloc['answer8'] = "[" . $SelUser['galaxy'] . ":" . $SelUser['system'] . ":" . $SelUser['planet'] . "] "; |
|
51 | 51 | $bloc['qst_quest_complete'] = get_quest_amount_complete($SelUser['id']); |
52 | 52 | $bloc['user_id'] = $SelUser['id']; |
53 | 53 | $SubPanelTPL = gettemplate('admin/admin_panel_asw1'); |
54 | - $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); |
|
54 | + $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc); |
|
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'usr_data': |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | $selected_user = db_user_by_username($Pattern, false, 'id'); |
71 | 71 | $QryUpdate = db_user_set_by_id($selected_user['id'], "`authlevel` = '{$NewLvl}'"); |
72 | - $Message = classLocale::$lang['adm_mess_lvl1']. " ". $Pattern ." ".classLocale::$lang['adm_mess_lvl2']; |
|
73 | - $Message .= "<font color=\"red\">".classLocale::$lang['adm_usr_level'][ $NewLvl ]."</font>!"; |
|
72 | + $Message = classLocale::$lang['adm_mess_lvl1'] . " " . $Pattern . " " . classLocale::$lang['adm_mess_lvl2']; |
|
73 | + $Message .= "<font color=\"red\">" . classLocale::$lang['adm_usr_level'][$NewLvl] . "</font>!"; |
|
74 | 74 | |
75 | - AdminMessage ( $Message, classLocale::$lang['adm_mod_level'] ); |
|
75 | + AdminMessage($Message, classLocale::$lang['adm_mod_level']); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case 'ip_search': |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | $bloc['adm_this_ip'] = $ip; |
82 | 82 | $SelUser = db_user_list("`user_lastip` = '{$ip}'"); |
83 | 83 | //while ( $Usr = db_fetch($SelUser) ) { |
84 | - foreach($SelUser as $Usr) { |
|
84 | + foreach ($SelUser as $Usr) { |
|
85 | 85 | $UsrMain = db_planet_by_id($Usr['id_planet'], false, 'name'); |
86 | - $bloc['adm_plyer_lst'] .= "<tr><th>".$Usr['username']."</th><th>[".$Usr['galaxy'].":".$Usr['system'].":".$Usr['planet']."] ".$UsrMain['name']."</th></tr>"; |
|
86 | + $bloc['adm_plyer_lst'] .= "<tr><th>" . $Usr['username'] . "</th><th>[" . $Usr['galaxy'] . ":" . $Usr['system'] . ":" . $Usr['planet'] . "] " . $UsrMain['name'] . "</th></tr>"; |
|
87 | 87 | } |
88 | 88 | $SubPanelTPL = gettemplate('admin/admin_panel_asw2'); |
89 | - $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); |
|
89 | + $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc); |
|
90 | 90 | break; |
91 | 91 | default: |
92 | 92 | break; |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | // Traiter les reponses aux formulaires |
97 | 97 | if (isset($GET_action)) { |
98 | - $bloc = classLocale::$lang; |
|
99 | - switch ($GET_action){ |
|
98 | + $bloc = classLocale::$lang; |
|
99 | + switch ($GET_action) { |
|
100 | 100 | case 'usr_search': |
101 | - $SubPanelTPL = gettemplate('admin/admin_panel_frm1'); |
|
101 | + $SubPanelTPL = gettemplate('admin/admin_panel_frm1'); |
|
102 | 102 | break; |
103 | 103 | |
104 | 104 | case 'usr_data': |
105 | - $SubPanelTPL = gettemplate('admin/admin_panel_frm4'); |
|
105 | + $SubPanelTPL = gettemplate('admin/admin_panel_frm4'); |
|
106 | 106 | break; |
107 | 107 | |
108 | 108 | case 'usr_level': |
@@ -115,21 +115,21 @@ discard block |
||
115 | 115 | |
116 | 116 | |
117 | 117 | for ($Lvl = 0; $Lvl < 4; $Lvl++) { |
118 | - $bloc['adm_level_lst'] .= '<option value="'. $Lvl .'">'. classLocale::$lang['adm_usr_level'][ $Lvl ] ."</option>"; |
|
118 | + $bloc['adm_level_lst'] .= '<option value="' . $Lvl . '">' . classLocale::$lang['adm_usr_level'][$Lvl] . "</option>"; |
|
119 | 119 | } |
120 | - $SubPanelTPL = gettemplate('admin/admin_panel_frm3'); |
|
120 | + $SubPanelTPL = gettemplate('admin/admin_panel_frm3'); |
|
121 | 121 | break; |
122 | 122 | |
123 | 123 | case 'ip_search': |
124 | - $SubPanelTPL = gettemplate('admin/admin_panel_frm2'); |
|
124 | + $SubPanelTPL = gettemplate('admin/admin_panel_frm2'); |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | default: |
128 | 128 | break; |
129 | 129 | } |
130 | - $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); |
|
130 | + $parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc); |
|
131 | 131 | } |
132 | 132 | |
133 | -$page = parsetemplate( $PanelMainTPL, $parse ); |
|
134 | -display( $page, classLocale::$lang['panel_mainttl'], false, '', true ); |
|
133 | +$page = parsetemplate($PanelMainTPL, $parse); |
|
134 | +display($page, classLocale::$lang['panel_mainttl'], false, '', true); |
|
135 | 135 | ?> |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
16 | -if($user['authlevel'] < 3) { |
|
16 | +if ($user['authlevel'] < 3) { |
|
17 | 17 | AdminMessage(classLocale::$lang['adm_err_denied']); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | $config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | $config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | $config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | $config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | $config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - $config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + $config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | $config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | $config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | $config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | $config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | $config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if($config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if($config->empire_mercenary_temporary) { |
|
99 | + if ($config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if ($config->empire_mercenary_temporary) { |
|
101 | 101 | db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | db_unit_list_admin_set_mercenaries_expire_time($config->empire_mercenary_base_period); |
@@ -140,21 +140,21 @@ discard block |
||
140 | 140 | // 'STATS_SCHEDULE' => $config->stats_hide_player_list, |
141 | 141 | )); |
142 | 142 | |
143 | -foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
143 | +foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
144 | 144 | $template->assign_block_vars('sys_game_disable_reason', array( |
145 | 145 | 'ID' => $id, |
146 | 146 | 'NAME' => $name, |
147 | 147 | )); |
148 | 148 | } |
149 | 149 | |
150 | -foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
150 | +foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
151 | 151 | $template->assign_block_vars('game_modes', array( |
152 | 152 | 'ID' => $mode_id, |
153 | 153 | 'NAME' => $mode_name, |
154 | 154 | )); |
155 | 155 | } |
156 | 156 | |
157 | -foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
157 | +foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
158 | 158 | $template->assign_block_vars('ver_response', array( |
159 | 159 | 'ID' => $ver_id, |
160 | 160 | 'NAME' => js_safe_string($ver_response), |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | $lang_list = lng_get_list(); |
165 | -foreach($lang_list as $lang_id => $lang_data) { |
|
165 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
166 | 166 | $template->assign_block_vars('game_languages', array( |
167 | 167 | 'ID' => $lang_id, |
168 | 168 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -define('INSIDE' , true); |
|
4 | -define('INSTALL' , false); |
|
3 | +define('INSIDE', true); |
|
4 | +define('INSTALL', false); |
|
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | |
7 | 7 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | global $config, $lang, $user; |
10 | 10 | |
11 | 11 | // if($user['authlevel'] < 1) |
12 | -if($user['authlevel'] < 3) { |
|
12 | +if ($user['authlevel'] < 3) { |
|
13 | 13 | AdminMessage(classLocale::$lang['adm_err_denied']); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $planet_active = sys_get_param_int('planet_active'); |
17 | -if(!$planet_active) { |
|
17 | +if (!$planet_active) { |
|
18 | 18 | $planet_type = sys_get_param_int('planet_type', 1); |
19 | 19 | $planet_type = $planet_type == 3 ? 3 : 1; |
20 | 20 | } else { |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $page_title = |
45 | 45 | classLocale::$lang['adm_planet_list_title'] . ': ' . |
46 | - ($planet_active ? classLocale::$lang['adm_planet_active'] : |
|
47 | - ($planet_type ? ($planet_type == 3 ? classLocale::$lang['sys_moons'] : classLocale::$lang['sys_planets']) : '') |
|
46 | + ($planet_active ? classLocale::$lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? classLocale::$lang['sys_moons'] : classLocale::$lang['sys_planets']) : '') |
|
48 | 47 | ); |
49 | 48 | $template->assign_vars(array( |
50 | 49 | 'PAGE_TITLE' => $page_title, |
@@ -15,34 +15,34 @@ discard block |
||
15 | 15 | $template = gettemplate('notes', true); |
16 | 16 | |
17 | 17 | $result = array(); |
18 | -if(($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
18 | +if (($result_message = sys_get_param_str('MESSAGE')) && isset(classLocale::$lang[$result_message])) { |
|
19 | 19 | $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => classLocale::$lang[$result_message]); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $note_id_edit = sys_get_param_id('note_id_edit'); |
23 | -if(sys_get_param('note_delete')) { |
|
23 | +if (sys_get_param('note_delete')) { |
|
24 | 24 | try { |
25 | 25 | $not = ''; |
26 | 26 | $query_where = ''; |
27 | - switch(sys_get_param_str('note_delete_range')) { |
|
27 | + switch (sys_get_param_str('note_delete_range')) { |
|
28 | 28 | case 'all': |
29 | 29 | break; |
30 | 30 | |
31 | 31 | case 'marked_not': |
32 | 32 | $not = 'NOT'; |
33 | 33 | case 'marked': |
34 | - if(!is_array($notes_marked = sys_get_param('note'))) { |
|
34 | + if (!is_array($notes_marked = sys_get_param('note'))) { |
|
35 | 35 | throw new Exception('note_err_none_selected', ERR_WARNING); |
36 | 36 | } |
37 | 37 | |
38 | 38 | $notes_marked_filtered = array(); |
39 | - foreach($notes_marked as $note_id => $note_select) { |
|
40 | - if($note_select == 'on' && $note_id = idval($note_id)) { |
|
39 | + foreach ($notes_marked as $note_id => $note_select) { |
|
40 | + if ($note_select == 'on' && $note_id = idval($note_id)) { |
|
41 | 41 | $notes_marked_filtered[] = $note_id; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | - if(empty($notes_marked_filtered)) { |
|
45 | + if (empty($notes_marked_filtered)) { |
|
46 | 46 | throw new Exception('note_err_none_selected', ERR_WARNING); |
47 | 47 | } |
48 | 48 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | db_note_list_delete($user, $query_where); |
60 | 60 | sn_db_transaction_commit(); |
61 | 61 | throw new Exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
62 | - } catch(Exception $e) { |
|
62 | + } catch (Exception $e) { |
|
63 | 63 | $note_id_edit = 0; |
64 | 64 | sn_db_transaction_rollback(); |
65 | 65 | $result[] = array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'MESSAGE' => classLocale::$lang[$e->getMessage()], |
68 | 68 | ); |
69 | 69 | } |
70 | -} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
70 | +} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) { |
|
71 | 71 | $note_title == db_escape(classLocale::$lang['note_new_title']) ? $note_title = '' : false; |
72 | 72 | ($note_text = sys_get_param_str('note_text')) == db_escape(classLocale::$lang['note_new_text']) ? $note_text = '' : false; |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $note_system = max(0, min(sys_get_param_id('note_system'), $config->game_maxSystem)); |
77 | 77 | $note_planet = max(0, min(sys_get_param_id('note_planet'), $config->game_maxPlanet + 1)); |
78 | 78 | |
79 | - if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
79 | + if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) { |
|
80 | 80 | throw new exception('note_err_note_empty', ERR_WARNING); |
81 | 81 | } |
82 | 82 | |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0; |
86 | 86 | |
87 | 87 | sn_db_transaction_start(); |
88 | - if($note_id_edit) { |
|
88 | + if ($note_id_edit) { |
|
89 | 89 | $check_note_id = db_note_get_id_and_owner($note_id_edit); |
90 | - if(!$check_note_id) { |
|
90 | + if (!$check_note_id) { |
|
91 | 91 | throw new Exception('note_err_note_not_found', ERR_ERROR); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - if($note_id_edit) { |
|
96 | - if($check_note_id['owner'] != $user['id']) { |
|
95 | + if ($note_id_edit) { |
|
96 | + if ($check_note_id['owner'] != $user['id']) { |
|
97 | 97 | throw new Exception('note_err_owner_wrong', ERR_ERROR); |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | sn_db_transaction_commit(); |
106 | 106 | sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added')); |
107 | 107 | // throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE); |
108 | - } catch(Exception $e) { |
|
108 | + } catch (Exception $e) { |
|
109 | 109 | $note_id_edit = 0; |
110 | 110 | sn_db_transaction_rollback(); |
111 | 111 | $result[] = array( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | -if(!$note_id_edit) { |
|
118 | +if (!$note_id_edit) { |
|
119 | 119 | note_assign($template, array( |
120 | 120 | 'id' => 0, |
121 | 121 | 'time' => SN_TIME_NOW, |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | |
129 | 129 | $note_exist = false; |
130 | 130 | $notes_query = db_note_list_by_owner($user['id']); |
131 | -while($note_row = db_fetch($notes_query)) { |
|
131 | +while ($note_row = db_fetch($notes_query)) { |
|
132 | 132 | note_assign($template, $note_row); |
133 | 133 | $note_exist = $note_exist || $note_row['id'] == $note_id_edit; |
134 | 134 | } |
135 | 135 | $note_id_edit = $note_exist ? $note_id_edit : 0; |
136 | 136 | |
137 | -foreach($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
137 | +foreach ($note_priority_classes as $note_priority_id => $note_priority_class) { |
|
138 | 138 | $template->assign_block_vars('note_priority', array( |
139 | 139 | 'ID' => $note_priority_id, |
140 | 140 | 'CLASS' => $note_priority_classes[$note_priority_id], |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | )); |
143 | 143 | } |
144 | 144 | |
145 | -foreach(classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
145 | +foreach (classLocale::$lang['sys_planet_type'] as $planet_type_id => $planet_type_string) { |
|
146 | 146 | $template->assign_block_vars('planet_type', array( |
147 | 147 | 'ID' => $planet_type_id, |
148 | 148 | 'TEXT' => $planet_type_string, |
149 | 149 | )); |
150 | 150 | } |
151 | 151 | |
152 | -foreach($result as $result_data) { |
|
152 | +foreach ($result as $result_data) { |
|
153 | 153 | $template->assign_block_vars('result', $result_data); |
154 | 154 | } |
155 | 155 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
10 | 10 | |
11 | -if(!sn_module_get_active_count('payment')) { |
|
11 | +if (!sn_module_get_active_count('payment')) { |
|
12 | 12 | sys_redirect('dark_matter.php'); |
13 | 13 | die(); |
14 | 14 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | // Таблица скидок |
67 | 67 | $prev_discount = 0; |
68 | -if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | - foreach(sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | - if($discount && $discount != $prev_discount) { |
|
68 | +if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | + foreach (sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | + if ($discount && $discount != $prev_discount) { |
|
71 | 71 | $template->assign_block_vars('discount', array( |
72 | 72 | 'SUM' => $sum, |
73 | 73 | 'DISCOUNT' => $discount * 100, |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | // Результат платежа |
83 | -if($payment_id = sys_get_param_id('payment_id')) { |
|
83 | +if ($payment_id = sys_get_param_id('payment_id')) { |
|
84 | 84 | $payment = db_payment_get($payment_id); |
85 | - if($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
85 | + if ($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained']))); |
88 | 88 | } |
89 | - if($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
89 | + if ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
90 | 90 | $template->assign_block_vars('result', array( |
91 | 91 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), |
92 | 92 | 'STATUS' => 1, |
93 | 93 | )); |
94 | 94 | } |
95 | - if($payment['payment_test']) { |
|
95 | + if ($payment['payment_test']) { |
|
96 | 96 | $template->assign_block_vars('result', array( |
97 | 97 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_test']), |
98 | 98 | 'STATUS' => -1, |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | 'metamatter' => sys_get_param_float('metamatter'), |
108 | 108 | ); |
109 | 109 | |
110 | -if(!$request['metamatter']) { |
|
110 | +if (!$request['metamatter']) { |
|
111 | 111 | unset($_POST); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
117 | 117 | }); |
118 | 118 | |
119 | 119 | // pdump($payment_methods_available); |
120 | 120 | $payment_module_valid = false; |
121 | 121 | $payment_module = sys_get_param_str('payment_module'); |
122 | -foreach(sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
123 | - if(!is_object($module) || !$module->manifest['active']) { |
|
122 | +foreach (sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
123 | + if (!is_object($module) || !$module->manifest['active']) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | 127 | lng_include($module_name, $module->manifest['root_relative']); |
128 | 128 | |
129 | - foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | - foreach($available_methods as $payment_method => $payment_currency) { |
|
131 | - if(isset($module->manifest['payment_method'][$payment_method])) { |
|
129 | + foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | + foreach ($available_methods as $payment_method => $payment_currency) { |
|
131 | + if (isset($module->manifest['payment_method'][$payment_method])) { |
|
132 | 132 | $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method]; |
133 | 133 | } |
134 | 134 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | global $template_result; |
141 | 141 | // Доступные платежные методы |
142 | -foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | - if(empty($payment_methods)) { |
|
142 | +foreach ($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | + if (empty($payment_methods)) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | 'ID' => $payment_type_id, |
149 | 149 | 'NAME' => classLocale::$lang['pay_methods'][$payment_type_id], |
150 | 150 | ); |
151 | - foreach($payment_methods as $payment_method_id => $module_list) { |
|
152 | - if(empty($module_list)) { |
|
151 | + foreach ($payment_methods as $payment_method_id => $module_list) { |
|
152 | + if (empty($module_list)) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array( |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | 'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']), |
161 | 161 | 'BUTTON' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']), |
162 | 162 | ); |
163 | - foreach($module_list as $payment_module_name => $payment_module_method_details) { |
|
163 | + foreach ($module_list as $payment_module_name => $payment_module_method_details) { |
|
164 | 164 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array( |
165 | 165 | 'MODULE' => $payment_module_name, |
166 | 166 | ); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - if(empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
170 | + if (empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
171 | 171 | unset($template_result['.']['payment'][$payment_type_id]); |
172 | 172 | } |
173 | 173 | } |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name])); |
181 | 181 | |
182 | 182 | // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it |
183 | -if($payment_module_valid) { |
|
183 | +if ($payment_module_valid) { |
|
184 | 184 | // $payment_module = $payment_module; // Really - do nothing |
185 | -} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
185 | +} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
186 | 186 | reset($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
187 | 187 | $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
188 | -} elseif(count(sn_module::$sn_module_list['payment']) == 1) { |
|
188 | +} elseif (count(sn_module::$sn_module_list['payment']) == 1) { |
|
189 | 189 | $payment_module = $module_name; |
190 | 190 | } else { |
191 | 191 | $payment_module = ''; |
192 | 192 | } |
193 | 193 | |
194 | -if($payment_type_selected && $payment_method_selected) { |
|
195 | - foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
194 | +if ($payment_type_selected && $payment_method_selected) { |
|
195 | + foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
196 | 196 | $template->assign_block_vars('payment_module', array( |
197 | 197 | 'ID' => $module_name, |
198 | 198 | 'NAME' => classLocale::$lang["module_{$module_name}_name"], |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -foreach(classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
204 | +foreach (classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
205 | 205 | $course = get_exchange_rate($key); |
206 | 206 | // if(!$course || $key == $config->payment_currency_default) { |
207 | - if(!$course) { |
|
207 | + if (!$course) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $template->assign_block_vars('exchange', array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | )); |
220 | 220 | } |
221 | 221 | |
222 | -if($request['metamatter'] && $payment_module) { |
|
222 | +if ($request['metamatter'] && $payment_module) { |
|
223 | 223 | try { |
224 | 224 | // Any possible errors about generating paylink should be raised in module! |
225 | 225 | $pay_link = sn_module::$sn_module[$payment_module]->compile_request($request); |
226 | 226 | |
227 | 227 | // Поддержка дополнительной информации |
228 | - if(is_array($pay_link['RENDER'])) { |
|
229 | - foreach($pay_link['RENDER'] as $html_data) { |
|
228 | + if (is_array($pay_link['RENDER'])) { |
|
229 | + foreach ($pay_link['RENDER'] as $html_data) { |
|
230 | 230 | $template->assign_block_vars('render', $html_data); |
231 | - if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | - foreach($html_data['VALUE'] as $value_id => $value_value) { |
|
231 | + if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | + foreach ($html_data['VALUE'] as $value_id => $value_value) { |
|
233 | 233 | $template->assign_block_vars('render.value', array( |
234 | 234 | 'FIELD' => $value_id, |
235 | 235 | 'VALUE' => $value_value, |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // Поддержка передачи данных для многошаговых платежных систем |
243 | - if(is_array($pay_link['DATA'])) { |
|
244 | - foreach($pay_link['DATA'] as $key => $value) { |
|
243 | + if (is_array($pay_link['DATA'])) { |
|
244 | + foreach ($pay_link['DATA'] as $key => $value) { |
|
245 | 245 | $template->assign_block_vars('pay_link_data', array( |
246 | 246 | 'FIELD' => $key, |
247 | 247 | 'VALUE' => $value, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
252 | + if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
253 | 253 | // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте |
254 | 254 | $template->assign_vars(array( |
255 | 255 | 'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } else { |
259 | 259 | throw new exception(classLocale::$lang['pay_msg_request_paylink_unsupported'], ERR_ERROR); |
260 | 260 | } |
261 | - } catch(exception $e) { |
|
261 | + } catch (exception $e) { |
|
262 | 262 | $template->assign_block_vars('result', $response = array( |
263 | 263 | 'STATUS' => $e->getCode(), |
264 | 264 | 'MESSAGE' => $e->getMessage(), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Прегенерированные пакеты |
271 | -foreach($unit_available_amount_list as $unit_amount => $discount) { |
|
271 | +foreach ($unit_available_amount_list as $unit_amount => $discount) { |
|
272 | 272 | $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency); |
273 | 273 | $template->assign_block_vars('mm_amount', array( |
274 | 274 | 'VALUE' => $unit_amount, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'PLAYER_CURRENCY' => $player_currency, |
304 | 304 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
305 | 305 | |
306 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
306 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
307 | 307 | 'UNIT_AMOUNT_TEXT' => pretty_number($request['metamatter']), |
308 | 308 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
309 | 309 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | $unit_id = sys_get_param_id('gid'); |
15 | -if($unit_id == RES_DARK_MATTER) { |
|
15 | +if ($unit_id == RES_DARK_MATTER) { |
|
16 | 16 | sys_redirect('dark_matter.php'); |
17 | 17 | } |
18 | 18 | |
19 | -if($unit_id == RES_METAMATTER) { |
|
19 | +if ($unit_id == RES_METAMATTER) { |
|
20 | 20 | sys_redirect('metamatter.php'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | lng_include('infos'); |
24 | -if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) { |
|
24 | +if (!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) { |
|
25 | 25 | sys_redirect('index.php?page=techtree'); |
26 | 26 | } |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $unit_data = get_unit_param($unit_id); |
31 | 31 | $unit_type = $unit_data['type']; |
32 | 32 | |
33 | -if($unit_type == UNIT_SHIPS) { |
|
33 | +if ($unit_type == UNIT_SHIPS) { |
|
34 | 34 | $template_result['UNIT_IS_SHIP'] = true; |
35 | 35 | |
36 | 36 | $ship_data = get_ship_data($unit_id, $user); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | $engine_template_info = array(); |
49 | - foreach($unit_data['engine'] as $unit_engine_data) { |
|
49 | + foreach ($unit_data['engine'] as $unit_engine_data) { |
|
50 | 50 | $unit_engine_data = get_engine_data($user, $unit_engine_data); |
51 | 51 | |
52 | 52 | $engine_template_info[] = array( |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | |
67 | 67 | $sn_data_group_combat = sn_get_groups('combat'); |
68 | -if(in_array($unit_id, $sn_data_group_combat)) { |
|
68 | +if (in_array($unit_id, $sn_data_group_combat)) { |
|
69 | 69 | $template_result['UNIT_IS_COMBAT'] = true; |
70 | 70 | |
71 | 71 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | $volley_arr = $rapid_to = $rapid_from = array(); |
74 | 74 | $str_rapid_from = ''; |
75 | 75 | $str_rapid_to = ''; |
76 | - foreach($sn_data_group_combat as $enemy_id) { |
|
76 | + foreach ($sn_data_group_combat as $enemy_id) { |
|
77 | 77 | $enemy_data = get_unit_param($enemy_id); |
78 | 78 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
79 | 79 | |
80 | 80 | $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability; |
81 | - if($rapid >= 1) { |
|
81 | + if ($rapid >= 1) { |
|
82 | 82 | $volley_arr[$enemy_id]['TO'] = floor($rapid); |
83 | 83 | } |
84 | 84 | |
85 | 85 | $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability; |
86 | - if($rapid >= 1) { |
|
86 | + if ($rapid >= 1) { |
|
87 | 87 | $volley_arr[$enemy_id]['FROM'] = floor($rapid); |
88 | 88 | } |
89 | 89 | } |
90 | - foreach($volley_arr as $enemy_id => &$rapid) { |
|
90 | + foreach ($volley_arr as $enemy_id => &$rapid) { |
|
91 | 91 | $rapid['ENEMY_ID'] = $enemy_id; |
92 | 92 | $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id]; |
93 | 93 | } |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | |
106 | 106 | } |
107 | 107 | |
108 | -if(classLocale::$lang['info'][$unit_id]['effect']) { |
|
108 | +if (classLocale::$lang['info'][$unit_id]['effect']) { |
|
109 | 109 | $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect']; |
110 | 110 | } |
111 | 111 | |
112 | -if($unit_data['bonus']) { |
|
112 | +if ($unit_data['bonus']) { |
|
113 | 113 | $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : ( |
114 | 114 | ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '') |
115 | 115 | ); |
@@ -174,20 +174,20 @@ discard block |
||
174 | 174 | )); |
175 | 175 | |
176 | 176 | $ActualProd = floor($Prod[$BuildID]); |
177 | - if($BuildID != STRUC_MINE_FUSION) { |
|
177 | + if ($BuildID != STRUC_MINE_FUSION) { |
|
178 | 178 | $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]); |
179 | 179 | } else { |
180 | 180 | $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]); |
181 | 181 | } |
182 | 182 | |
183 | 183 | $BuildStartLvl = $CurrentBuildtLvl - 2; |
184 | - if($BuildStartLvl < 1) { |
|
184 | + if ($BuildStartLvl < 1) { |
|
185 | 185 | $BuildStartLvl = 1; |
186 | 186 | } |
187 | 187 | $Table = ''; |
188 | 188 | $ProdFirst = 0; |
189 | - for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) { |
|
190 | - if($BuildID != STRUC_MOON_PHALANX) { |
|
189 | + for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) { |
|
190 | + if ($BuildID != STRUC_MOON_PHALANX) { |
|
191 | 191 | $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value( |
192 | 192 | $CurrentUser, |
193 | 193 | $CurrentPlanet, |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | )); |
215 | 215 | |
216 | 216 | $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel; |
217 | - if($ProdFirst > 0) { |
|
218 | - if($BuildID != STRUC_MINE_FUSION) { |
|
217 | + if ($ProdFirst > 0) { |
|
218 | + if ($BuildID != STRUC_MINE_FUSION) { |
|
219 | 219 | $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>"; |
220 | 220 | } else { |
221 | 221 | $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>"; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } else { |
224 | 224 | $bloc['build_gain'] = ''; |
225 | 225 | } |
226 | - if($BuildID != STRUC_MINE_FUSION) { |
|
226 | + if ($BuildID != STRUC_MINE_FUSION) { |
|
227 | 227 | $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID])); |
228 | 228 | $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true); |
229 | 229 | $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true); |
235 | 235 | $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true); |
236 | 236 | } |
237 | - if($ProdFirst == 0) { |
|
238 | - if($BuildID != STRUC_MINE_FUSION) { |
|
237 | + if ($ProdFirst == 0) { |
|
238 | + if ($BuildID != STRUC_MINE_FUSION) { |
|
239 | 239 | $ProdFirst = floor($Prod[$BuildID]); |
240 | 240 | } else { |
241 | 241 | $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]); |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | |
261 | 261 | $str_rapid_from = ''; |
262 | 262 | $str_rapid_to = ''; |
263 | - foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) { |
|
263 | + foreach (sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) { |
|
264 | 264 | $enemy_data = get_unit_param($enemy_id); |
265 | 265 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
266 | 266 | |
267 | 267 | $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability); |
268 | - if($rapid >= 1) { |
|
268 | + if ($rapid >= 1) { |
|
269 | 269 | $str_rapid_to .= "{$lang['nfo_rf_again']} {$lang['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>"; |
270 | 270 | } |
271 | 271 | |
272 | 272 | $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability); |
273 | - if($rapid >= 1) { |
|
273 | + if ($rapid >= 1) { |
|
274 | 274 | $str_rapid_from .= "{$lang['tech'][$enemy_id]} {$lang['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>"; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | - if($str_rapid_to && $str_rapid_from) { |
|
278 | + if ($str_rapid_to && $str_rapid_from) { |
|
279 | 279 | $str_rapid_to .= '<hr>'; |
280 | 280 | } |
281 | 281 | |
@@ -304,75 +304,75 @@ discard block |
||
304 | 304 | |
305 | 305 | $unit_info = get_unit_param($unit_id); |
306 | 306 | |
307 | -if($unit_id >= 1 && $unit_id <= 3) { |
|
307 | +if ($unit_id >= 1 && $unit_id <= 3) { |
|
308 | 308 | // Cas des mines |
309 | 309 | $PageTPL = gettemplate('info_buildings_table'); |
310 | 310 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
311 | 311 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_p_hour}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_energy}</td><td class=\"c\">{nfo_difference}</td></tr>"; |
312 | 312 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>"; |
313 | -} elseif($unit_id == 4) { |
|
313 | +} elseif ($unit_id == 4) { |
|
314 | 314 | // Centrale Solaire |
315 | 315 | $PageTPL = gettemplate('info_buildings_table'); |
316 | 316 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
317 | 317 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td></tr>"; |
318 | 318 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th></tr>"; |
319 | -} elseif($unit_id == STRUC_MINE_FUSION) { |
|
319 | +} elseif ($unit_id == STRUC_MINE_FUSION) { |
|
320 | 320 | // Centrale Fusion |
321 | 321 | $PageTPL = gettemplate('info_buildings_table'); |
322 | 322 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
323 | 323 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_deuter}</td><td class=\"c\">{nfo_difference}</td></tr>"; |
324 | 324 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>"; |
325 | -} elseif($unit_id >= STRUC_FACTORY_ROBOT && $unit_id <= 32) { |
|
325 | +} elseif ($unit_id >= STRUC_FACTORY_ROBOT && $unit_id <= 32) { |
|
326 | 326 | // Batiments Generaux |
327 | 327 | $PageTPL = gettemplate('info_buildings_general'); |
328 | 328 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
329 | -} elseif($unit_id == STRUC_TERRAFORMER) { |
|
329 | +} elseif ($unit_id == STRUC_TERRAFORMER) { |
|
330 | 330 | // Batiments Terraformer |
331 | 331 | $PageTPL = gettemplate('info_buildings_general'); |
332 | -} elseif($unit_id == STRUC_ALLY_DEPOSIT) { |
|
332 | +} elseif ($unit_id == STRUC_ALLY_DEPOSIT) { |
|
333 | 333 | // Dépot d'alliance |
334 | 334 | $PageTPL = gettemplate('info_buildings_general'); |
335 | 335 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
336 | -} elseif($unit_id == STRUC_LABORATORY_NANO) { |
|
336 | +} elseif ($unit_id == STRUC_LABORATORY_NANO) { |
|
337 | 337 | // nano |
338 | 338 | $PageTPL = gettemplate('info_buildings_general'); |
339 | 339 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
340 | -} elseif($unit_id == STRUC_SILO) { |
|
340 | +} elseif ($unit_id == STRUC_SILO) { |
|
341 | 341 | // Silo de missiles |
342 | 342 | $PageTPL = gettemplate('info_buildings_general'); |
343 | 343 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
344 | -} elseif($unit_id == STRUC_MOON_STATION) { |
|
344 | +} elseif ($unit_id == STRUC_MOON_STATION) { |
|
345 | 345 | // Batiments lunaires |
346 | 346 | $PageTPL = gettemplate('info_buildings_general'); |
347 | -} elseif($unit_id == STRUC_MOON_PHALANX) { |
|
347 | +} elseif ($unit_id == STRUC_MOON_PHALANX) { |
|
348 | 348 | // Phalange |
349 | 349 | $PageTPL = gettemplate('info_buildings_table'); |
350 | 350 | $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_range}</td></tr>"; |
351 | 351 | $TableTPL = "<tr><th>{build_lvl}</th><th>{build_range}</th></tr>"; |
352 | 352 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
353 | -} elseif($unit_id == STRUC_MOON_GATE) { |
|
353 | +} elseif ($unit_id == STRUC_MOON_GATE) { |
|
354 | 354 | // Porte de Saut |
355 | 355 | $PageTPL = gettemplate('info_buildings_general'); |
356 | 356 | $DestroyTPL = gettemplate('info_buildings_destroy'); |
357 | -} elseif(in_array($unit_id, sn_get_groups('tech'))) { |
|
357 | +} elseif (in_array($unit_id, sn_get_groups('tech'))) { |
|
358 | 358 | // Laboratoire |
359 | 359 | $PageTPL = gettemplate('info_buildings_general'); |
360 | -} elseif(in_array($unit_id, sn_get_groups('fleet'))) { |
|
360 | +} elseif (in_array($unit_id, sn_get_groups('fleet'))) { |
|
361 | 361 | // Flotte |
362 | 362 | |
363 | 363 | $PageTPL = gettemplate('info_buildings_fleet'); |
364 | 364 | |
365 | 365 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_SHIPS]; |
366 | 366 | $rapid_fire = eco_render_rapid_fire($unit_id); |
367 | - $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
|
367 | + $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
|
368 | 368 | $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de |
369 | 369 | |
370 | 370 | $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure |
371 | - $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
372 | - $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
371 | + $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
372 | + $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
373 | 373 | $parse['capacity_pt'] = pretty_number($unit_info['capacity']); // Capacitée de fret |
374 | - $parse['base_speed'] = pretty_number($unit_info['engine'][0]['speed']); // Vitesse de base |
|
375 | - $parse['base_conso'] = pretty_number($unit_info['engine'][0]['consumption']); // Consommation de base |
|
374 | + $parse['base_speed'] = pretty_number($unit_info['engine'][0]['speed']); // Vitesse de base |
|
375 | + $parse['base_conso'] = pretty_number($unit_info['engine'][0]['consumption']); // Consommation de base |
|
376 | 376 | |
377 | 377 | $parse['ACTUAL_ARMOR'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), ($unit_info['metal'] + $unit_info['crystal']) / 10)); |
378 | 378 | $parse['ACTUAL_SHIELD'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])); |
@@ -382,37 +382,37 @@ discard block |
||
382 | 382 | $parse['ACTUAL_CAPACITY'] = pretty_number($ship_data['capacity']); |
383 | 383 | $parse['ACTUAL_SPEED'] = pretty_number($ship_data['speed']); |
384 | 384 | $parse['ACTUAL_CONSUMPTION'] = pretty_number($ship_data['consumption']); |
385 | - if(count($unit_info['engine']) > 1) { |
|
386 | - $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>"; // Vitesse rééquipée |
|
385 | + if (count($unit_info['engine']) > 1) { |
|
386 | + $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>"; // Vitesse rééquipée |
|
387 | 387 | $parse['upd_conso'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['consumption']) . ")</font>"; // Consommation apres rééquipement |
388 | 388 | } |
389 | -} elseif(in_array($unit_id, sn_get_groups('defense_active'))) { |
|
389 | +} elseif (in_array($unit_id, sn_get_groups('defense_active'))) { |
|
390 | 390 | // Defenses |
391 | 391 | $PageTPL = gettemplate('info_buildings_defense'); |
392 | 392 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE]; |
393 | 393 | |
394 | 394 | $rapid_fire = eco_render_rapid_fire($unit_id); |
395 | - $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
|
395 | + $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers |
|
396 | 396 | $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de |
397 | 397 | |
398 | 398 | $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure |
399 | - $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
400 | - $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
401 | -} elseif(in_array($unit_id, sn_get_groups('missile'))) { |
|
399 | + $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
400 | + $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
401 | +} elseif (in_array($unit_id, sn_get_groups('missile'))) { |
|
402 | 402 | // Misilles |
403 | 403 | $PageTPL = gettemplate('info_buildings_defense'); |
404 | 404 | $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE]; |
405 | 405 | $parse['hull_pt'] = pretty_number($unit_info['metal'] + $unit_info['crystal']); // Points de Structure |
406 | - $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
407 | - $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
408 | -} elseif(in_array($unit_id, sn_get_groups(array('mercenaries', 'governors', 'artifacts', 'resources_all')))) { |
|
406 | + $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier |
|
407 | + $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque |
|
408 | +} elseif (in_array($unit_id, sn_get_groups(array('mercenaries', 'governors', 'artifacts', 'resources_all')))) { |
|
409 | 409 | // Officiers |
410 | 410 | $PageTPL = gettemplate('info_officiers_general'); |
411 | 411 | |
412 | 412 | $mercenary = $unit_info; |
413 | 413 | $mercenary_bonus = $mercenary['bonus']; |
414 | 414 | $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}"; |
415 | - switch($mercenary['bonus_type']) { |
|
415 | + switch ($mercenary['bonus_type']) { |
|
416 | 416 | case BONUS_PERCENT: |
417 | 417 | $mercenary_bonus = "{$mercenary_bonus}%"; |
418 | 418 | break; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | $parse['EFFECT'] = classLocale::$lang['info'][$unit_id]['effect']; |
432 | 432 | $parse['mercenary_bonus'] = $mercenary_bonus; |
433 | - if(!in_array($unit_id, sn_get_groups(array('artifacts', 'resources_all')))) { |
|
433 | + if (!in_array($unit_id, sn_get_groups(array('artifacts', 'resources_all')))) { |
|
434 | 434 | $parse['max_level'] = classLocale::$lang['sys_level'] . ' ' . |
435 | 435 | (in_array($unit_id, sn_get_groups('mercenaries')) ? mrc_get_level($user, $planetrow, $unit_id) : ($mercenary['location'] == LOC_USER ? mrc_get_level($user, null, $unit_id) : ($planetrow['PLANET_GOVERNOR_ID'] == $unit_id ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0))) |
436 | 436 | . (isset($mercenary['max']) ? "/{$mercenary['max']}" : ''); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // ---- Tableau d'evolution |
441 | -if($TableHeadTPL != '') { |
|
441 | +if ($TableHeadTPL != '') { |
|
442 | 442 | $parse['table_head'] = parsetemplate($TableHeadTPL, classLocale::$lang); |
443 | 443 | $parse['table_data'] = ShowProductionTable($user, $planetrow, $unit_id, $TableTPL); |
444 | 444 | } |
@@ -48,106 +48,106 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | switch($mode) { |
51 | - case 'write': |
|
52 | - $error_list = array(); |
|
53 | - $template = gettemplate('msg_message_compose', true); |
|
51 | + case 'write': |
|
52 | + $error_list = array(); |
|
53 | + $template = gettemplate('msg_message_compose', true); |
|
54 | 54 | |
55 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
56 | - if($recipient_name) { |
|
57 | - $recipient_row = db_user_by_username($recipient_name); |
|
58 | - } |
|
55 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
56 | + if($recipient_name) { |
|
57 | + $recipient_row = db_user_by_username($recipient_name); |
|
58 | + } |
|
59 | 59 | |
60 | - if(!$recipient_row) { |
|
61 | - $recipient_id = sys_get_param_id('id'); |
|
62 | - $recipient_row = db_user_by_id($recipient_id); |
|
63 | 60 | if(!$recipient_row) { |
64 | - $recipient_id = 0; |
|
61 | + $recipient_id = sys_get_param_id('id'); |
|
62 | + $recipient_row = db_user_by_id($recipient_id); |
|
63 | + if(!$recipient_row) { |
|
64 | + $recipient_id = 0; |
|
65 | + } |
|
65 | 66 | } |
66 | - } |
|
67 | - |
|
68 | - if($recipient_row) { |
|
69 | - $recipient_id = $recipient_row['id']; |
|
70 | - $recipient_name = $recipient_row['username']; |
|
71 | - } |
|
72 | - |
|
73 | - if($recipient_id == $user['id']) { |
|
74 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
75 | - } |
|
76 | - |
|
77 | - $re = 0; |
|
78 | - $subject = sys_get_param_str('subject'); |
|
79 | - while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
80 | - $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix'])); |
|
81 | - $re++; |
|
82 | - } |
|
83 | - $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false; |
|
84 | 67 | |
85 | - if(sys_get_param_str('msg_send')) { |
|
86 | - $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
68 | + if($recipient_row) { |
|
69 | + $recipient_id = $recipient_row['id']; |
|
70 | + $recipient_name = $recipient_row['username']; |
|
71 | + } |
|
87 | 72 | |
88 | - if(!$recipient_id) { |
|
89 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
73 | + if($recipient_id == $user['id']) { |
|
74 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
90 | 75 | } |
91 | 76 | |
92 | - $text = sys_get_param_str('text'); |
|
93 | - if(!$text) { |
|
94 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
77 | + $re = 0; |
|
78 | + $subject = sys_get_param_str('subject'); |
|
79 | + while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
80 | + $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix'])); |
|
81 | + $re++; |
|
95 | 82 | } |
83 | + $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false; |
|
96 | 84 | |
97 | - if(empty($error_list)) { |
|
98 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
85 | + if(sys_get_param_str('msg_send')) { |
|
86 | + $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
99 | 87 | |
100 | - $user_safe_name = db_escape($user['username']); |
|
101 | - $recipient_name = db_escape($recipient_name); |
|
102 | - msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
88 | + if(!$recipient_id) { |
|
89 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
90 | + } |
|
103 | 91 | |
104 | - //$recipient_id = 0; |
|
105 | - //$recipient_name = ''; |
|
106 | - //$subject = ''; |
|
107 | - $text = ''; |
|
92 | + $text = sys_get_param_str('text'); |
|
93 | + if(!$text) { |
|
94 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
95 | + } |
|
108 | 96 | |
109 | - $msg_sent = true; |
|
110 | - } else { |
|
111 | - $subject = sys_get_param_str_unsafe('subject'); |
|
112 | - $text = sys_get_param_str_unsafe('text'); |
|
113 | - } |
|
114 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
115 | - } |
|
97 | + if(empty($error_list)) { |
|
98 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
116 | 99 | |
117 | - $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
100 | + $user_safe_name = db_escape($user['username']); |
|
101 | + $recipient_name = db_escape($recipient_name); |
|
102 | + msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
118 | 103 | |
119 | - $template->assign_vars(array( |
|
120 | - 'RECIPIENT_ID' => $recipient_id, |
|
121 | - 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
122 | - 'SUBJECT' => htmlspecialchars($subject), |
|
123 | - 'TEXT' => htmlspecialchars($text), |
|
124 | - )); |
|
104 | + //$recipient_id = 0; |
|
105 | + //$recipient_name = ''; |
|
106 | + //$subject = ''; |
|
107 | + $text = ''; |
|
125 | 108 | |
126 | - foreach($error_list as $error_message) { |
|
127 | - $template->assign_block_vars('result', $error_message); |
|
128 | - } |
|
109 | + $msg_sent = true; |
|
110 | + } else { |
|
111 | + $subject = sys_get_param_str_unsafe('subject'); |
|
112 | + $text = sys_get_param_str_unsafe('text'); |
|
113 | + } |
|
114 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
115 | + } |
|
129 | 116 | |
130 | - $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
131 | - while($message_row = db_fetch($message_query)) { |
|
132 | - $template->assign_block_vars('messages', array( |
|
133 | - 'ID' => $message_row['message_id'], |
|
134 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
135 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
136 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
137 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
117 | + $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
138 | 118 | |
139 | - 'FROM_ID' => $message_row['message_sender'], |
|
119 | + $template->assign_vars(array( |
|
120 | + 'RECIPIENT_ID' => $recipient_id, |
|
121 | + 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
122 | + 'SUBJECT' => htmlspecialchars($subject), |
|
123 | + 'TEXT' => htmlspecialchars($text), |
|
140 | 124 | )); |
141 | - } |
|
142 | 125 | |
143 | - break; |
|
126 | + foreach($error_list as $error_message) { |
|
127 | + $template->assign_block_vars('result', $error_message); |
|
128 | + } |
|
129 | + |
|
130 | + $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
131 | + while($message_row = db_fetch($message_query)) { |
|
132 | + $template->assign_block_vars('messages', array( |
|
133 | + 'ID' => $message_row['message_id'], |
|
134 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
135 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
136 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
137 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
138 | + |
|
139 | + 'FROM_ID' => $message_row['message_sender'], |
|
140 | + )); |
|
141 | + } |
|
144 | 142 | |
145 | - case 'delete': |
|
146 | - $query_add = ''; |
|
143 | + break; |
|
147 | 144 | |
148 | - $message_range = sys_get_param_str('message_range'); |
|
145 | + case 'delete': |
|
146 | + $query_add = ''; |
|
149 | 147 | |
150 | - switch($message_range) { |
|
148 | + $message_range = sys_get_param_str('message_range'); |
|
149 | + |
|
150 | + switch($message_range) { |
|
151 | 151 | case 'unchecked': |
152 | 152 | case 'checked': |
153 | 153 | $marked_message_list = sys_get_param('mark', array()); |
@@ -171,65 +171,65 @@ discard block |
||
171 | 171 | case 'all': |
172 | 172 | $query_add = $query_add ? $query_add : true; |
173 | 173 | break; |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | 176 | if($query_add) { |
177 | 177 | $query_add = $query_add === true ? '' : $query_add; |
178 | 178 | db_message_list_delete($user, $query_add); |
179 | 179 | } |
180 | 180 | |
181 | - case 'show': |
|
182 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
183 | - $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
184 | - } else { |
|
185 | - if($current_class == MSG_TYPE_NEW) { |
|
186 | - $SubUpdateQry = array(); |
|
187 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
189 | - $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
190 | - $user[$message_class['name']] = 0; |
|
181 | + case 'show': |
|
182 | + if($current_class == MSG_TYPE_OUTBOX) { |
|
183 | + $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
184 | + } else { |
|
185 | + if($current_class == MSG_TYPE_NEW) { |
|
186 | + $SubUpdateQry = array(); |
|
187 | + foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | + if($message_class_id != MSG_TYPE_OUTBOX) { |
|
189 | + $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
190 | + $user[$message_class['name']] = 0; |
|
191 | + } |
|
191 | 192 | } |
193 | + $SubUpdateQry = implode(',', $SubUpdateQry); |
|
194 | + } else { |
|
195 | + $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
196 | + $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
197 | + |
|
198 | + $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
199 | + $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
192 | 200 | } |
193 | - $SubUpdateQry = implode(',', $SubUpdateQry); |
|
194 | - } else { |
|
195 | - $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
196 | - $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
197 | 201 | |
198 | - $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
199 | - $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
202 | + db_user_set_by_id($user['id'], $SubUpdateQry); |
|
203 | + $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
200 | 204 | } |
201 | 205 | |
202 | - db_user_set_by_id($user['id'], $SubUpdateQry); |
|
203 | - $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
204 | - } |
|
205 | - |
|
206 | - if(sys_get_param_int('return')) { |
|
207 | - header('Location: messages.php'); |
|
208 | - die(); |
|
209 | - } |
|
206 | + if(sys_get_param_int('return')) { |
|
207 | + header('Location: messages.php'); |
|
208 | + die(); |
|
209 | + } |
|
210 | 210 | |
211 | - $template = gettemplate('msg_message_list', true); |
|
212 | - while($message_row = db_fetch($message_query)) { |
|
213 | - $template->assign_block_vars('messages', array( |
|
214 | - 'ID' => $message_row['message_id'], |
|
215 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
216 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
217 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
218 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
219 | - |
|
220 | - 'FROM_ID' => $message_row['message_sender'], |
|
221 | - 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
222 | - 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
223 | - )); |
|
224 | - } |
|
211 | + $template = gettemplate('msg_message_list', true); |
|
212 | + while($message_row = db_fetch($message_query)) { |
|
213 | + $template->assign_block_vars('messages', array( |
|
214 | + 'ID' => $message_row['message_id'], |
|
215 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
216 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
217 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
218 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
219 | + |
|
220 | + 'FROM_ID' => $message_row['message_sender'], |
|
221 | + 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
222 | + 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
223 | + )); |
|
224 | + } |
|
225 | 225 | |
226 | - $current_class_text = classLocale::$lang['msg_class'][$current_class]; |
|
226 | + $current_class_text = classLocale::$lang['msg_class'][$current_class]; |
|
227 | 227 | |
228 | - $template->assign_vars(array( |
|
229 | - "MESSAGE_CLASS" => $current_class, |
|
230 | - "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
231 | - )); |
|
232 | - break; |
|
228 | + $template->assign_vars(array( |
|
229 | + "MESSAGE_CLASS" => $current_class, |
|
230 | + "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
231 | + )); |
|
232 | + break; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if(!$template) { |
@@ -42,59 +42,59 @@ discard block |
||
42 | 42 | |
43 | 43 | $mode = sys_get_param_str('msg_delete') ? 'delete' : sys_get_param_str('mode'); |
44 | 44 | $current_class = sys_get_param_int('message_class'); |
45 | -if(!isset($sn_message_class_list[$current_class])) { |
|
45 | +if (!isset($sn_message_class_list[$current_class])) { |
|
46 | 46 | $current_class = 0; |
47 | 47 | $mode = ''; |
48 | 48 | } |
49 | 49 | |
50 | -switch($mode) { |
|
50 | +switch ($mode) { |
|
51 | 51 | case 'write': |
52 | 52 | $error_list = array(); |
53 | 53 | $template = gettemplate('msg_message_compose', true); |
54 | 54 | |
55 | 55 | $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
56 | - if($recipient_name) { |
|
56 | + if ($recipient_name) { |
|
57 | 57 | $recipient_row = db_user_by_username($recipient_name); |
58 | 58 | } |
59 | 59 | |
60 | - if(!$recipient_row) { |
|
60 | + if (!$recipient_row) { |
|
61 | 61 | $recipient_id = sys_get_param_id('id'); |
62 | 62 | $recipient_row = db_user_by_id($recipient_id); |
63 | - if(!$recipient_row) { |
|
63 | + if (!$recipient_row) { |
|
64 | 64 | $recipient_id = 0; |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if($recipient_row) { |
|
68 | + if ($recipient_row) { |
|
69 | 69 | $recipient_id = $recipient_row['id']; |
70 | 70 | $recipient_name = $recipient_row['username']; |
71 | 71 | } |
72 | 72 | |
73 | - if($recipient_id == $user['id']) { |
|
73 | + if ($recipient_id == $user['id']) { |
|
74 | 74 | $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $re = 0; |
78 | 78 | $subject = sys_get_param_str('subject'); |
79 | - while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
79 | + while (strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
80 | 80 | $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix'])); |
81 | 81 | $re++; |
82 | 82 | } |
83 | 83 | $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false; |
84 | 84 | |
85 | - if(sys_get_param_str('msg_send')) { |
|
85 | + if (sys_get_param_str('msg_send')) { |
|
86 | 86 | $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
87 | 87 | |
88 | - if(!$recipient_id) { |
|
88 | + if (!$recipient_id) { |
|
89 | 89 | $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
90 | 90 | } |
91 | 91 | |
92 | 92 | $text = sys_get_param_str('text'); |
93 | - if(!$text) { |
|
93 | + if (!$text) { |
|
94 | 94 | $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
95 | 95 | } |
96 | 96 | |
97 | - if(empty($error_list)) { |
|
97 | + if (empty($error_list)) { |
|
98 | 98 | $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
99 | 99 | |
100 | 100 | $user_safe_name = db_escape($user['username']); |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | 'TEXT' => htmlspecialchars($text), |
124 | 124 | )); |
125 | 125 | |
126 | - foreach($error_list as $error_message) { |
|
126 | + foreach ($error_list as $error_message) { |
|
127 | 127 | $template->assign_block_vars('result', $error_message); |
128 | 128 | } |
129 | 129 | |
130 | 130 | $message_query = db_message_list_get_last_20($user, $recipient_id); |
131 | - while($message_row = db_fetch($message_query)) { |
|
131 | + while ($message_row = db_fetch($message_query)) { |
|
132 | 132 | $template->assign_block_vars('messages', array( |
133 | 133 | 'ID' => $message_row['message_id'], |
134 | 134 | 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
@@ -147,25 +147,25 @@ discard block |
||
147 | 147 | |
148 | 148 | $message_range = sys_get_param_str('message_range'); |
149 | 149 | |
150 | - switch($message_range) { |
|
150 | + switch ($message_range) { |
|
151 | 151 | case 'unchecked': |
152 | 152 | case 'checked': |
153 | 153 | $marked_message_list = sys_get_param('mark', array()); |
154 | - if($message_range == 'checked' && empty($marked_message_list)) { |
|
154 | + if ($message_range == 'checked' && empty($marked_message_list)) { |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | |
158 | 158 | $query_add = implode(',', $marked_message_list); |
159 | - if($query_add) { |
|
159 | + if ($query_add) { |
|
160 | 160 | $query_add = "IN ({$query_add})"; |
161 | - if($message_range == 'unchecked') { |
|
161 | + if ($message_range == 'unchecked') { |
|
162 | 162 | $query_add = "NOT {$query_add}"; |
163 | 163 | } |
164 | 164 | $query_add = " AND `message_id` {$query_add}"; |
165 | 165 | } |
166 | 166 | |
167 | 167 | case 'class': |
168 | - if($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) { |
|
168 | + if ($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) { |
|
169 | 169 | $query_add .= " AND `message_type` = {$current_class}"; |
170 | 170 | } |
171 | 171 | case 'all': |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | break; |
174 | 174 | } |
175 | 175 | |
176 | - if($query_add) { |
|
176 | + if ($query_add) { |
|
177 | 177 | $query_add = $query_add === true ? '' : $query_add; |
178 | 178 | db_message_list_delete($user, $query_add); |
179 | 179 | } |
180 | 180 | |
181 | 181 | case 'show': |
182 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
182 | + if ($current_class == MSG_TYPE_OUTBOX) { |
|
183 | 183 | $message_query = db_message_list_outbox_by_user_id($user['id']); |
184 | 184 | } else { |
185 | - if($current_class == MSG_TYPE_NEW) { |
|
185 | + if ($current_class == MSG_TYPE_NEW) { |
|
186 | 186 | $SubUpdateQry = array(); |
187 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
187 | + foreach ($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | + if ($message_class_id != MSG_TYPE_OUTBOX) { |
|
189 | 189 | $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
190 | 190 | $user[$message_class['name']] = 0; |
191 | 191 | } |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
204 | 204 | } |
205 | 205 | |
206 | - if(sys_get_param_int('return')) { |
|
206 | + if (sys_get_param_int('return')) { |
|
207 | 207 | header('Location: messages.php'); |
208 | 208 | die(); |
209 | 209 | } |
210 | 210 | |
211 | 211 | $template = gettemplate('msg_message_list', true); |
212 | - while($message_row = db_fetch($message_query)) { |
|
212 | + while ($message_row = db_fetch($message_query)) { |
|
213 | 213 | $template->assign_block_vars('messages', array( |
214 | 214 | 'ID' => $message_row['message_id'], |
215 | 215 | 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | break; |
233 | 233 | } |
234 | 234 | |
235 | -if(!$template) { |
|
235 | +if (!$template) { |
|
236 | 236 | $template = gettemplate('msg_message_class', true); |
237 | 237 | |
238 | 238 | $query = db_message_count_by_owner_and_type($user); |
239 | - while($message_row = db_fetch($query)) { |
|
239 | + while ($message_row = db_fetch($query)) { |
|
240 | 240 | $messages_total[$message_row['message_type']] = $message_row['message_count']; |
241 | 241 | $messages_total[MSG_TYPE_NEW] += $message_row['message_count']; |
242 | 242 | } |
243 | 243 | |
244 | 244 | $messages_total[MSG_TYPE_OUTBOX] = db_message_count_outbox($user); |
245 | 245 | |
246 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
246 | + foreach ($sn_message_class_list as $message_class_id => $message_class) { |
|
247 | 247 | $template->assign_block_vars('message_class', array( |
248 | 248 | 'ID' => $message_class_id, |
249 | 249 | 'STYLE' => $message_class['name'], |
@@ -69,121 +69,121 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | switch ($fleet_page) { |
72 | - case 3: |
|
72 | + case 3: |
|
73 | 73 | |
74 | - case 2: |
|
75 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
76 | - $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet')))); |
|
77 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
74 | + case 2: |
|
75 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
76 | + $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet')))); |
|
77 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
78 | 78 | |
79 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
80 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
81 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
82 | - die(); |
|
83 | - } |
|
84 | - $ship_amount = floatval($ship_amount); |
|
85 | - } |
|
86 | - |
|
87 | - $UsedPlanet = false; |
|
88 | - $YourPlanet = false; |
|
89 | - $missiontype = array(); |
|
90 | - if ($planet > $config->game_maxPlanet) { |
|
91 | - $target_mission = MT_EXPLORE; |
|
92 | - $missiontype[MT_EXPLORE] = classLocale::$lang['type_mission'][MT_EXPLORE]; |
|
93 | - } elseif ($galaxy && $system && $planet) { |
|
94 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
95 | - |
|
96 | - $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
97 | - |
|
98 | - if ($TargetPlanet['id_owner']) { |
|
99 | - $UsedPlanet = true; |
|
100 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
101 | - $YourPlanet = true; |
|
79 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
80 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
81 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
82 | + die(); |
|
102 | 83 | } |
84 | + $ship_amount = floatval($ship_amount); |
|
103 | 85 | } |
104 | 86 | |
105 | - if (!$UsedPlanet) { |
|
106 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
107 | - $missiontype[MT_COLONIZE] = classLocale::$lang['type_mission'][MT_COLONIZE]; |
|
108 | - $target_mission = MT_COLONIZE; |
|
109 | - $planet_type = PT_PLANET; |
|
110 | - } else { |
|
111 | - message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']); |
|
112 | - } |
|
113 | - } else { |
|
114 | - $recyclers = 0; |
|
115 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
116 | - $recyclers += $fleetarray[$recycler_id]; |
|
87 | + $UsedPlanet = false; |
|
88 | + $YourPlanet = false; |
|
89 | + $missiontype = array(); |
|
90 | + if ($planet > $config->game_maxPlanet) { |
|
91 | + $target_mission = MT_EXPLORE; |
|
92 | + $missiontype[MT_EXPLORE] = classLocale::$lang['type_mission'][MT_EXPLORE]; |
|
93 | + } elseif ($galaxy && $system && $planet) { |
|
94 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
95 | + |
|
96 | + $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
97 | + |
|
98 | + if ($TargetPlanet['id_owner']) { |
|
99 | + $UsedPlanet = true; |
|
100 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
101 | + $YourPlanet = true; |
|
102 | + } |
|
117 | 103 | } |
118 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
119 | - $target_mission = MT_RECYCLE; |
|
120 | - $missiontype[MT_RECYCLE] = classLocale::$lang['type_mission'][MT_RECYCLE]; |
|
121 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
122 | - if ($YourPlanet) { |
|
123 | - $missiontype[MT_RELOCATE] = classLocale::$lang['type_mission'][MT_RELOCATE]; |
|
124 | - $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT]; |
|
104 | + |
|
105 | + if (!$UsedPlanet) { |
|
106 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
107 | + $missiontype[MT_COLONIZE] = classLocale::$lang['type_mission'][MT_COLONIZE]; |
|
108 | + $target_mission = MT_COLONIZE; |
|
109 | + $planet_type = PT_PLANET; |
|
125 | 110 | } else { |
126 | - // Not Your Planet |
|
127 | - if ($fleetarray[SHIP_SPY]) { |
|
128 | - // Only spy missions if any spy |
|
129 | - $missiontype[MT_SPY] = classLocale::$lang['type_mission'][MT_SPY]; |
|
111 | + message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']); |
|
112 | + } |
|
113 | + } else { |
|
114 | + $recyclers = 0; |
|
115 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
116 | + $recyclers += $fleetarray[$recycler_id]; |
|
117 | + } |
|
118 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
119 | + $target_mission = MT_RECYCLE; |
|
120 | + $missiontype[MT_RECYCLE] = classLocale::$lang['type_mission'][MT_RECYCLE]; |
|
121 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
122 | + if ($YourPlanet) { |
|
123 | + $missiontype[MT_RELOCATE] = classLocale::$lang['type_mission'][MT_RELOCATE]; |
|
124 | + $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT]; |
|
130 | 125 | } else { |
131 | - // If no spies... |
|
132 | - if ($fleet_group_mr) { |
|
133 | - $missiontype[MT_AKS] = classLocale::$lang['type_mission'][MT_AKS]; |
|
126 | + // Not Your Planet |
|
127 | + if ($fleetarray[SHIP_SPY]) { |
|
128 | + // Only spy missions if any spy |
|
129 | + $missiontype[MT_SPY] = classLocale::$lang['type_mission'][MT_SPY]; |
|
134 | 130 | } else { |
135 | - $missiontype[MT_ATTACK] = classLocale::$lang['type_mission'][MT_ATTACK]; |
|
136 | - $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT]; |
|
137 | - |
|
138 | - $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD]; |
|
139 | - |
|
140 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
141 | - $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY]; |
|
131 | + // If no spies... |
|
132 | + if ($fleet_group_mr) { |
|
133 | + $missiontype[MT_AKS] = classLocale::$lang['type_mission'][MT_AKS]; |
|
134 | + } else { |
|
135 | + $missiontype[MT_ATTACK] = classLocale::$lang['type_mission'][MT_ATTACK]; |
|
136 | + $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT]; |
|
137 | + |
|
138 | + $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD]; |
|
139 | + |
|
140 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
141 | + $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY]; |
|
142 | + } |
|
142 | 143 | } |
143 | 144 | } |
144 | 145 | } |
145 | 146 | } |
146 | 147 | } |
147 | 148 | } |
148 | - } |
|
149 | - |
|
150 | - if (!$target_mission && is_array($missiontype)) { |
|
151 | - $target_mission = MT_ATTACK; |
|
152 | - } |
|
153 | - |
|
154 | -// $sn_group_missions = sn_get_groups('missions'); |
|
155 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
156 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
157 | -// } |
|
158 | -// |
|
159 | -// |
|
160 | - ksort($missiontype); |
|
161 | - |
|
162 | - $speed_percent = sys_get_param_int('speed', 10); |
|
163 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
164 | - |
|
165 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
166 | - $fleet_speed = $travel_data['fleet_speed']; |
|
167 | - $distance = $travel_data['distance']; |
|
168 | - $duration = $travel_data['duration']; |
|
169 | - $consumption = $travel_data['consumption']; |
|
170 | - // No Break |
|
171 | - |
|
172 | - case 1: |
|
173 | - if ($galaxy && $system && $planet) { |
|
174 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
175 | - |
|
176 | - $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
177 | - } |
|
178 | - |
|
179 | - case 0: |
|
180 | - $template_result += array( |
|
181 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
182 | - 'thissystem' => $planetrow['system'], |
|
183 | - 'thisplanet' => $planetrow['planet'], |
|
184 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
185 | - ); |
|
186 | - // no break |
|
149 | + |
|
150 | + if (!$target_mission && is_array($missiontype)) { |
|
151 | + $target_mission = MT_ATTACK; |
|
152 | + } |
|
153 | + |
|
154 | + // $sn_group_missions = sn_get_groups('missions'); |
|
155 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
156 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
157 | + // } |
|
158 | + // |
|
159 | + // |
|
160 | + ksort($missiontype); |
|
161 | + |
|
162 | + $speed_percent = sys_get_param_int('speed', 10); |
|
163 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
164 | + |
|
165 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
166 | + $fleet_speed = $travel_data['fleet_speed']; |
|
167 | + $distance = $travel_data['distance']; |
|
168 | + $duration = $travel_data['duration']; |
|
169 | + $consumption = $travel_data['consumption']; |
|
170 | + // No Break |
|
171 | + |
|
172 | + case 1: |
|
173 | + if ($galaxy && $system && $planet) { |
|
174 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
175 | + |
|
176 | + $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
177 | + } |
|
178 | + |
|
179 | + case 0: |
|
180 | + $template_result += array( |
|
181 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
182 | + 'thissystem' => $planetrow['system'], |
|
183 | + 'thisplanet' => $planetrow['planet'], |
|
184 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
185 | + ); |
|
186 | + // no break |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
@@ -205,31 +205,31 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | switch($fleet_page) { |
208 | - case 1: |
|
209 | - require('includes/includes/flt_page1.inc'); |
|
210 | - break; |
|
208 | + case 1: |
|
209 | + require('includes/includes/flt_page1.inc'); |
|
210 | + break; |
|
211 | 211 | |
212 | - case 2: |
|
213 | - require_once('includes/includes/flt_page2.inc'); |
|
214 | - sn_fleet_page2(); |
|
215 | - break; |
|
212 | + case 2: |
|
213 | + require_once('includes/includes/flt_page2.inc'); |
|
214 | + sn_fleet_page2(); |
|
215 | + break; |
|
216 | 216 | |
217 | - case 3: |
|
218 | - require_once('includes/includes/flt_page3.inc'); |
|
219 | - sn_fleet_page3($duration); |
|
220 | - break; |
|
217 | + case 3: |
|
218 | + require_once('includes/includes/flt_page3.inc'); |
|
219 | + sn_fleet_page3($duration); |
|
220 | + break; |
|
221 | 221 | |
222 | - case 4: |
|
223 | - require('includes/includes/flt_page4.inc'); |
|
224 | - break; |
|
222 | + case 4: |
|
223 | + require('includes/includes/flt_page4.inc'); |
|
224 | + break; |
|
225 | 225 | |
226 | - case 5: |
|
227 | - require('includes/includes/flt_page5.inc'); |
|
228 | - break; |
|
226 | + case 5: |
|
227 | + require('includes/includes/flt_page5.inc'); |
|
228 | + break; |
|
229 | 229 | |
230 | - default: |
|
231 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
230 | + default: |
|
231 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
232 | 232 | |
233 | - require('includes/includes/flt_page0.inc'); |
|
234 | - break; |
|
233 | + require('includes/includes/flt_page0.inc'); |
|
234 | + break; |
|
235 | 235 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
40 | 40 | |
41 | 41 | $target_mission = sys_get_param_int('target_mission'); |
42 | -if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
42 | +if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
43 | 43 | $planet_type = PT_PLANET; |
44 | -} elseif($target_mission == MT_RECYCLE) { |
|
44 | +} elseif ($target_mission == MT_RECYCLE) { |
|
45 | 45 | $planet_type = PT_DEBRIS; |
46 | -} elseif($target_mission == MT_DESTROY) { |
|
46 | +} elseif ($target_mission == MT_DESTROY) { |
|
47 | 47 | $planet_type = PT_MOON; |
48 | 48 | } else { |
49 | 49 | $planet_type = sys_get_param_int('planet_type'); |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | $MaxFleets = GetMaxFleets($user); |
59 | 59 | $FlyingFleets = FleetList::fleet_count_flying($user['id']); |
60 | -if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
60 | +if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
61 | 61 | message(classLocale::$lang['fl_noslotfree'], classLocale::$lang['fl_error'], "fleet." . PHP_EX, 5); |
62 | 62 | } |
63 | 63 | |
64 | 64 | $MaxExpeditions = get_player_max_expeditons($user); |
65 | -if($MaxExpeditions) { |
|
66 | - $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE); |
|
65 | +if ($MaxExpeditions) { |
|
66 | + $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE); |
|
67 | 67 | } else { |
68 | 68 | $FlyingExpeditions = 0; |
69 | 69 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet')))); |
77 | 77 | $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
78 | 78 | |
79 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
80 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
79 | + foreach ($fleetarray as $ship_id => &$ship_amount) { |
|
80 | + if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
81 | 81 | $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
82 | 82 | die(); |
83 | 83 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $target_mission = MT_COLONIZE; |
109 | 109 | $planet_type = PT_PLANET; |
110 | 110 | } else { |
111 | - message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']); |
|
111 | + message("<font color=\"red\"><b>" . classLocale::$lang['fl_no_planet_type'] . "</b></font>", classLocale::$lang['fl_error']); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | 114 | $recyclers = 0; |
115 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
115 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
116 | 116 | $recyclers += $fleetarray[$recycler_id]; |
117 | 117 | } |
118 | 118 | if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD]; |
139 | 139 | |
140 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
140 | + if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
141 | 141 | $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY]; |
142 | 142 | } |
143 | 143 | } |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | ); |
198 | 198 | |
199 | 199 | $is_transport_missions = false; |
200 | -if($missiontype) { |
|
200 | +if ($missiontype) { |
|
201 | 201 | $sn_group_missions = sn_get_groups('missions'); |
202 | - foreach($missiontype as $mission_data_id => $mission_data) { |
|
202 | + foreach ($missiontype as $mission_data_id => $mission_data) { |
|
203 | 203 | $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | -switch($fleet_page) { |
|
207 | +switch ($fleet_page) { |
|
208 | 208 | case 1: |
209 | 209 | require('includes/includes/flt_page1.inc'); |
210 | 210 | break; |