@@ -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) { |
@@ -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 | } |