@@ -12,25 +12,25 @@ discard block |
||
12 | 12 | global $debug, $sn_mvc, $template_result, $user; |
13 | 13 | |
14 | 14 | // Напоминание для Администрации, что игра отключена |
15 | -if($template_result[F_GAME_DISABLE]) { |
|
15 | +if ($template_result[F_GAME_DISABLE]) { |
|
16 | 16 | // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php |
17 | 17 | echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>'; |
18 | 18 | } |
19 | 19 | unset($disable_reason); |
20 | 20 | |
21 | 21 | |
22 | -if(defined('IN_ADMIN') && IN_ADMIN === true) { |
|
22 | +if (defined('IN_ADMIN') && IN_ADMIN === true) { |
|
23 | 23 | lng_include('admin'); |
24 | -} elseif($sys_user_logged_in) { |
|
24 | +} elseif ($sys_user_logged_in) { |
|
25 | 25 | sys_user_vacation($user); |
26 | 26 | |
27 | 27 | $planet_id = SetSelectedPlanet($user); |
28 | 28 | |
29 | 29 | // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!! |
30 | - if($user['ally_id']) { |
|
30 | + if ($user['ally_id']) { |
|
31 | 31 | sn_db_transaction_start(); |
32 | 32 | sn_ali_fill_user_ally($user); |
33 | - if(!$user['ally']['player']['id']) { |
|
33 | + if (!$user['ally']['player']['id']) { |
|
34 | 34 | // sn_sys_logout(false, true); |
35 | 35 | // core_auth::logout(false); |
36 | 36 | classSupernova::$auth->logout(false); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | sn_db_transaction_commit(); |
50 | 50 | |
51 | 51 | $planetrow = $global_data['planet']; |
52 | - if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
52 | + if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
53 | 53 | // sn_sys_logout(false, true); |
54 | 54 | // core_auth::logout(false); |
55 | 55 | classSupernova::$auth->logout(false); |
@@ -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($lang['fl_noslotfree'], $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>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
111 | + message("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $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] = $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] = $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; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | $query = db_banned_list_select(); |
22 | 22 | $i = 0; |
23 | -while($ban_row = db_fetch($query)) { |
|
23 | +while ($ban_row = db_fetch($query)) { |
|
24 | 24 | $template->assign_block_vars('banlist', array( |
25 | 25 | 'USER_NAME' => $ban_row['ban_user_name'], |
26 | 26 | 'REASON' => $ban_row['ban_reason'], |
@@ -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' => $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, $lang['msg_answer_prefix']) !== false) { |
|
79 | + while (strpos($subject, $lang['msg_answer_prefix']) !== false) { |
|
80 | 80 | $subject = substr($subject, strlen($lang['msg_answer_prefix'])); |
81 | 81 | $re++; |
82 | 82 | } |
83 | 83 | $re ? $subject = $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 : $lang['msg_subject_default']; |
87 | 87 | |
88 | - if(!$recipient_id) { |
|
88 | + if (!$recipient_id) { |
|
89 | 89 | $error_list[] = array('MESSAGE' => $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' => $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' => $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'], |
@@ -17,32 +17,32 @@ discard block |
||
17 | 17 | try { |
18 | 18 | sn_db_transaction_start(); |
19 | 19 | |
20 | - if($buddy_id = sys_get_param_id('buddy_id')) { |
|
20 | + if ($buddy_id = sys_get_param_id('buddy_id')) { |
|
21 | 21 | $buddy_row = db_buddy_get_row($buddy_id); |
22 | - if(!is_array($buddy_row)) { |
|
22 | + if (!is_array($buddy_row)) { |
|
23 | 23 | throw new exception('buddy_err_not_exist', ERR_ERROR); |
24 | 24 | } |
25 | 25 | |
26 | - switch($mode = sys_get_param_str('mode')) { |
|
26 | + switch ($mode = sys_get_param_str('mode')) { |
|
27 | 27 | case 'accept': |
28 | - if($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
28 | + if ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
29 | 29 | throw new exception('buddy_err_accept_own', ERR_ERROR); |
30 | 30 | } |
31 | 31 | |
32 | - if($buddy_row['BUDDY_OWNER_ID'] != $user['id']) { |
|
32 | + if ($buddy_row['BUDDY_OWNER_ID'] != $user['id']) { |
|
33 | 33 | throw new exception('buddy_err_accept_alien', ERR_ERROR); |
34 | 34 | } |
35 | 35 | |
36 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
36 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
37 | 37 | throw new exception('buddy_err_accept_already', ERR_WARNING); |
38 | 38 | } |
39 | 39 | |
40 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) { |
|
40 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) { |
|
41 | 41 | throw new exception('buddy_err_accept_denied', ERR_ERROR); |
42 | 42 | } |
43 | 43 | |
44 | 44 | db_buddy_update_status($buddy_id, BUDDY_REQUEST_ACTIVE); |
45 | - if(classSupernova::$db->db_affected_rows()) { |
|
45 | + if (classSupernova::$db->db_affected_rows()) { |
|
46 | 46 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_accept_title'], |
47 | 47 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
48 | 48 | sn_db_transaction_commit(); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | break; |
54 | 54 | |
55 | 55 | case 'delete': |
56 | - if($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) { |
|
56 | + if ($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) { |
|
57 | 57 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
58 | 58 | } |
59 | 59 | |
60 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
60 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
61 | 61 | { |
62 | 62 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
63 | 63 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | db_buddy_delete($buddy_id); |
68 | 68 | sn_db_transaction_commit(); |
69 | 69 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
70 | - } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
70 | + } elseif ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
71 | 71 | { |
72 | 72 | db_buddy_delete($buddy_id); |
73 | 73 | sn_db_transaction_commit(); |
74 | 74 | throw new exception('buddy_err_delete_own', ERR_NONE); |
75 | - } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
75 | + } elseif ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
76 | 76 | { |
77 | 77 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
78 | 78 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
@@ -87,22 +87,22 @@ discard block |
||
87 | 87 | |
88 | 88 | // New request? |
89 | 89 | // Checking for user ID - in case if it was request from outside buddy system |
90 | - if($new_friend_id = sys_get_param_id('request_user_id')) { |
|
90 | + if ($new_friend_id = sys_get_param_id('request_user_id')) { |
|
91 | 91 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
92 | - } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) { |
|
92 | + } elseif ($new_friend_name = sys_get_param_str_unsafe('request_user_name')) { |
|
93 | 93 | $new_friend_row = db_user_by_username($new_friend_name, true, '`id`, `username`'); |
94 | 94 | $new_friend_name = db_escape($new_friend_name); |
95 | 95 | } |
96 | 96 | |
97 | - if($new_friend_row['id'] == $user['id']) { |
|
97 | + if ($new_friend_row['id'] == $user['id']) { |
|
98 | 98 | unset($new_friend_row); |
99 | 99 | throw new exception('buddy_err_adding_self', ERR_ERROR); |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Checking for user name & request text - in case if it was request to adding new request |
103 | - if(isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) { |
|
103 | + if (isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) { |
|
104 | 104 | $check_relation = db_buddy_check_relation($user, $new_friend_row); |
105 | - if(isset($check_relation['BUDDY_ID'])) { |
|
105 | + if (isset($check_relation['BUDDY_ID'])) { |
|
106 | 106 | throw new exception('buddy_err_adding_exists', ERR_WARNING); |
107 | 107 | } |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | sn_db_transaction_commit(); |
114 | 114 | throw new exception('buddy_err_adding_none', ERR_NONE); |
115 | 115 | } |
116 | -} catch(Exception $e) { |
|
116 | +} catch (Exception $e) { |
|
117 | 117 | $result[] = array( |
118 | 118 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
119 | 119 | 'MESSAGE' => $lang[$e->getMessage()], |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | sn_db_transaction_rollback(); |
124 | 124 | |
125 | 125 | $query = db_buddy_list_by_user($user['id']); |
126 | -while($row = db_fetch($query)) { |
|
126 | +while ($row = db_fetch($query)) { |
|
127 | 127 | $row['BUDDY_REQUEST'] = sys_bbcodeParse($row['BUDDY_REQUEST']); |
128 | 128 | |
129 | 129 | $row['BUDDY_ACTIVE'] = $row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | lng_include('announce'); |
20 | 20 | |
21 | -switch($action) { |
|
21 | +switch ($action) { |
|
22 | 22 | case 1://on veut poster une annonce |
23 | 23 | $page .= '<HTML> |
24 | 24 | <center> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $deutvendre = sys_get_param_float('deutvendre'); |
53 | 53 | $deutsouhait = sys_get_param_float('deutsouhait'); |
54 | 54 | |
55 | - if(($metalvendre != 0 && $metalsouhait == 0) || ($cristalvendre != 0 && $cristalsouhait == 0) || ($deutvendre != 0 && $deutsouhait == 0)) { |
|
55 | + if (($metalvendre != 0 && $metalsouhait == 0) || ($cristalvendre != 0 && $cristalsouhait == 0) || ($deutvendre != 0 && $deutsouhait == 0)) { |
|
56 | 56 | db_ANNONCE_insert_set($users, $metalvendre, $cristalvendre, $deutvendre, $metalsouhait, $cristalsouhait, $deutsouhait); |
57 | 57 | message($lang['Your_announce_was_recorded'], $lang['announce_status'], "annonce.php"); |
58 | 58 | } else { |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | <tr><th colspan=\"3\">{$lang['Infos_of_delivery']}</th><th colspan=\"3\">{$lang['Resources_to_be_sold']}</th><th colspan=\"3\">{$lang['Desired_resources']}</th><th>{$lang['Action']}</th></tr> |
75 | 75 | <tr><th>{$lang['Salesman']}</th><th>{$lang['Galaxy']}</th><th>{$lang['Solar_system']}</th><th>{$lang['metal']}</th><th>{$lang['crystal']}</th><th>{$lang['deuterium']}</th><th>{$lang['metal']}</th><th>{$lang['crystal']}</th><th>{$lang['deuterium']}</th><th>{$lang['Delete']}</th></tr>"; |
76 | 76 | |
77 | - while($b = db_fetch($annonce)) { |
|
77 | + while ($b = db_fetch($annonce)) { |
|
78 | 78 | $page2 .= '<tr><th>'; |
79 | - foreach($b as $name => $value) { |
|
80 | - if($name != 'id') { |
|
79 | + foreach ($b as $name => $value) { |
|
80 | + if ($name != 'id') { |
|
81 | 81 | $page2 .= $value; |
82 | 82 | $page2 .= '</th><th>'; |
83 | 83 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if($config->game_mode == GAME_BLITZ) { |
|
5 | +if ($config->game_mode == GAME_BLITZ) { |
|
6 | 6 | message($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10); |
7 | 7 | die(); |
8 | 8 | } |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | |
15 | 15 | $mode = sys_get_param_str('mode'); |
16 | 16 | |
17 | -if($mode == 'ainfo') { |
|
17 | +if ($mode == 'ainfo') { |
|
18 | 18 | include('includes/alliance/ali_info.inc'); |
19 | 19 | } |
20 | 20 | |
21 | -if(!$user['ally_id']) { |
|
21 | +if (!$user['ally_id']) { |
|
22 | 22 | $user_request = db_ally_request_get_by_user_id($user['id']); |
23 | - if($user_request['id_user']) { |
|
23 | + if ($user_request['id_user']) { |
|
24 | 24 | require('includes/alliance/ali_external_request.inc'); |
25 | 25 | } else { |
26 | - switch($mode) { |
|
26 | + switch ($mode) { |
|
27 | 27 | case 'search': |
28 | 28 | require('includes/alliance/ali_external_search.inc'); |
29 | 29 | break; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | sn_ali_fill_user_ally($user); |
47 | -if(!isset($user['ally'])) { |
|
47 | +if (!isset($user['ally'])) { |
|
48 | 48 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
49 | 49 | message($lang['ali_sys_notFound'], $lang['your_alliance'], 'alliance.php'); |
50 | 50 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | |
73 | 73 | // This piece converting old ally data to new one |
74 | 74 | // unset($ally['ranklist']); |
75 | -if(!$ally['ranklist'] && $ally['ally_ranks']) { |
|
75 | +if (!$ally['ranklist'] && $ally['ally_ranks']) { |
|
76 | 76 | $ally_ranks = unserialize($ally['ally_ranks']); |
77 | 77 | $i = 0; |
78 | - foreach($ally_ranks as $rank_id => $rank) { |
|
79 | - foreach($ally_rights as $key => $value) { |
|
78 | + foreach ($ally_ranks as $rank_id => $rank) { |
|
79 | + foreach ($ally_rights as $key => $value) { |
|
80 | 80 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
81 | 81 | } |
82 | 82 | db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
83 | 83 | $i++; |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($ranks)) { |
|
86 | + if (!empty($ranks)) { |
|
87 | 87 | ali_rank_list_save($ranks); |
88 | 88 | } |
89 | 89 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | |
102 | 102 | $edit = sys_get_param_str('edit'); |
103 | 103 | ally_pre_call(); |
104 | -switch($mode) { |
|
104 | +switch ($mode) { |
|
105 | 105 | case 'admin': |
106 | - if(!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
106 | + if (!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
107 | 107 | $edit = 'default'; |
108 | 108 | } |
109 | - if($sn_ali_admin_internal[$edit]['include']) { |
|
109 | + if ($sn_ali_admin_internal[$edit]['include']) { |
|
110 | 110 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
111 | 111 | } |
112 | - if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
112 | + if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
113 | 113 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
114 | 114 | } |
115 | 115 | break; |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | |
5 | 5 | global $debug, $lang, $user, $planetrow; |
6 | 6 | |
7 | -if(!empty($_POST['return']) && is_array($_POST['return'])) { |
|
8 | - foreach($_POST['return'] as $fleet_id) { |
|
9 | - if($fleet_id = idval($fleet_id)) { |
|
7 | +if (!empty($_POST['return']) && is_array($_POST['return'])) { |
|
8 | + foreach ($_POST['return'] as $fleet_id) { |
|
9 | + if ($fleet_id = idval($fleet_id)) { |
|
10 | 10 | sn_db_transaction_start(); |
11 | 11 | $objFleet = new Fleet(); |
12 | 12 | $objFleet->dbLoad($fleet_id); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | lng_include('overview'); |
31 | 31 | lng_include('fleet'); |
32 | 32 | |
33 | -if(!$planetrow) { |
|
33 | +if (!$planetrow) { |
|
34 | 34 | message($lang['fl_noplanetrow'], $lang['fl_error']); |
35 | 35 | } |
36 | 36 | |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | $i = 0; |
40 | 40 | $objFleetList = FleetList::dbGetFleetListByOwnerId($user['id']); |
41 | -if(!empty($objFleetList)) { |
|
42 | - foreach($objFleetList->_container as $fleet_id => $objFleet) { |
|
41 | +if (!empty($objFleetList)) { |
|
42 | + foreach ($objFleetList->_container as $fleet_id => $objFleet) { |
|
43 | 43 | $i++; |
44 | 44 | $fleet_data = tplParseFleetObject($objFleet, $i, $user); |
45 | 45 | |
46 | 46 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
47 | 47 | |
48 | - foreach($fleet_data['ships'] as $ship_data) { |
|
48 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
49 | 49 | $template->assign_block_vars('fleets.ships', $ship_data); |
50 | 50 | } |
51 | 51 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage($lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
31 | -foreach($sn_message_class_list as $key => $value) { |
|
32 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
31 | +foreach ($sn_message_class_list as $key => $value) { |
|
32 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) { |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | $message_delete = sys_get_param_id('msg_del'); |
44 | -if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
44 | +if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) { |
|
45 | 45 | $message_delete = implode(', ', $message_delete); |
46 | 46 | } |
47 | 47 | |
48 | -if($message_delete) { |
|
48 | +if ($message_delete) { |
|
49 | 49 | db_message_list_delete_set($message_delete); |
50 | 50 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete))); |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
54 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) { |
|
55 | 55 | $delete_date = "{$year}-{$month}-{$day}"; |
56 | 56 | db_message_list_delete_by_date($delete_date, $int_type_selected); |
57 | 57 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date))); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
65 | 65 | |
66 | -if(sys_get_param('page_prev') && $int_page_current > 1) { |
|
66 | +if (sys_get_param('page_prev') && $int_page_current > 1) { |
|
67 | 67 | $int_page_current--; |
68 | -} elseif(sys_get_param('page_next') && $int_page_current < $page_max) { |
|
68 | +} elseif (sys_get_param('page_next') && $int_page_current < $page_max) { |
|
69 | 69 | $int_page_current++; |
70 | 70 | } |
71 | 71 | |
72 | -for($i = 1; $i <= $page_max; $i++) { |
|
72 | +for ($i = 1; $i <= $page_max; $i++) { |
|
73 | 73 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $StartRec = ($int_page_current - 1) * 25; |
78 | 78 | |
79 | 79 | $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec); |
80 | -while($row = db_fetch($Messages)) { |
|
80 | +while ($row = db_fetch($Messages)) { |
|
81 | 81 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
82 | 82 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
83 | 83 | $row['TEXT'] = nl2br($row['TEXT']); |