@@ -22,19 +22,19 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | switch($mode) |
| 24 | 24 | { |
| 25 | - case SNC_MODE_REGISTER: |
|
| 26 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) |
|
| 27 | - { |
|
| 28 | - if($ajax) |
|
| 25 | + case SNC_MODE_REGISTER: |
|
| 26 | + if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) |
|
| 29 | 27 | { |
| 30 | - print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
| 28 | + if($ajax) |
|
| 29 | + { |
|
| 30 | + print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
| 31 | + } |
|
| 32 | + die(); |
|
| 31 | 33 | } |
| 32 | - die(); |
|
| 33 | - } |
|
| 34 | - $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
| 35 | -//TODO REMOVE DEBUG!!! |
|
| 36 | -//$url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode('http://supernova.ws/'); |
|
| 37 | - break; |
|
| 34 | + $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
| 35 | + //TODO REMOVE DEBUG!!! |
|
| 36 | + //$url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode('http://supernova.ws/'); |
|
| 37 | + break; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $check_result = sn_get_url_contents($url); |
@@ -48,112 +48,112 @@ 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 | 67 | |
| 68 | - if($recipient_row) { |
|
| 69 | - $recipient_id = $recipient_row['id']; |
|
| 70 | - $recipient_name = $recipient_row['username']; |
|
| 71 | - } |
|
| 68 | + if($recipient_row) { |
|
| 69 | + $recipient_id = $recipient_row['id']; |
|
| 70 | + $recipient_name = $recipient_row['username']; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if($recipient_id == $user['id']) { |
|
| 74 | - $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
| 75 | - } |
|
| 73 | + if($recipient_id == $user['id']) { |
|
| 74 | + $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $re = 0; |
|
| 78 | - $subject = sys_get_param_str('subject'); |
|
| 79 | - while(strpos($subject, $lang['msg_answer_prefix']) !== false) { |
|
| 80 | - $subject = substr($subject, strlen($lang['msg_answer_prefix'])); |
|
| 81 | - $re++; |
|
| 82 | - } |
|
| 83 | - $re ? $subject = $lang['msg_answer_prefix'] . $subject : false; |
|
| 77 | + $re = 0; |
|
| 78 | + $subject = sys_get_param_str('subject'); |
|
| 79 | + while(strpos($subject, $lang['msg_answer_prefix']) !== false) { |
|
| 80 | + $subject = substr($subject, strlen($lang['msg_answer_prefix'])); |
|
| 81 | + $re++; |
|
| 82 | + } |
|
| 83 | + $re ? $subject = $lang['msg_answer_prefix'] . $subject : false; |
|
| 84 | 84 | |
| 85 | - if(sys_get_param_str('msg_send')) { |
|
| 86 | - $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
| 85 | + if(sys_get_param_str('msg_send')) { |
|
| 86 | + $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
| 87 | 87 | |
| 88 | - if(!$recipient_id) { |
|
| 89 | - $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
| 90 | - } |
|
| 88 | + if(!$recipient_id) { |
|
| 89 | + $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - $text = sys_get_param_str('text'); |
|
| 93 | - if(!$text) { |
|
| 94 | - $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
| 95 | - } |
|
| 92 | + $text = sys_get_param_str('text'); |
|
| 93 | + if(!$text) { |
|
| 94 | + $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - if(empty($error_list)) { |
|
| 98 | - $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
| 97 | + if(empty($error_list)) { |
|
| 98 | + $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
| 99 | 99 | |
| 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); |
|
| 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); |
|
| 103 | 103 | |
| 104 | - //$recipient_id = 0; |
|
| 105 | - //$recipient_name = ''; |
|
| 106 | - //$subject = ''; |
|
| 107 | - $text = ''; |
|
| 104 | + //$recipient_id = 0; |
|
| 105 | + //$recipient_name = ''; |
|
| 106 | + //$subject = ''; |
|
| 107 | + $text = ''; |
|
| 108 | 108 | |
| 109 | - $msg_sent = true; |
|
| 110 | - } else { |
|
| 111 | - $subject = sys_get_param_str_unsafe('subject'); |
|
| 112 | - $text = sys_get_param_str_unsafe('text'); |
|
| 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'); |
|
| 113 | 115 | } |
| 114 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
| 115 | - } |
|
| 116 | 116 | |
| 117 | - $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
| 117 | + $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
| 118 | 118 | |
| 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 | - )); |
|
| 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 | + )); |
|
| 125 | 125 | |
| 126 | - foreach($error_list as $error_message) { |
|
| 127 | - $template->assign_block_vars('result', $error_message); |
|
| 128 | - } |
|
| 126 | + foreach($error_list as $error_message) { |
|
| 127 | + $template->assign_block_vars('result', $error_message); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - $message_query = doquery( |
|
| 131 | - "SELECT * FROM {{messages}} |
|
| 130 | + $message_query = doquery( |
|
| 131 | + "SELECT * FROM {{messages}} |
|
| 132 | 132 | WHERE |
| 133 | 133 | `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
| 134 | 134 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
| 135 | 135 | OR |
| 136 | 136 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
| 137 | - while ($message_row = db_fetch($message_query)) { |
|
| 138 | - $template->assign_block_vars('messages', array( |
|
| 139 | - 'ID' => $message_row['message_id'], |
|
| 140 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 141 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 142 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 143 | - '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']), |
|
| 144 | - |
|
| 145 | - 'FROM_ID' => $message_row['message_sender'], |
|
| 146 | - )); |
|
| 147 | - } |
|
| 137 | + while ($message_row = db_fetch($message_query)) { |
|
| 138 | + $template->assign_block_vars('messages', array( |
|
| 139 | + 'ID' => $message_row['message_id'], |
|
| 140 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 141 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 142 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 143 | + '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']), |
|
| 144 | + |
|
| 145 | + 'FROM_ID' => $message_row['message_sender'], |
|
| 146 | + )); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - break; |
|
| 149 | + break; |
|
| 150 | 150 | |
| 151 | - case 'delete': |
|
| 152 | - $query_add = ''; |
|
| 151 | + case 'delete': |
|
| 152 | + $query_add = ''; |
|
| 153 | 153 | |
| 154 | - $message_range = sys_get_param_str('message_range'); |
|
| 154 | + $message_range = sys_get_param_str('message_range'); |
|
| 155 | 155 | |
| 156 | - switch($message_range) { |
|
| 156 | + switch($message_range) { |
|
| 157 | 157 | case 'unchecked': |
| 158 | 158 | case 'checked': |
| 159 | 159 | $marked_message_list = sys_get_param('mark', array()); |
@@ -177,65 +177,65 @@ discard block |
||
| 177 | 177 | case 'all': |
| 178 | 178 | $query_add = $query_add ? $query_add : true; |
| 179 | 179 | break; |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | if($query_add) { |
| 183 | 183 | $query_add = $query_add === true ? '' : $query_add; |
| 184 | 184 | doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '{$user['id']}'{$query_add};"); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - case 'show': |
|
| 188 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
| 189 | - $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
| 190 | - } else { |
|
| 191 | - if ($current_class == MSG_TYPE_NEW) { |
|
| 192 | - $SubUpdateQry = array(); |
|
| 193 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
| 194 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
| 195 | - $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
| 196 | - $user[$message_class['name']] = 0; |
|
| 187 | + case 'show': |
|
| 188 | + if($current_class == MSG_TYPE_OUTBOX) { |
|
| 189 | + $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
| 190 | + } else { |
|
| 191 | + if ($current_class == MSG_TYPE_NEW) { |
|
| 192 | + $SubUpdateQry = array(); |
|
| 193 | + foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
| 194 | + if($message_class_id != MSG_TYPE_OUTBOX) { |
|
| 195 | + $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
| 196 | + $user[$message_class['name']] = 0; |
|
| 197 | + } |
|
| 197 | 198 | } |
| 199 | + $SubUpdateQry = implode(',', $SubUpdateQry); |
|
| 200 | + } else { |
|
| 201 | + $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']]}'"; |
|
| 202 | + $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
| 203 | + |
|
| 204 | + $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
| 205 | + $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
| 198 | 206 | } |
| 199 | - $SubUpdateQry = implode(',', $SubUpdateQry); |
|
| 200 | - } else { |
|
| 201 | - $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']]}'"; |
|
| 202 | - $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
| 203 | 207 | |
| 204 | - $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
| 205 | - $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
| 208 | + db_user_set_by_id($user['id'], $SubUpdateQry); |
|
| 209 | + $message_query = "SELECT * FROM {{messages}} WHERE `message_owner` = '{$user['id']}' {$SubSelectQry} ORDER BY `message_time` DESC;"; |
|
| 210 | + $message_query = doquery($message_query); |
|
| 206 | 211 | } |
| 207 | 212 | |
| 208 | - db_user_set_by_id($user['id'], $SubUpdateQry); |
|
| 209 | - $message_query = "SELECT * FROM {{messages}} WHERE `message_owner` = '{$user['id']}' {$SubSelectQry} ORDER BY `message_time` DESC;"; |
|
| 210 | - $message_query = doquery($message_query); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - if(sys_get_param_int('return')) { |
|
| 214 | - sys_redirect('messages.php'); |
|
| 215 | - } |
|
| 213 | + if(sys_get_param_int('return')) { |
|
| 214 | + sys_redirect('messages.php'); |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - $template = gettemplate('msg_message_list', true); |
|
| 218 | - while ($message_row = db_fetch($message_query)) { |
|
| 219 | - $template->assign_block_vars('messages', array( |
|
| 220 | - 'ID' => $message_row['message_id'], |
|
| 221 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 222 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 223 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 224 | - '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']), |
|
| 225 | - |
|
| 226 | - 'FROM_ID' => $message_row['message_sender'], |
|
| 227 | - 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
| 228 | - 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
| 229 | - )); |
|
| 230 | - } |
|
| 217 | + $template = gettemplate('msg_message_list', true); |
|
| 218 | + while ($message_row = db_fetch($message_query)) { |
|
| 219 | + $template->assign_block_vars('messages', array( |
|
| 220 | + 'ID' => $message_row['message_id'], |
|
| 221 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 222 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 223 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 224 | + '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']), |
|
| 225 | + |
|
| 226 | + 'FROM_ID' => $message_row['message_sender'], |
|
| 227 | + 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
| 228 | + 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
| 229 | + )); |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - $current_class_text = $lang['msg_class'][$current_class]; |
|
| 232 | + $current_class_text = $lang['msg_class'][$current_class]; |
|
| 233 | 233 | |
| 234 | - $template->assign_vars(array( |
|
| 235 | - "MESSAGE_CLASS" => $current_class, |
|
| 236 | - "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
| 237 | - )); |
|
| 238 | - break; |
|
| 234 | + $template->assign_vars(array( |
|
| 235 | + "MESSAGE_CLASS" => $current_class, |
|
| 236 | + "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
| 237 | + )); |
|
| 238 | + break; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if(!$template) { |
@@ -73,121 +73,121 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | switch ($fleet_page) { |
| 76 | - case 3: |
|
| 76 | + case 3: |
|
| 77 | 77 | |
| 78 | - case 2: |
|
| 79 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 80 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 81 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
| 78 | + case 2: |
|
| 79 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 80 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 81 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
| 82 | 82 | |
| 83 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
| 84 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 85 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 86 | - die(); |
|
| 87 | - } |
|
| 88 | - $ship_amount = floatval($ship_amount); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $UsedPlanet = false; |
|
| 92 | - $YourPlanet = false; |
|
| 93 | - $missiontype = array(); |
|
| 94 | - if ($planet > classSupernova::$config->game_maxPlanet) { |
|
| 95 | - $target_mission = MT_EXPLORE; |
|
| 96 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 97 | - } elseif ($galaxy && $system && $planet) { |
|
| 98 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 99 | - |
|
| 100 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 101 | - |
|
| 102 | - if ($TargetPlanet['id_owner']) { |
|
| 103 | - $UsedPlanet = true; |
|
| 104 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 105 | - $YourPlanet = true; |
|
| 83 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
| 84 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 85 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 86 | + die(); |
|
| 106 | 87 | } |
| 88 | + $ship_amount = floatval($ship_amount); |
|
| 107 | 89 | } |
| 108 | 90 | |
| 109 | - if (!$UsedPlanet) { |
|
| 110 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
| 111 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 112 | - $target_mission = MT_COLONIZE; |
|
| 113 | - $planet_type = PT_PLANET; |
|
| 114 | - } else { |
|
| 115 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
| 116 | - } |
|
| 117 | - } else { |
|
| 118 | - $recyclers = 0; |
|
| 119 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 120 | - $recyclers += $fleetarray[$recycler_id]; |
|
| 91 | + $UsedPlanet = false; |
|
| 92 | + $YourPlanet = false; |
|
| 93 | + $missiontype = array(); |
|
| 94 | + if ($planet > classSupernova::$config->game_maxPlanet) { |
|
| 95 | + $target_mission = MT_EXPLORE; |
|
| 96 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 97 | + } elseif ($galaxy && $system && $planet) { |
|
| 98 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 99 | + |
|
| 100 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 101 | + |
|
| 102 | + if ($TargetPlanet['id_owner']) { |
|
| 103 | + $UsedPlanet = true; |
|
| 104 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 105 | + $YourPlanet = true; |
|
| 106 | + } |
|
| 121 | 107 | } |
| 122 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 123 | - $target_mission = MT_RECYCLE; |
|
| 124 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 125 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 126 | - if ($YourPlanet) { |
|
| 127 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 128 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 108 | + |
|
| 109 | + if (!$UsedPlanet) { |
|
| 110 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
| 111 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 112 | + $target_mission = MT_COLONIZE; |
|
| 113 | + $planet_type = PT_PLANET; |
|
| 129 | 114 | } else { |
| 130 | - // Not Your Planet |
|
| 131 | - if ($fleetarray[SHIP_SPY]) { |
|
| 132 | - // Only spy missions if any spy |
|
| 133 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 115 | + messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
| 116 | + } |
|
| 117 | + } else { |
|
| 118 | + $recyclers = 0; |
|
| 119 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 120 | + $recyclers += $fleetarray[$recycler_id]; |
|
| 121 | + } |
|
| 122 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 123 | + $target_mission = MT_RECYCLE; |
|
| 124 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 125 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 126 | + if ($YourPlanet) { |
|
| 127 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 128 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 134 | 129 | } else { |
| 135 | - // If no spies... |
|
| 136 | - if ($fleet_group_mr) { |
|
| 137 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 130 | + // Not Your Planet |
|
| 131 | + if ($fleetarray[SHIP_SPY]) { |
|
| 132 | + // Only spy missions if any spy |
|
| 133 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 138 | 134 | } else { |
| 139 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 140 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 141 | - |
|
| 142 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 143 | - |
|
| 144 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 145 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 135 | + // If no spies... |
|
| 136 | + if ($fleet_group_mr) { |
|
| 137 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 138 | + } else { |
|
| 139 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 140 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 141 | + |
|
| 142 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 143 | + |
|
| 144 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 145 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 146 | + } |
|
| 146 | 147 | } |
| 147 | 148 | } |
| 148 | 149 | } |
| 149 | 150 | } |
| 150 | 151 | } |
| 151 | 152 | } |
| 152 | - } |
|
| 153 | - |
|
| 154 | - if (!$target_mission && is_array($missiontype)) { |
|
| 155 | - $target_mission = MT_ATTACK; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | -// $sn_group_missions = sn_get_groups('missions'); |
|
| 159 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
| 160 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 161 | -// } |
|
| 162 | -// |
|
| 163 | -// |
|
| 164 | - ksort($missiontype); |
|
| 165 | - |
|
| 166 | - $speed_percent = sys_get_param_int('speed', 10); |
|
| 167 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 168 | - |
|
| 169 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 170 | - $fleet_speed = $travel_data['fleet_speed']; |
|
| 171 | - $distance = $travel_data['distance']; |
|
| 172 | - $duration = $travel_data['duration']; |
|
| 173 | - $consumption = $travel_data['consumption']; |
|
| 174 | - // No Break |
|
| 175 | - |
|
| 176 | - case 1: |
|
| 177 | - if ($galaxy && $system && $planet) { |
|
| 178 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 179 | - |
|
| 180 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - case 0: |
|
| 184 | - $template_result += array( |
|
| 185 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
| 186 | - 'thissystem' => $planetrow['system'], |
|
| 187 | - 'thisplanet' => $planetrow['planet'], |
|
| 188 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
| 189 | - ); |
|
| 190 | - // no break |
|
| 153 | + |
|
| 154 | + if (!$target_mission && is_array($missiontype)) { |
|
| 155 | + $target_mission = MT_ATTACK; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + // $sn_group_missions = sn_get_groups('missions'); |
|
| 159 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
| 160 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 161 | + // } |
|
| 162 | + // |
|
| 163 | + // |
|
| 164 | + ksort($missiontype); |
|
| 165 | + |
|
| 166 | + $speed_percent = sys_get_param_int('speed', 10); |
|
| 167 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 168 | + |
|
| 169 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 170 | + $fleet_speed = $travel_data['fleet_speed']; |
|
| 171 | + $distance = $travel_data['distance']; |
|
| 172 | + $duration = $travel_data['duration']; |
|
| 173 | + $consumption = $travel_data['consumption']; |
|
| 174 | + // No Break |
|
| 175 | + |
|
| 176 | + case 1: |
|
| 177 | + if ($galaxy && $system && $planet) { |
|
| 178 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 179 | + |
|
| 180 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + case 0: |
|
| 184 | + $template_result += array( |
|
| 185 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
| 186 | + 'thissystem' => $planetrow['system'], |
|
| 187 | + 'thisplanet' => $planetrow['planet'], |
|
| 188 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
| 189 | + ); |
|
| 190 | + // no break |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -209,31 +209,31 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | switch($fleet_page) { |
| 212 | - case 1: |
|
| 213 | - require('includes/includes/flt_page1.inc'); |
|
| 214 | - break; |
|
| 212 | + case 1: |
|
| 213 | + require('includes/includes/flt_page1.inc'); |
|
| 214 | + break; |
|
| 215 | 215 | |
| 216 | - case 2: |
|
| 217 | - require_once('includes/includes/flt_page2.inc'); |
|
| 218 | - sn_fleet_page2(); |
|
| 219 | - break; |
|
| 216 | + case 2: |
|
| 217 | + require_once('includes/includes/flt_page2.inc'); |
|
| 218 | + sn_fleet_page2(); |
|
| 219 | + break; |
|
| 220 | 220 | |
| 221 | - case 3: |
|
| 222 | - require_once('includes/includes/flt_page3.inc'); |
|
| 223 | - sn_fleet_page3(); |
|
| 224 | - break; |
|
| 221 | + case 3: |
|
| 222 | + require_once('includes/includes/flt_page3.inc'); |
|
| 223 | + sn_fleet_page3(); |
|
| 224 | + break; |
|
| 225 | 225 | |
| 226 | - case 4: |
|
| 227 | - require('includes/includes/flt_page4.inc'); |
|
| 228 | - break; |
|
| 226 | + case 4: |
|
| 227 | + require('includes/includes/flt_page4.inc'); |
|
| 228 | + break; |
|
| 229 | 229 | |
| 230 | - case 5: |
|
| 231 | - require('includes/includes/flt_page5.inc'); |
|
| 232 | - break; |
|
| 230 | + case 5: |
|
| 231 | + require('includes/includes/flt_page5.inc'); |
|
| 232 | + break; |
|
| 233 | 233 | |
| 234 | - default: |
|
| 235 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 234 | + default: |
|
| 235 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 236 | 236 | |
| 237 | - require('includes/includes/flt_page0.inc'); |
|
| 238 | - break; |
|
| 237 | + require('includes/includes/flt_page0.inc'); |
|
| 238 | + break; |
|
| 239 | 239 | } |