@@ -24,11 +24,11 @@ |
||
24 | 24 | |
25 | 25 | // require_once('includes/includes/scheduler_process.php'); |
26 | 26 | |
27 | -if(($result = scheduler_process()) && !defined('IN_ADMIN')) { |
|
27 | +if (($result = scheduler_process()) && !defined('IN_ADMIN')) { |
|
28 | 28 | $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8'); |
29 | 29 | print(json_encode($result)); |
30 | 30 | } |
31 | 31 | |
32 | -if(!defined('IN_ADMIN')) { |
|
32 | +if (!defined('IN_ADMIN')) { |
|
33 | 33 | die(); |
34 | 34 | } |
@@ -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,66 +177,66 @@ 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 | - header('Location: messages.php'); |
|
215 | - die(); |
|
216 | - } |
|
213 | + if(sys_get_param_int('return')) { |
|
214 | + header('Location: messages.php'); |
|
215 | + die(); |
|
216 | + } |
|
217 | 217 | |
218 | - $template = gettemplate('msg_message_list', true); |
|
219 | - while ($message_row = db_fetch($message_query)) { |
|
220 | - $template->assign_block_vars('messages', array( |
|
221 | - 'ID' => $message_row['message_id'], |
|
222 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
223 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
224 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
225 | - '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']), |
|
226 | - |
|
227 | - 'FROM_ID' => $message_row['message_sender'], |
|
228 | - 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
229 | - 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
230 | - )); |
|
231 | - } |
|
218 | + $template = gettemplate('msg_message_list', true); |
|
219 | + while ($message_row = db_fetch($message_query)) { |
|
220 | + $template->assign_block_vars('messages', array( |
|
221 | + 'ID' => $message_row['message_id'], |
|
222 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
223 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
224 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
225 | + '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']), |
|
226 | + |
|
227 | + 'FROM_ID' => $message_row['message_sender'], |
|
228 | + 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
229 | + 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
230 | + )); |
|
231 | + } |
|
232 | 232 | |
233 | - $current_class_text = $lang['msg_class'][$current_class]; |
|
233 | + $current_class_text = $lang['msg_class'][$current_class]; |
|
234 | 234 | |
235 | - $template->assign_vars(array( |
|
236 | - "MESSAGE_CLASS" => $current_class, |
|
237 | - "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
238 | - )); |
|
239 | - break; |
|
235 | + $template->assign_vars(array( |
|
236 | + "MESSAGE_CLASS" => $current_class, |
|
237 | + "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
238 | + )); |
|
239 | + break; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | if(!$template) { |
@@ -42,7 +42,7 @@ 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 | } |
@@ -53,48 +53,48 @@ discard block |
||
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']); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | //$recipient_id = 0; |
105 | 105 | //$recipient_name = ''; |
106 | 106 | //$subject = ''; |
107 | - $text = ''; |
|
107 | + $text = ''; |
|
108 | 108 | |
109 | 109 | $msg_sent = true; |
110 | 110 | } else { |
@@ -123,7 +123,7 @@ 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 | |
@@ -153,25 +153,25 @@ discard block |
||
153 | 153 | |
154 | 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()); |
160 | - if($message_range == 'checked' && empty($marked_message_list)) { |
|
160 | + if ($message_range == 'checked' && empty($marked_message_list)) { |
|
161 | 161 | break; |
162 | 162 | } |
163 | 163 | |
164 | 164 | $query_add = implode(',', $marked_message_list); |
165 | - if($query_add) { |
|
165 | + if ($query_add) { |
|
166 | 166 | $query_add = "IN ({$query_add})"; |
167 | - if($message_range == 'unchecked') { |
|
167 | + if ($message_range == 'unchecked') { |
|
168 | 168 | $query_add = "NOT {$query_add}"; |
169 | 169 | } |
170 | 170 | $query_add = " AND `message_id` {$query_add}"; |
171 | 171 | } |
172 | 172 | |
173 | 173 | case 'class': |
174 | - if($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) { |
|
174 | + if ($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) { |
|
175 | 175 | $query_add .= " AND `message_type` = {$current_class}"; |
176 | 176 | } |
177 | 177 | case 'all': |
@@ -179,19 +179,19 @@ discard block |
||
179 | 179 | break; |
180 | 180 | } |
181 | 181 | |
182 | - if($query_add) { |
|
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 | 187 | case 'show': |
188 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
188 | + if ($current_class == MSG_TYPE_OUTBOX) { |
|
189 | 189 | $message_query = db_message_list_outbox_by_user_id($user['id']); |
190 | 190 | } else { |
191 | 191 | if ($current_class == MSG_TYPE_NEW) { |
192 | 192 | $SubUpdateQry = array(); |
193 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
194 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
193 | + foreach ($sn_message_class_list as $message_class_id => $message_class) { |
|
194 | + if ($message_class_id != MSG_TYPE_OUTBOX) { |
|
195 | 195 | $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
196 | 196 | $user[$message_class['name']] = 0; |
197 | 197 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $message_query = doquery($message_query); |
211 | 211 | } |
212 | 212 | |
213 | - if(sys_get_param_int('return')) { |
|
213 | + if (sys_get_param_int('return')) { |
|
214 | 214 | header('Location: messages.php'); |
215 | 215 | die(); |
216 | 216 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | break; |
240 | 240 | } |
241 | 241 | |
242 | -if(!$template) { |
|
242 | +if (!$template) { |
|
243 | 243 | $template = gettemplate('msg_message_class', true); |
244 | 244 | |
245 | 245 | $query = doquery("SELECT message_owner, message_type, COUNT(message_owner) AS message_count FROM {{messages}} WHERE `message_owner` = {$user['id']} GROUP BY message_owner, message_type ORDER BY message_owner ASC, message_type;"); |
246 | - while($message_row = db_fetch($query)) { |
|
246 | + while ($message_row = db_fetch($query)) { |
|
247 | 247 | $messages_total[$message_row['message_type']] = $message_row['message_count']; |
248 | 248 | $messages_total[MSG_TYPE_NEW] += $message_row['message_count']; |
249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $query = doquery("SELECT COUNT(message_sender) AS message_count FROM {{messages}} WHERE `message_sender` = '{$user['id']}' AND message_type = 1 GROUP BY message_sender;", '', true); |
252 | 252 | $messages_total[MSG_TYPE_OUTBOX] = intval($query['message_count']); |
253 | 253 | |
254 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
254 | + foreach ($sn_message_class_list as $message_class_id => $message_class) { |
|
255 | 255 | $template->assign_block_vars('message_class', array( |
256 | 256 | 'ID' => $message_class_id, |
257 | 257 | 'STYLE' => $message_class['name'], |
@@ -165,7 +165,7 @@ |
||
165 | 165 | if($query_add) { |
166 | 166 | $query_add = "IN ({$query_add})"; |
167 | 167 | if($message_range == 'unchecked') { |
168 | - $query_add = "NOT {$query_add}"; |
|
168 | + $query_add = "not {$query_add}"; |
|
169 | 169 | } |
170 | 170 | $query_add = " AND `message_id` {$query_add}"; |
171 | 171 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function geometry_progression_sum($n, $b1, $q) { |
4 | - return $q != 1 ? ($b1 * (pow($q, $n) - 1)/($q - 1)) : ($n * $b1); |
|
4 | + return $q != 1 ? ($b1 * (pow($q, $n) - 1) / ($q - 1)) : ($n * $b1); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | function sn_floor($value) |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return float|int |
45 | 45 | */ |
46 | -function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) { |
|
47 | - if($cut_extreme) { |
|
46 | +function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) { |
|
47 | + if ($cut_extreme) { |
|
48 | 48 | $range_start--; |
49 | 49 | $range_end++; |
50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $args = func_get_args(); |
62 | 62 | |
63 | - switch(func_num_args()) |
|
63 | + switch (func_num_args()) |
|
64 | 64 | { |
65 | 65 | case 0: |
66 | 66 | // trigger_error('median() requires at least one parameter',E_USER_WARNING); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // fallthrough |
73 | 73 | |
74 | 74 | default: |
75 | - if(!is_array($args)) |
|
75 | + if (!is_array($args)) |
|
76 | 76 | { |
77 | 77 | // trigger_error('median() requires a list of numbers to operate on or an array of numbers', E_USER_NOTICE); |
78 | 78 | return false; |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $n = count($args); |
84 | 84 | $h = intval($n / 2); |
85 | 85 | |
86 | - if($n % 2 == 0) |
|
86 | + if ($n % 2 == 0) |
|
87 | 87 | { |
88 | - $median = ($args[$h] + $args[$h-1]) / 2; |
|
88 | + $median = ($args[$h] + $args[$h - 1]) / 2; |
|
89 | 89 | } |
90 | 90 | else |
91 | 91 | { |
@@ -103,47 +103,47 @@ discard block |
||
103 | 103 | } |
104 | 104 | function linear_calc(&$linear, $from = 0, $debug = false) |
105 | 105 | { |
106 | - for($i = $from; $i < count($linear); $i++) |
|
106 | + for ($i = $from; $i < count($linear); $i++) |
|
107 | 107 | { |
108 | 108 | $eq = &$linear[$i]; |
109 | - for($j = count($eq) - 1; $j >= $from; $j--) |
|
109 | + for ($j = count($eq) - 1; $j >= $from; $j--) |
|
110 | 110 | { |
111 | 111 | $eq[$j] /= $eq[$from]; |
112 | 112 | } |
113 | 113 | } |
114 | - if($debug) pdump($linear, 'Нормализовано по х' . $from); |
|
114 | + if ($debug) pdump($linear, 'Нормализовано по х' . $from); |
|
115 | 115 | |
116 | - for($i = $from + 1; $i < count($linear); $i++) |
|
116 | + for ($i = $from + 1; $i < count($linear); $i++) |
|
117 | 117 | { |
118 | 118 | $eq = &$linear[$i]; |
119 | - for($j = count($eq) - 1; $j >= $from; $j--) |
|
119 | + for ($j = count($eq) - 1; $j >= $from; $j--) |
|
120 | 120 | { |
121 | 121 | $eq[$j] -= $linear[$from][$j]; |
122 | 122 | } |
123 | 123 | } |
124 | - if($debug) pdump($linear, 'Подставили х' . $from); |
|
124 | + if ($debug) pdump($linear, 'Подставили х' . $from); |
|
125 | 125 | |
126 | - if($from < count($linear) - 1) |
|
126 | + if ($from < count($linear) - 1) |
|
127 | 127 | { |
128 | 128 | linear_calc($linear, $from + 1, $debug); |
129 | 129 | } |
130 | 130 | |
131 | - if($from) |
|
131 | + if ($from) |
|
132 | 132 | { |
133 | - for($i = 0; $i < $from; $i++) |
|
133 | + for ($i = 0; $i < $from; $i++) |
|
134 | 134 | { |
135 | 135 | $eq = &$linear[$i]; |
136 | - for($j = count($eq) - 1; $j >= $from; $j--) |
|
136 | + for ($j = count($eq) - 1; $j >= $from; $j--) |
|
137 | 137 | { |
138 | 138 | $eq[$j] = $eq[$j] - $eq[$from] * $linear[$from][$j]; |
139 | 139 | } |
140 | 140 | } |
141 | - if($debug) pdump($linear, 'Подставили обратно х' . $from); |
|
141 | + if ($debug) pdump($linear, 'Подставили обратно х' . $from); |
|
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
145 | - if($debug) pdump($linear, 'Результат' . $from); |
|
146 | - foreach($linear as $index => &$eq) |
|
145 | + if ($debug) pdump($linear, 'Результат' . $from); |
|
146 | + foreach ($linear as $index => &$eq) |
|
147 | 147 | { |
148 | 148 | pdump($eq[count($linear)], 'x' . $index); |
149 | 149 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | /** |
38 | 38 | * @param float $range_start - Начало диапазона |
39 | 39 | * @param float $range_end - Конец диапазона |
40 | - * @param bool|int $round - До скольки знаков округлять результат. False - не округлять, True - округлять до целого, 1 - округлять до десятков, 2 - до сотен итд |
|
40 | + * @param boolean $round - До скольки знаков округлять результат. False - не округлять, True - округлять до целого, 1 - округлять до десятков, 2 - до сотен итд |
|
41 | 41 | * @param int $strict - В сколько сигм надо уложить результат |
42 | 42 | * @param bool|false $cut_extreme - надо ли обрезать крайние значения. Например, при $strict = 2 их слишком много |
43 | 43 | * |
@@ -4,16 +4,14 @@ discard block |
||
4 | 4 | return $q != 1 ? ($b1 * (pow($q, $n) - 1)/($q - 1)) : ($n * $b1); |
5 | 5 | } |
6 | 6 | |
7 | -function sn_floor($value) |
|
8 | -{ |
|
7 | +function sn_floor($value) { |
|
9 | 8 | return $value >= 0 ? floor($value) : ceil($value); |
10 | 9 | } |
11 | 10 | |
12 | 11 | // Эта функция выдает нормально распределенное случайное число с матожиднием $mu и стандартным отклонением $sigma |
13 | 12 | // $strict - количество $sigma, по которым идет округление функции. Т.е. $strict = 3 означает, что диапазон значений обрезается по +-3 * $sigma |
14 | 13 | // Используется http://ru.wikipedia.org/wiki/Преобразование_Бокса_—_Мюллера |
15 | -function sn_rand_gauss($mu = 0, $sigma = 1, $strict = false) |
|
16 | -{ |
|
14 | +function sn_rand_gauss($mu = 0, $sigma = 1, $strict = false) { |
|
17 | 15 | // http://ru.wikipedia.org/wiki/Среднеквадратическое_отклонение |
18 | 16 | // При $mu = 0 (график симметричный, цифры только для половины графика) |
19 | 17 | // От 0 до $sigma ~ 34.1% |
@@ -43,7 +41,7 @@ discard block |
||
43 | 41 | * |
44 | 42 | * @return float|int |
45 | 43 | */ |
46 | -function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) { |
|
44 | +function sn_rand_gauss_range($range_start, $range_end, $round = true, $strict = 4, $cut_extreme = false) { |
|
47 | 45 | if($cut_extreme) { |
48 | 46 | $range_start--; |
49 | 47 | $range_end++; |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | return $result; |
57 | 55 | } |
58 | 56 | |
59 | -function median() |
|
60 | -{ |
|
57 | +function median() { |
|
61 | 58 | $args = func_get_args(); |
62 | 59 | |
63 | 60 | switch(func_num_args()) |
@@ -86,8 +83,7 @@ discard block |
||
86 | 83 | if($n % 2 == 0) |
87 | 84 | { |
88 | 85 | $median = ($args[$h] + $args[$h-1]) / 2; |
89 | - } |
|
90 | - else |
|
86 | + } else |
|
91 | 87 | { |
92 | 88 | $median = $args[$h]; |
93 | 89 | } |
@@ -97,12 +93,10 @@ discard block |
||
97 | 93 | |
98 | 94 | return $median; |
99 | 95 | } |
100 | -function average($arr) |
|
101 | -{ |
|
96 | +function average($arr) { |
|
102 | 97 | return is_array($arr) && count($arr) ? array_sum($arr) / count($arr) : 0; |
103 | 98 | } |
104 | -function linear_calc(&$linear, $from = 0, $debug = false) |
|
105 | -{ |
|
99 | +function linear_calc(&$linear, $from = 0, $debug = false) { |
|
106 | 100 | for($i = $from; $i < count($linear); $i++) |
107 | 101 | { |
108 | 102 | $eq = &$linear[$i]; |
@@ -111,7 +105,9 @@ discard block |
||
111 | 105 | $eq[$j] /= $eq[$from]; |
112 | 106 | } |
113 | 107 | } |
114 | - if($debug) pdump($linear, 'Нормализовано по х' . $from); |
|
108 | + if($debug) { |
|
109 | + pdump($linear, 'Нормализовано по х' . $from); |
|
110 | + } |
|
115 | 111 | |
116 | 112 | for($i = $from + 1; $i < count($linear); $i++) |
117 | 113 | { |
@@ -121,7 +117,9 @@ discard block |
||
121 | 117 | $eq[$j] -= $linear[$from][$j]; |
122 | 118 | } |
123 | 119 | } |
124 | - if($debug) pdump($linear, 'Подставили х' . $from); |
|
120 | + if($debug) { |
|
121 | + pdump($linear, 'Подставили х' . $from); |
|
122 | + } |
|
125 | 123 | |
126 | 124 | if($from < count($linear) - 1) |
127 | 125 | { |
@@ -138,11 +136,14 @@ discard block |
||
138 | 136 | $eq[$j] = $eq[$j] - $eq[$from] * $linear[$from][$j]; |
139 | 137 | } |
140 | 138 | } |
141 | - if($debug) pdump($linear, 'Подставили обратно х' . $from); |
|
142 | - } |
|
143 | - else |
|
139 | + if($debug) { |
|
140 | + pdump($linear, 'Подставили обратно х' . $from); |
|
141 | + } |
|
142 | + } else |
|
144 | 143 | { |
145 | - if($debug) pdump($linear, 'Результат' . $from); |
|
144 | + if($debug) { |
|
145 | + pdump($linear, 'Результат' . $from); |
|
146 | + } |
|
146 | 147 | foreach($linear as $index => &$eq) |
147 | 148 | { |
148 | 149 | pdump($eq[count($linear)], 'x' . $index); |
@@ -815,7 +815,7 @@ |
||
815 | 815 | '%H' => '(?P<H>[0-9]{2})', |
816 | 816 | '%M' => '(?P<M>[0-9]{2})', |
817 | 817 | '%S' => '(?P<S>[0-9]{2})', |
818 | - // usw.. |
|
818 | + // usw.. |
|
819 | 819 | ); |
820 | 820 | |
821 | 821 | $rexep = "#".strtr(preg_quote($format), $masks)."#"; |
@@ -11,6 +11,9 @@ discard block |
||
11 | 11 | require_once('general/math.php'); |
12 | 12 | require_once('general_pname.php'); |
13 | 13 | |
14 | +/** |
|
15 | + * @param string $func_name |
|
16 | + */ |
|
14 | 17 | function sn_function_call($func_name, $func_arg = array()) |
15 | 18 | { |
16 | 19 | global $functions; // All data in $functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
@@ -64,6 +67,9 @@ discard block |
||
64 | 67 | |
65 | 68 | // ---------------------------------------------------------------------------------------------------------------- |
66 | 69 | // Fonction de lecture / ecriture / exploitation de templates |
70 | +/** |
|
71 | + * @param string $filename |
|
72 | + */ |
|
67 | 73 | function sys_file_read($filename) |
68 | 74 | { |
69 | 75 | return @file_get_contents($filename); |
@@ -110,7 +116,7 @@ discard block |
||
110 | 116 | /** |
111 | 117 | * Получение курса обмены валюты в серверную валюту |
112 | 118 | * |
113 | - * @param $currency_symbol |
|
119 | + * @param string $currency_symbol |
|
114 | 120 | * |
115 | 121 | * @return float |
116 | 122 | */ |
@@ -147,6 +153,7 @@ discard block |
||
147 | 153 | null - standard result |
148 | 154 | true - return only style class for current params |
149 | 155 | false - return array('text' => $ret, 'class' => $class), where $ret - unstyled |
156 | + * @param boolean $style |
|
150 | 157 | */ |
151 | 158 | |
152 | 159 | function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) |
@@ -266,6 +273,9 @@ discard block |
||
266 | 273 | return preg_replace($ListCensure, '*', $String); |
267 | 274 | } |
268 | 275 | |
276 | +/** |
|
277 | + * @param string $email |
|
278 | + */ |
|
269 | 279 | function is_email($email) { |
270 | 280 | return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)); |
271 | 281 | } |
@@ -302,6 +312,9 @@ discard block |
||
302 | 312 | return floatval(sys_get_param($param_name, $default)); |
303 | 313 | } |
304 | 314 | |
315 | +/** |
|
316 | + * @param string $param_name |
|
317 | + */ |
|
305 | 318 | function sys_get_param_escaped($param_name, $default = '') |
306 | 319 | { |
307 | 320 | return db_escape(sys_get_param($param_name, $default)); |
@@ -546,6 +559,9 @@ discard block |
||
546 | 559 | } |
547 | 560 | |
548 | 561 | // Generates random string of $length symbols from $allowed_chars charset |
562 | +/** |
|
563 | + * @param string $allowed_chars |
|
564 | + */ |
|
549 | 565 | function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) { |
550 | 566 | $allowed_length = strlen($allowed_chars); |
551 | 567 | |
@@ -671,6 +687,9 @@ discard block |
||
671 | 687 | return implode(';', $fleet_string); |
672 | 688 | } |
673 | 689 | |
690 | +/** |
|
691 | + * @param string $body |
|
692 | + */ |
|
674 | 693 | function mymail($email_unsafe, $title, $body, $from = '', $html = false) { |
675 | 694 | global $config, $lang; |
676 | 695 | |
@@ -958,6 +977,9 @@ discard block |
||
958 | 977 | return serialize($nick_array); |
959 | 978 | } |
960 | 979 | |
980 | +/** |
|
981 | + * @param string $nick_string |
|
982 | + */ |
|
961 | 983 | function player_nick_uncompact($nick_string) { |
962 | 984 | try { |
963 | 985 | $result = unserialize($nick_string); |
@@ -1247,6 +1269,9 @@ discard block |
||
1247 | 1269 | return $ranks; |
1248 | 1270 | } |
1249 | 1271 | |
1272 | +/** |
|
1273 | + * @param boolean $planet_id |
|
1274 | + */ |
|
1250 | 1275 | function sys_player_new_adjust($user_id, $planet_id){return sn_function_call('sys_player_new_adjust', array($user_id, $planet_id, &$result));} |
1251 | 1276 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
1252 | 1277 | return $result; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | global $functions; // All data in $functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
17 | 17 | |
18 | - if(is_array($functions[$func_name]) && !is_callable($functions[$func_name])) |
|
18 | + if (is_array($functions[$func_name]) && !is_callable($functions[$func_name])) |
|
19 | 19 | { |
20 | 20 | // Chain-callable functions should be made as following: |
21 | 21 | // 1. Never use incomplete calls with parameters "by default" |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | // 3. Use same format for original value and cumulative result (if there is original value) |
24 | 24 | // 4. Honor cumulative result |
25 | 25 | // 5. Return cumulative result |
26 | - foreach($functions[$func_name] as $func_chain_name) |
|
26 | + foreach ($functions[$func_name] as $func_chain_name) |
|
27 | 27 | { |
28 | 28 | // По идее - это уже тут не нужно, потому что оно все должно быть callable к этому моменту |
29 | 29 | // Но для старых модулей... |
30 | - if(is_callable($func_chain_name)) |
|
30 | + if (is_callable($func_chain_name)) |
|
31 | 31 | { |
32 | 32 | $result = call_user_func_array($func_chain_name, $func_arg); |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | // TODO: This is left for backward compatibility. Appropriate code should be rewrote! |
39 | 39 | $func_name = isset($functions[$func_name]) && is_callable($functions[$func_name]) ? $functions[$func_name] : ('sn_' . $func_name); |
40 | - if(is_callable($func_name)) |
|
40 | + if (is_callable($func_name)) |
|
41 | 41 | { |
42 | 42 | $result = call_user_func_array($func_name, $func_arg); |
43 | 43 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param string $page_name - имя страницы, для которого должен был быть выполнен хук |
54 | 54 | */ |
55 | 55 | function execute_hooks(&$hook_list, &$template, $hook_type = null, $page_name = null) { |
56 | - if(!empty($hook_list)) { |
|
57 | - foreach($hook_list as $hook) { |
|
58 | - if(is_callable($hook_call = (is_string($hook) ? $hook : (is_array($hook) ? $hook['callable'] : $hook->callable)))) { |
|
56 | + if (!empty($hook_list)) { |
|
57 | + foreach ($hook_list as $hook) { |
|
58 | + if (is_callable($hook_call = (is_string($hook) ? $hook : (is_array($hook) ? $hook['callable'] : $hook->callable)))) { |
|
59 | 59 | $template = call_user_func($hook_call, $template, $hook_type, $page_name); |
60 | 60 | } |
61 | 61 | } |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | return @file_put_contents($filename, $content, FILE_APPEND); |
75 | 75 | } |
76 | 76 | |
77 | -function get_game_speed($plain = false){return sn_function_call('get_game_speed', array($plain, &$result));} |
|
77 | +function get_game_speed($plain = false) {return sn_function_call('get_game_speed', array($plain, &$result)); } |
|
78 | 78 | function sn_get_game_speed($plain = false, &$result) { |
79 | 79 | return $result = classSupernova::$config->game_speed ? classSupernova::$config->game_speed : 1; |
80 | 80 | } |
81 | 81 | |
82 | -function flt_server_flight_speed_multiplier($plain = false){return sn_function_call('flt_server_flight_speed_multiplier', array($plain, &$result));} |
|
82 | +function flt_server_flight_speed_multiplier($plain = false) {return sn_function_call('flt_server_flight_speed_multiplier', array($plain, &$result)); } |
|
83 | 83 | function sn_flt_server_flight_speed_multiplier($plain = false, &$result) { |
84 | 84 | global $config; |
85 | 85 | |
86 | 86 | return $result = classSupernova::$config->fleet_speed; |
87 | 87 | } |
88 | 88 | |
89 | -function game_resource_multiplier($plain = false){return sn_function_call('game_resource_multiplier', array($plain,&$result));} |
|
89 | +function game_resource_multiplier($plain = false) {return sn_function_call('game_resource_multiplier', array($plain, &$result)); } |
|
90 | 90 | function sn_game_resource_multiplier($plain = false, &$result) { |
91 | 91 | global $config; |
92 | 92 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return mixed |
102 | 102 | */ |
103 | -function get_mm_cost($plain = false){return sn_function_call('get_mm_cost', array($plain, &$result));} |
|
103 | +function get_mm_cost($plain = false) {return sn_function_call('get_mm_cost', array($plain, &$result)); } |
|
104 | 104 | function sn_get_mm_cost($plain = false, &$result) { |
105 | 105 | global $config; |
106 | 106 | |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) |
153 | 153 | { |
154 | 154 | $n = floatval($n); |
155 | - if(is_int($floor)) |
|
155 | + if (is_int($floor)) |
|
156 | 156 | { |
157 | 157 | $n = round($n, $floor); // , PHP_ROUND_HALF_DOWN |
158 | 158 | } |
159 | - elseif($floor === true) |
|
159 | + elseif ($floor === true) |
|
160 | 160 | { |
161 | 161 | $n = floor($n); |
162 | 162 | $floor = 0; |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | $ret = $n; |
170 | 170 | |
171 | 171 | $suffix = ''; |
172 | - if($limit) |
|
172 | + if ($limit) |
|
173 | 173 | { |
174 | - if($ret > 0) |
|
174 | + if ($ret > 0) |
|
175 | 175 | { |
176 | - while($ret > $limit) |
|
176 | + while ($ret > $limit) |
|
177 | 177 | { |
178 | 178 | $suffix .= 'k'; |
179 | 179 | $ret = round($ret / 1000); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | else |
183 | 183 | { |
184 | - while($ret < -$limit) |
|
184 | + while ($ret < -$limit) |
|
185 | 185 | { |
186 | 186 | $suffix .= 'k'; |
187 | 187 | $ret = round($ret / 1000); |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | $ret = number_format($ret, $floor, ',', '.'); |
193 | 193 | $ret .= $suffix; |
194 | 194 | |
195 | - if($color !== false) |
|
195 | + if ($color !== false) |
|
196 | 196 | { |
197 | - if($color === true) |
|
197 | + if ($color === true) |
|
198 | 198 | { |
199 | 199 | $class = $n == 0 ? 'zero' : ($n > 0 ? 'positive' : 'negative'); |
200 | 200 | } |
201 | - elseif($color >= 0) |
|
201 | + elseif ($color >= 0) |
|
202 | 202 | { |
203 | 203 | $class = $n == $color ? 'zero' : ($n < $color ? 'positive' : 'negative'); |
204 | 204 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $class = ($n == -$color) ? 'zero' : ($n < -$color ? 'negative' : 'positive'); |
208 | 208 | } |
209 | 209 | |
210 | - if(!isset($style)) |
|
210 | + if (!isset($style)) |
|
211 | 211 | { |
212 | 212 | $ret = "<span class='{$class}'>{$ret}</span>"; |
213 | 213 | } |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | function sys_get_param_phone($param_name, $default = '') |
343 | 343 | { |
344 | 344 | $phone_raw = sys_get_param_str_unsafe($param_name, $default = ''); |
345 | - if($phone_raw) |
|
345 | + if ($phone_raw) |
|
346 | 346 | { |
347 | 347 | $phone = $phone_raw[0] == '+' ? '+' : ''; |
348 | - for($i = 0; $i < strlen($phone_raw); $i++) |
|
348 | + for ($i = 0; $i < strlen($phone_raw); $i++) |
|
349 | 349 | { |
350 | 350 | $ord = ord($phone_raw[$i]); |
351 | - if($ord >= 48 && $ord <= 57) |
|
351 | + if ($ord >= 48 && $ord <= 57) |
|
352 | 352 | { |
353 | 353 | $phone .= $phone_raw[$i]; |
354 | 354 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | function CheckAbandonPlanetState(&$planet) |
372 | 372 | { |
373 | - if($planet['destruyed'] && $planet['destruyed'] <= SN_TIME_NOW) |
|
373 | + if ($planet['destruyed'] && $planet['destruyed'] <= SN_TIME_NOW) |
|
374 | 374 | { |
375 | 375 | DBStaticPlanet::db_planet_delete_by_id($planet['id']); |
376 | 376 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | global $config; |
382 | 382 | |
383 | 383 | static $rate, $sn_group_resources_all, $sn_group_resources_loot; |
384 | - if(!$rate) |
|
384 | + if (!$rate) |
|
385 | 385 | { |
386 | 386 | $sn_group_resources_all = sn_get_groups('resources_all'); |
387 | 387 | $sn_group_resources_loot = sn_get_groups('resources_loot'); |
@@ -392,22 +392,22 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | $unit_cost_data = get_unit_param($unit_id, 'cost'); |
395 | - if(!is_array($unit_cost_data)) |
|
395 | + if (!is_array($unit_cost_data)) |
|
396 | 396 | { |
397 | 397 | return array('total' => 0); |
398 | 398 | } |
399 | 399 | $factor = isset($unit_cost_data['factor']) ? $unit_cost_data['factor'] : 1; |
400 | 400 | $cost_array = array(BUILD_CREATE => array(), 'total' => 0); |
401 | 401 | $unit_level = $unit_level > 0 ? $unit_level : 0; |
402 | - foreach($unit_cost_data as $resource_id => $resource_amount) |
|
402 | + foreach ($unit_cost_data as $resource_id => $resource_amount) |
|
403 | 403 | { |
404 | - if(!in_array($resource_id, $sn_group_resources_all)) |
|
404 | + if (!in_array($resource_id, $sn_group_resources_all)) |
|
405 | 405 | { |
406 | 406 | continue; |
407 | 407 | } |
408 | 408 | // $cost_array[BUILD_CREATE][$resource_id] = $resource_amount * ($factor == 1 ? $unit_level : ((pow($factor, $unit_level) - $factor) / ($factor - 1))); |
409 | 409 | $cost_array[BUILD_CREATE][$resource_id] = round($resource_amount * ($factor == 1 ? $unit_level : ((1 - pow($factor, $unit_level)) / (1 - $factor)))); |
410 | - if(in_array($resource_id, $sn_group_resources_loot)) |
|
410 | + if (in_array($resource_id, $sn_group_resources_loot)) |
|
411 | 411 | { |
412 | 412 | $cost_array['total'] += $cost_array[BUILD_CREATE][$resource_id] * $rate[$resource_id]; |
413 | 413 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | return $cost_array; |
417 | 417 | } |
418 | 418 | |
419 | -function sn_unit_purchase($unit_id){} |
|
419 | +function sn_unit_purchase($unit_id) {} |
|
420 | 420 | |
421 | -function sn_unit_relocate($unit_id, $from, $to){} |
|
421 | +function sn_unit_relocate($unit_id, $from, $to) {} |
|
422 | 422 | |
423 | 423 | /* |
424 | 424 | ЭТО ПРОСТОЙ ВРАППЕР ДЛЯ БД! Здесь НЕТ никаких проверок! ВСЕ проверки должны быть сделаны заранее! |
@@ -477,48 +477,48 @@ discard block |
||
477 | 477 | } |
478 | 478 | */ |
479 | 479 | |
480 | -function mrc_get_level(&$user, $planet = array(), $unit_id, $for_update = false, $plain = false){return sn_function_call(__FUNCTION__, array(&$user, $planet, $unit_id, $for_update, $plain, &$result));} |
|
480 | +function mrc_get_level(&$user, $planet = array(), $unit_id, $for_update = false, $plain = false) {return sn_function_call(__FUNCTION__, array(&$user, $planet, $unit_id, $for_update, $plain, &$result)); } |
|
481 | 481 | function sn_mrc_get_level(&$user, $planet = array(), $unit_id, $for_update = false, $plain = false, &$result) { |
482 | 482 | $mercenary_level = 0; |
483 | 483 | $unit_db_name = pname_resource_name($unit_id); |
484 | 484 | |
485 | - if(in_array($unit_id, sn_get_groups(array('plans', 'mercenaries', 'tech', 'artifacts')))) { |
|
485 | + if (in_array($unit_id, sn_get_groups(array('plans', 'mercenaries', 'tech', 'artifacts')))) { |
|
486 | 486 | $unit = classSupernova::db_get_unit_by_location($user['id'], LOC_USER, $user['id'], $unit_id); |
487 | 487 | $mercenary_level = is_array($unit) && $unit['unit_level'] ? $unit['unit_level'] : 0; |
488 | - } elseif(in_array($unit_id, sn_get_groups(array('structures', 'fleet', 'defense')))) { |
|
488 | + } elseif (in_array($unit_id, sn_get_groups(array('structures', 'fleet', 'defense')))) { |
|
489 | 489 | $unit = classSupernova::db_get_unit_by_location(is_array($user) ? $user['id'] : $planet['id_owner'], LOC_PLANET, $planet['id'], $unit_id); |
490 | 490 | $mercenary_level = is_array($unit) && $unit['unit_level'] ? $unit['unit_level'] : 0; |
491 | - } elseif(in_array($unit_id, sn_get_groups('governors'))) { |
|
491 | + } elseif (in_array($unit_id, sn_get_groups('governors'))) { |
|
492 | 492 | $mercenary_level = $unit_id == $planet['PLANET_GOVERNOR_ID'] ? $planet['PLANET_GOVERNOR_LEVEL'] : 0; |
493 | - } elseif($unit_id == RES_DARK_MATTER) { |
|
493 | + } elseif ($unit_id == RES_DARK_MATTER) { |
|
494 | 494 | $mercenary_level = $user[$unit_db_name] + ($plain || $user['user_as_ally'] ? 0 : classSupernova::$auth->account->account_metamatter); |
495 | - } elseif($unit_id == RES_METAMATTER) { |
|
495 | + } elseif ($unit_id == RES_METAMATTER) { |
|
496 | 496 | $mercenary_level = classSupernova::$auth->account->account_metamatter; //$user[$unit_db_name]; |
497 | - } elseif(in_array($unit_id, sn_get_groups(array('resources_loot'))) || $unit_id == UNIT_SECTOR) { |
|
497 | + } elseif (in_array($unit_id, sn_get_groups(array('resources_loot'))) || $unit_id == UNIT_SECTOR) { |
|
498 | 498 | $mercenary_level = !empty($planet) ? $planet[$unit_db_name] : $user[$unit_db_name]; |
499 | 499 | } |
500 | 500 | |
501 | 501 | return $result = $mercenary_level; |
502 | 502 | } |
503 | 503 | |
504 | -function mrc_modify_value(&$user, $planet = array(), $mercenaries, $value) {return sn_function_call('mrc_modify_value', array(&$user, $planet, $mercenaries, $value));} |
|
504 | +function mrc_modify_value(&$user, $planet = array(), $mercenaries, $value) {return sn_function_call('mrc_modify_value', array(&$user, $planet, $mercenaries, $value)); } |
|
505 | 505 | function sn_mrc_modify_value(&$user, $planet = array(), $mercenaries, $value, $base_value = null) |
506 | 506 | { |
507 | - if(!is_array($mercenaries)) |
|
507 | + if (!is_array($mercenaries)) |
|
508 | 508 | { |
509 | 509 | $mercenaries = array($mercenaries); |
510 | 510 | } |
511 | 511 | |
512 | 512 | $base_value = isset($base_value) ? $base_value : $value; |
513 | 513 | |
514 | - foreach($mercenaries as $mercenary_id) |
|
514 | + foreach ($mercenaries as $mercenary_id) |
|
515 | 515 | { |
516 | 516 | $mercenary_level = mrc_get_level($user, $planet, $mercenary_id); |
517 | 517 | |
518 | 518 | $mercenary = get_unit_param($mercenary_id); |
519 | 519 | $mercenary_bonus = $mercenary['bonus']; |
520 | 520 | |
521 | - switch($mercenary['bonus_type']) |
|
521 | + switch ($mercenary['bonus_type']) |
|
522 | 522 | { |
523 | 523 | case BONUS_PERCENT_CUMULATIVE: |
524 | 524 | $value *= 1 + $mercenary_level * $mercenary_bonus / 100; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $allowed_length = strlen($allowed_chars); |
551 | 551 | |
552 | 552 | $random_string = ''; |
553 | - for($i = 0; $i < $length; $i++) { |
|
553 | + for ($i = 0; $i < $length; $i++) { |
|
554 | 554 | $random_string .= $allowed_chars[mt_rand(0, $allowed_length - 1)]; |
555 | 555 | } |
556 | 556 | |
@@ -573,10 +573,10 @@ discard block |
||
573 | 573 | |
574 | 574 | $options = ''; |
575 | 575 | $option_list = array(); |
576 | - foreach($user_option_list as $option_group_id => $option_group) |
|
576 | + foreach ($user_option_list as $option_group_id => $option_group) |
|
577 | 577 | { |
578 | 578 | $option_list[$option_group_id] = array(); |
579 | - foreach($option_group as $option_name => $option_value) |
|
579 | + foreach ($option_group as $option_name => $option_value) |
|
580 | 580 | { |
581 | 581 | if (!isset($user[$option_name])) |
582 | 582 | { |
@@ -602,19 +602,19 @@ discard block |
||
602 | 602 | $option_list = array(); |
603 | 603 | $option_string_list = explode('|', $user['options']); |
604 | 604 | |
605 | - foreach($option_string_list as $option_string) |
|
605 | + foreach ($option_string_list as $option_string) |
|
606 | 606 | { |
607 | 607 | list($option_name, $option_value) = explode('^', $option_string); |
608 | 608 | $option_list[$option_name] = $option_value; |
609 | 609 | } |
610 | 610 | |
611 | 611 | $final_list = array(); |
612 | - foreach($user_option_list as $option_group_id => $option_group) |
|
612 | + foreach ($user_option_list as $option_group_id => $option_group) |
|
613 | 613 | { |
614 | 614 | $final_list[$option_group_id] = array(); |
615 | - foreach($option_group as $option_name => $option_value) |
|
615 | + foreach ($option_group as $option_name => $option_value) |
|
616 | 616 | { |
617 | - if(!isset($option_list[$option_name])) |
|
617 | + if (!isset($option_list[$option_name])) |
|
618 | 618 | { |
619 | 619 | $option_list[$option_name] = $option_value; |
620 | 620 | } |
@@ -630,15 +630,15 @@ discard block |
||
630 | 630 | function sys_unit_str2arr($fleet_string) |
631 | 631 | { |
632 | 632 | $fleet_array = array(); |
633 | - if(!empty($fleet_string)) |
|
633 | + if (!empty($fleet_string)) |
|
634 | 634 | { |
635 | 635 | $arrTemp = explode(';', $fleet_string); |
636 | - foreach($arrTemp as $temp) |
|
636 | + foreach ($arrTemp as $temp) |
|
637 | 637 | { |
638 | - if($temp) |
|
638 | + if ($temp) |
|
639 | 639 | { |
640 | 640 | $temp = explode(',', $temp); |
641 | - if(!empty($temp[0]) && !empty($temp[1])) |
|
641 | + if (!empty($temp[0]) && !empty($temp[1])) |
|
642 | 642 | { |
643 | 643 | $fleet_array[$temp[0]] += $temp[1]; |
644 | 644 | } |
@@ -652,16 +652,16 @@ discard block |
||
652 | 652 | function sys_unit_arr2str($unit_list) |
653 | 653 | { |
654 | 654 | $fleet_string = array(); |
655 | - if(isset($unit_list)) |
|
655 | + if (isset($unit_list)) |
|
656 | 656 | { |
657 | - if(!is_array($unit_list)) |
|
657 | + if (!is_array($unit_list)) |
|
658 | 658 | { |
659 | 659 | $unit_list = array($unit_list => 1); |
660 | 660 | } |
661 | 661 | |
662 | - foreach($unit_list as $unit_id => $unit_count) |
|
662 | + foreach ($unit_list as $unit_id => $unit_count) |
|
663 | 663 | { |
664 | - if($unit_id && $unit_count) |
|
664 | + if ($unit_id && $unit_count) |
|
665 | 665 | { |
666 | 666 | $fleet_string[] = "{$unit_id},{$unit_count}"; |
667 | 667 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $from = trim($from ? $from : classSupernova::$config->game_adminEmail); |
678 | 678 | |
679 | 679 | $head = ''; |
680 | - $head .= "Content-Type: text/" . ($html ? 'html' : 'plain'). "; charset=utf-8 \r\n"; |
|
680 | + $head .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=utf-8 \r\n"; |
|
681 | 681 | $head .= "Date: " . date('r') . " \r\n"; |
682 | 682 | $head .= "Return-Path: {classSupernova::$config->game_adminEmail} \r\n"; |
683 | 683 | $head .= "From: {$from} \r\n"; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $body = str_replace("\r\n", "\n", $body); |
690 | 690 | $body = str_replace("\n", "\r\n", $body); |
691 | 691 | |
692 | - if($html) { |
|
692 | + if ($html) { |
|
693 | 693 | $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>'; |
694 | 694 | } |
695 | 695 | |
@@ -703,15 +703,15 @@ discard block |
||
703 | 703 | global $lang; |
704 | 704 | |
705 | 705 | $seconds = $time % 60; |
706 | - $time = floor($time/60); |
|
706 | + $time = floor($time / 60); |
|
707 | 707 | $minutes = $time % 60; |
708 | - $time = floor($time/60); |
|
708 | + $time = floor($time / 60); |
|
709 | 709 | $hours = $time % 24; |
710 | - $time = floor($time/24); |
|
710 | + $time = floor($time / 24); |
|
711 | 711 | |
712 | 712 | return |
713 | - ($full || $time ? "{$time} {$lang['sys_day']} " : '') . |
|
714 | - ($full || $hours ? "{$hours} {$lang['sys_hrs']} " : '') . |
|
713 | + ($full || $time ? "{$time} {$lang['sys_day']} " : '') . |
|
714 | + ($full || $hours ? "{$hours} {$lang['sys_hrs']} " : '') . |
|
715 | 715 | ($full || $minutes ? "{$minutes} {$lang['sys_min']} " : '') . |
716 | 716 | ($full || !$time || $seconds ? "{$seconds} {$lang['sys_sec']}" : ''); |
717 | 717 | } |
@@ -728,35 +728,35 @@ discard block |
||
728 | 728 | } |
729 | 729 | |
730 | 730 | // TODO Для полноценного функионирования апдейтера пакет функций, включая эту должен быть вынесен раньше - или грузить general.php до апдейтера |
731 | -function sys_get_unit_location($user, $planet, $unit_id){return sn_function_call('sys_get_unit_location', array($user, $planet, $unit_id));} |
|
731 | +function sys_get_unit_location($user, $planet, $unit_id) {return sn_function_call('sys_get_unit_location', array($user, $planet, $unit_id)); } |
|
732 | 732 | function sn_sys_get_unit_location($user, $planet, $unit_id) |
733 | 733 | { |
734 | 734 | return get_unit_param($unit_id, 'location'); |
735 | 735 | } |
736 | 736 | |
737 | 737 | function sn_ali_fill_user_ally(&$user) { |
738 | - if(!$user['ally_id']) { |
|
738 | + if (!$user['ally_id']) { |
|
739 | 739 | return; |
740 | 740 | } |
741 | 741 | |
742 | - if(!isset($user['ally'])) { |
|
742 | + if (!isset($user['ally'])) { |
|
743 | 743 | $user['ally'] = doquery("SELECT * FROM {{alliance}} WHERE `id` = {$user['ally_id']} LIMIT 1;", true); |
744 | 744 | } |
745 | 745 | |
746 | - if(!isset($user['ally']['player'])) { |
|
746 | + if (!isset($user['ally']['player'])) { |
|
747 | 747 | $user['ally']['player'] = db_user_by_id($user['ally']['ally_user_id'], true, '*', false); |
748 | 748 | } |
749 | 749 | } |
750 | 750 | |
751 | 751 | function sn_get_url_contents($url) |
752 | 752 | { |
753 | - if(function_exists('curl_init')) |
|
753 | + if (function_exists('curl_init')) |
|
754 | 754 | { |
755 | 755 | $crl = curl_init(); |
756 | 756 | $timeout = 5; |
757 | - curl_setopt ($crl, CURLOPT_URL,$url); |
|
758 | - curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); |
|
759 | - curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
757 | + curl_setopt($crl, CURLOPT_URL, $url); |
|
758 | + curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); |
|
759 | + curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
760 | 760 | $return = curl_exec($crl); |
761 | 761 | curl_close($crl); |
762 | 762 | } |
@@ -790,12 +790,12 @@ discard block |
||
790 | 790 | function get_ship_data($ship_id, $user) |
791 | 791 | { |
792 | 792 | $ship_data = array(); |
793 | - if(in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) |
|
793 | + if (in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) |
|
794 | 794 | { |
795 | - foreach(get_unit_param($ship_id, 'engine') as $engine_info) |
|
795 | + foreach (get_unit_param($ship_id, 'engine') as $engine_info) |
|
796 | 796 | { |
797 | 797 | $tech_level = intval(mrc_get_level($user, false, $engine_info['tech'])); |
798 | - if(empty($ship_data) || $tech_level >= $engine_info['min_level']) |
|
798 | + if (empty($ship_data) || $tech_level >= $engine_info['min_level']) |
|
799 | 799 | { |
800 | 800 | $ship_data = $engine_info; |
801 | 801 | $ship_data['tech_level'] = $tech_level; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | return $ship_data; |
809 | 809 | } |
810 | 810 | |
811 | -if(!function_exists('strptime')) |
|
811 | +if (!function_exists('strptime')) |
|
812 | 812 | { |
813 | 813 | function strptime($date, $format) |
814 | 814 | { |
@@ -822,8 +822,8 @@ discard block |
||
822 | 822 | // usw.. |
823 | 823 | ); |
824 | 824 | |
825 | - $rexep = "#".strtr(preg_quote($format), $masks)."#"; |
|
826 | - if(preg_match($rexep, $date, $out)) |
|
825 | + $rexep = "#" . strtr(preg_quote($format), $masks) . "#"; |
|
826 | + if (preg_match($rexep, $date, $out)) |
|
827 | 827 | { |
828 | 828 | $ret = array( |
829 | 829 | "tm_sec" => (int) $out['S'], |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | function sn_sys_sector_buy($redirect = 'overview.php') { |
846 | 846 | global $lang, $user, $planetrow; |
847 | 847 | |
848 | - if(!sys_get_param_str('sector_buy') || $planetrow['planet_type'] != PT_PLANET) { |
|
848 | + if (!sys_get_param_str('sector_buy') || $planetrow['planet_type'] != PT_PLANET) { |
|
849 | 849 | return; |
850 | 850 | } |
851 | 851 | |
@@ -858,9 +858,9 @@ discard block |
||
858 | 858 | // $planetrow = $planetrow['planet']; |
859 | 859 | $sector_cost = eco_get_build_data($user, $planetrow, UNIT_SECTOR, mrc_get_level($user, $planetrow, UNIT_SECTOR), true); |
860 | 860 | $sector_cost = $sector_cost[BUILD_CREATE][RES_DARK_MATTER]; |
861 | - if($sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER)) { |
|
861 | + if ($sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER)) { |
|
862 | 862 | $planet_name_text = uni_render_planet($planetrow); |
863 | - if(rpg_points_change($user['id'], RPG_SECTOR, -$sector_cost, sprintf($lang['sys_sector_purchase_log'], |
|
863 | + if (rpg_points_change($user['id'], RPG_SECTOR, -$sector_cost, sprintf($lang['sys_sector_purchase_log'], |
|
864 | 864 | $user['username'], $user['id'], $planet_name_text, $lang['sys_planet_type'][$planetrow['planet_type']], $planetrow['id'], $sector_cost) |
865 | 865 | )) { |
866 | 866 | $sector_db_name = pname_resource_name(UNIT_SECTOR); |
@@ -876,43 +876,43 @@ discard block |
||
876 | 876 | |
877 | 877 | function sn_sys_handler_add(&$functions, $handler_list, $class_module_name = '', $sub_type = '') |
878 | 878 | { |
879 | - if(isset($handler_list) && is_array($handler_list) && !empty($handler_list)) |
|
879 | + if (isset($handler_list) && is_array($handler_list) && !empty($handler_list)) |
|
880 | 880 | { |
881 | - foreach($handler_list as $function_name => $function_data) |
|
881 | + foreach ($handler_list as $function_name => $function_data) |
|
882 | 882 | { |
883 | - if(is_string($function_data)) |
|
883 | + if (is_string($function_data)) |
|
884 | 884 | { |
885 | 885 | $override_with = &$function_data; |
886 | 886 | } |
887 | - elseif(isset($function_data['callable'])) |
|
887 | + elseif (isset($function_data['callable'])) |
|
888 | 888 | { |
889 | 889 | $override_with = &$function_data['callable']; |
890 | 890 | } |
891 | 891 | |
892 | 892 | $overwrite = $override_with[0] == '*'; |
893 | - if($overwrite) |
|
893 | + if ($overwrite) |
|
894 | 894 | { |
895 | 895 | $override_with = substr($override_with, 1); |
896 | 896 | } |
897 | 897 | |
898 | - if(($point_position = strpos($override_with, '.')) === false && $class_module_name) |
|
898 | + if (($point_position = strpos($override_with, '.')) === false && $class_module_name) |
|
899 | 899 | { |
900 | 900 | $override_with = array($class_module_name, $override_with); |
901 | 901 | } |
902 | - elseif($point_position == 0) |
|
902 | + elseif ($point_position == 0) |
|
903 | 903 | { |
904 | 904 | $override_with = substr($override_with, 1); |
905 | 905 | } |
906 | - elseif($point_position > 0) |
|
906 | + elseif ($point_position > 0) |
|
907 | 907 | { |
908 | 908 | $override_with = array(substr($override_with, 0, $point_position), substr($override_with, $point_position + 1)); |
909 | 909 | } |
910 | 910 | |
911 | - if($overwrite) |
|
911 | + if ($overwrite) |
|
912 | 912 | { |
913 | 913 | $functions[$function_name] = array(); |
914 | 914 | } |
915 | - elseif(!isset($functions[$function_name])) |
|
915 | + elseif (!isset($functions[$function_name])) |
|
916 | 916 | { |
917 | 917 | $functions[$function_name] = array(); |
918 | 918 | $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : ''); |
@@ -929,18 +929,18 @@ discard block |
||
929 | 929 | |
930 | 930 | // TODO - поменять название |
931 | 931 | // Может принимать: (array)$user, $nick_render_array, $nick_render_array_html, $nick_render_string_compact |
932 | -function player_nick_render_to_html($result, $options = false){ |
|
932 | +function player_nick_render_to_html($result, $options = false) { |
|
933 | 933 | // TODO - обрабатывать разные случаи: $user, $render_nick_array, $string |
934 | 934 | |
935 | - if(is_string($result) && strpos($result, ':{i:')) { |
|
935 | + if (is_string($result) && strpos($result, ':{i:')) { |
|
936 | 936 | $result = player_nick_uncompact($result); |
937 | 937 | } |
938 | 938 | |
939 | - if(is_array($result)) { |
|
940 | - if(isset($result['id'])) { |
|
939 | + if (is_array($result)) { |
|
940 | + if (isset($result['id'])) { |
|
941 | 941 | $result = player_nick_render_current_to_array($result, $options); |
942 | 942 | } |
943 | - if(!isset($result[NICK_HTML])) { |
|
943 | + if (!isset($result[NICK_HTML])) { |
|
944 | 944 | $result = player_nick_render_array_to_html($result); |
945 | 945 | } |
946 | 946 | unset($result[NICK_HTML]); |
@@ -962,31 +962,31 @@ discard block |
||
962 | 962 | try { |
963 | 963 | $result = unserialize($nick_string); |
964 | 964 | // ksort($result); // Всегда ksort-ый в player_nick_compact() |
965 | - } catch(exception $e) { |
|
965 | + } catch (exception $e) { |
|
966 | 966 | $result = strpos($nick_string, ':{i:') ? null : $nick_string; // fallback if it is already string - for old chat strings, for example |
967 | 967 | } |
968 | 968 | return $result; |
969 | 969 | } |
970 | 970 | |
971 | -function player_nick_render_array_to_html($nick_array){return sn_function_call('player_nick_render_array_to_html', array($nick_array, &$result));} |
|
971 | +function player_nick_render_array_to_html($nick_array) {return sn_function_call('player_nick_render_array_to_html', array($nick_array, &$result)); } |
|
972 | 972 | function sn_player_nick_render_array_to_html($nick_array, &$result) { |
973 | 973 | global $config, $user; |
974 | 974 | |
975 | 975 | // ALL STRING ARE UNSAFE!!! |
976 | - if(isset($nick_array[NICK_BIRTHSDAY])) { |
|
976 | + if (isset($nick_array[NICK_BIRTHSDAY])) { |
|
977 | 977 | $result[NICK_BIRTHSDAY] = '<img src="design/images/birthday.png" />'; |
978 | 978 | } |
979 | 979 | |
980 | - if(isset($nick_array[NICK_VACATION])) { |
|
980 | + if (isset($nick_array[NICK_VACATION])) { |
|
981 | 981 | $result[NICK_VACATION] = '<img src="design/images/icon_vacation.png" />'; |
982 | 982 | } |
983 | 983 | |
984 | - if(isset($nick_array[NICK_GENDER])) { |
|
984 | + if (isset($nick_array[NICK_GENDER])) { |
|
985 | 985 | $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />'; |
986 | 986 | } |
987 | 987 | |
988 | - if(isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) { |
|
989 | - switch($nick_array[NICK_AUTH_LEVEL]) { |
|
988 | + if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) { |
|
989 | + switch ($nick_array[NICK_AUTH_LEVEL]) { |
|
990 | 990 | case 4: |
991 | 991 | $highlight = classSupernova::$config->chat_highlight_developer; |
992 | 992 | break; |
@@ -1007,20 +1007,20 @@ discard block |
||
1007 | 1007 | $highlight = isset($nick_array[NICK_PREMIUM]) ? classSupernova::$config->chat_highlight_premium : ''; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if($highlight) { |
|
1010 | + if ($highlight) { |
|
1011 | 1011 | list($result[NICK_HIGHLIGHT], $result[NICK_HIGHLIGHT_END]) = explode('$1', $highlight); |
1012 | 1012 | } |
1013 | 1013 | // $result = preg_replace("#(.+)#", $highlight, $result); |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - if(isset($nick_array[NICK_CLASS])) { |
|
1017 | - $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] .'>'; |
|
1016 | + if (isset($nick_array[NICK_CLASS])) { |
|
1017 | + $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>'; |
|
1018 | 1018 | $result[NICK_CLASS_END] = '</span>'; |
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]); |
1022 | 1022 | |
1023 | - if(isset($nick_array[NICK_ALLY])) { |
|
1023 | + if (isset($nick_array[NICK_ALLY])) { |
|
1024 | 1024 | $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']'; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | return $result; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | -function player_nick_render_current_to_array($render_user, $options = false){return sn_function_call('player_nick_render_current_to_array', array($render_user, $options, &$result));} |
|
1032 | +function player_nick_render_current_to_array($render_user, $options = false) {return sn_function_call('player_nick_render_current_to_array', array($render_user, $options, &$result)); } |
|
1033 | 1033 | function sn_player_nick_render_current_to_array($render_user, $options = false, &$result) { |
1034 | 1034 | /* |
1035 | 1035 | $options = $options !== true ? $options : |
@@ -1043,32 +1043,32 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | |
1045 | 1045 | |
1046 | - if($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) { |
|
1046 | + if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) { |
|
1047 | 1047 | $result[NICK_BIRTHSDAY] = ''; |
1048 | 1048 | } |
1049 | 1049 | |
1050 | - if($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['gender']) && $options['gender'])) { |
|
1050 | + if ($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['gender']) && $options['gender'])) { |
|
1051 | 1051 | $result[NICK_GENDER] = $render_user['gender'] == GENDER_UNKNOWN ? 'unknown' : ($render_user['gender'] == GENDER_FEMALE ? 'female' : 'male'); |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - if(($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['vacancy']) && $options['vacancy'])) && $render_user['vacation']) { |
|
1054 | + if (($options === true || (isset($options['icons']) && $options['icons']) || (isset($options['vacancy']) && $options['vacancy'])) && $render_user['vacation']) { |
|
1055 | 1055 | $result[NICK_VACATION] = $render_user['vacation']; |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if($options === true || (isset($options['color']) && $options['color'])) { |
|
1059 | - if($user_auth_level = $render_user['authlevel']) { |
|
1058 | + if ($options === true || (isset($options['color']) && $options['color'])) { |
|
1059 | + if ($user_auth_level = $render_user['authlevel']) { |
|
1060 | 1060 | $result[NICK_AUTH_LEVEL] = $user_auth_level; |
1061 | 1061 | } |
1062 | - if($user_premium = mrc_get_level($render_user, false, UNIT_PREMIUM)) { |
|
1062 | + if ($user_premium = mrc_get_level($render_user, false, UNIT_PREMIUM)) { |
|
1063 | 1063 | $result[NICK_PREMIUM] = $user_premium; |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | - if((isset($options['class']) && $options['class'])) { |
|
1067 | + if ((isset($options['class']) && $options['class'])) { |
|
1068 | 1068 | $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class']; |
1069 | 1069 | } |
1070 | 1070 | |
1071 | - if($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) { |
|
1071 | + if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) { |
|
1072 | 1072 | $result[NICK_ALLY] = $render_user['ally_tag']; |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1119,25 +1119,25 @@ discard block |
||
1119 | 1119 | |
1120 | 1120 | $user_skip_list = array(); |
1121 | 1121 | |
1122 | - if(classSupernova::$config->stats_hide_admins) { |
|
1122 | + if (classSupernova::$config->stats_hide_admins) { |
|
1123 | 1123 | $user_skip_list[] = '`authlevel` > 0'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - if(classSupernova::$config->stats_hide_player_list) { |
|
1126 | + if (classSupernova::$config->stats_hide_player_list) { |
|
1127 | 1127 | $temp = explode(',', classSupernova::$config->stats_hide_player_list); |
1128 | - foreach($temp as $user_id) { |
|
1128 | + foreach ($temp as $user_id) { |
|
1129 | 1129 | $user_id = floatval($user_id); |
1130 | - if($user_id) { |
|
1130 | + if ($user_id) { |
|
1131 | 1131 | $user_skip_list[] = '`id` = ' . $user_id; |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
1136 | - if(!empty($user_skip_list)) { |
|
1136 | + if (!empty($user_skip_list)) { |
|
1137 | 1137 | $user_skip_list = implode(' OR ', $user_skip_list); |
1138 | 1138 | $user_skip_query = db_user_list($user_skip_list); |
1139 | - if(!empty($user_skip_query)) { |
|
1140 | - foreach($user_skip_query as $user_skip_row) { |
|
1139 | + if (!empty($user_skip_query)) { |
|
1140 | + foreach ($user_skip_query as $user_skip_row) { |
|
1141 | 1141 | $result[$user_skip_row['id']] = $user_skip_row['id']; |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | // function player_nick_render_to_html($render_user, $options = false){return sn_function_call('player_nick_render_to_html', array($render_user, $options, &$result));} |
1150 | 1150 | // function sn_render_player_nick($render_user, $options = false, &$result) |
1151 | 1151 | |
1152 | -function get_unit_param($unit_id, $param_name = null, $user = null, $planet = null){return sn_function_call('get_unit_param', array($unit_id, $param_name, $user, $planet, &$result));} |
|
1152 | +function get_unit_param($unit_id, $param_name = null, $user = null, $planet = null) {return sn_function_call('get_unit_param', array($unit_id, $param_name, $user, $planet, &$result)); } |
|
1153 | 1153 | function sn_get_unit_param($unit_id, $param_name = null, $user = null, $planet = null, &$result) |
1154 | 1154 | { |
1155 | 1155 | global $sn_data; |
@@ -1164,11 +1164,11 @@ discard block |
||
1164 | 1164 | return $result; |
1165 | 1165 | } |
1166 | 1166 | |
1167 | -function sn_get_groups($groups){return sn_function_call('sn_get_groups', array($groups, &$result));} |
|
1167 | +function sn_get_groups($groups) {return sn_function_call('sn_get_groups', array($groups, &$result)); } |
|
1168 | 1168 | function sn_sn_get_groups($groups, &$result) |
1169 | 1169 | { |
1170 | 1170 | $result = is_array($result) ? $result : array(); |
1171 | - foreach($groups = is_array($groups) ? $groups : array($groups) as $group_name) |
|
1171 | + foreach ($groups = is_array($groups) ? $groups : array($groups) as $group_name) |
|
1172 | 1172 | { |
1173 | 1173 | $result += is_array($a_group = get_unit_param(UNIT_GROUP, $group_name)) ? $a_group : array(); |
1174 | 1174 | } |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | return preg_match('#^(\d*)#', $value, $matches) && $matches[1] ? floatval($matches[1]) : $default; |
1190 | 1190 | } |
1191 | 1191 | |
1192 | -function unit_requirements_render($user, $planetrow, $unit_id, $field = 'require'){return sn_function_call('unit_requirements_render', array($user, $planetrow, $unit_id, $field, &$result));} |
|
1192 | +function unit_requirements_render($user, $planetrow, $unit_id, $field = 'require') {return sn_function_call('unit_requirements_render', array($user, $planetrow, $unit_id, $field, &$result)); } |
|
1193 | 1193 | function sn_unit_requirements_render($user, $planetrow, $unit_id, $field = 'require', &$result) |
1194 | 1194 | { |
1195 | 1195 | global $lang, $config; |
@@ -1197,9 +1197,9 @@ discard block |
||
1197 | 1197 | $sn_data_unit = get_unit_param($unit_id); |
1198 | 1198 | |
1199 | 1199 | $result = is_array($result) ? $result : array(); |
1200 | - if($sn_data_unit[$field] && !($sn_data_unit[P_UNIT_TYPE] == UNIT_MERCENARIES && classSupernova::$config->empire_mercenary_temporary)) |
|
1200 | + if ($sn_data_unit[$field] && !($sn_data_unit[P_UNIT_TYPE] == UNIT_MERCENARIES && classSupernova::$config->empire_mercenary_temporary)) |
|
1201 | 1201 | { |
1202 | - foreach($sn_data_unit[$field] as $require_id => $require_level) |
|
1202 | + foreach ($sn_data_unit[$field] as $require_id => $require_level) |
|
1203 | 1203 | { |
1204 | 1204 | $level_got = mrc_get_level($user, $planetrow, $require_id); |
1205 | 1205 | $level_basic = mrc_get_level($user, $planetrow, $require_id, false, true); |
@@ -1225,19 +1225,19 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | $ranks = array(); |
1227 | 1227 | |
1228 | - if($ally['ranklist']) |
|
1228 | + if ($ally['ranklist']) |
|
1229 | 1229 | { |
1230 | 1230 | $str_ranks = explode(';', $ally['ranklist']); |
1231 | - foreach($str_ranks as $str_rank) |
|
1231 | + foreach ($str_ranks as $str_rank) |
|
1232 | 1232 | { |
1233 | - if(!$str_rank) |
|
1233 | + if (!$str_rank) |
|
1234 | 1234 | { |
1235 | 1235 | continue; |
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | $tmp = explode(',', $str_rank); |
1239 | 1239 | $rank_id = count($ranks); |
1240 | - foreach($ally_rights as $key => $value) |
|
1240 | + foreach ($ally_rights as $key => $value) |
|
1241 | 1241 | { |
1242 | 1242 | $ranks[$rank_id][$value] = $tmp[$key]; |
1243 | 1243 | } |
@@ -1247,14 +1247,14 @@ discard block |
||
1247 | 1247 | return $ranks; |
1248 | 1248 | } |
1249 | 1249 | |
1250 | -function sys_player_new_adjust($user_id, $planet_id){return sn_function_call('sys_player_new_adjust', array($user_id, $planet_id, &$result));} |
|
1250 | +function sys_player_new_adjust($user_id, $planet_id) {return sn_function_call('sys_player_new_adjust', array($user_id, $planet_id, &$result)); } |
|
1251 | 1251 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
1252 | 1252 | return $result; |
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | function array_merge_recursive_numeric($array1, $array2) { |
1256 | - if(!empty($array2) && is_array($array2)) { |
|
1257 | - foreach($array2 as $key => $value) { |
|
1256 | + if (!empty($array2) && is_array($array2)) { |
|
1257 | + foreach ($array2 as $key => $value) { |
|
1258 | 1258 | // if(!isset($array1[$key]) || !is_array($array1[$key])) { |
1259 | 1259 | // $array1[$key] = $value; |
1260 | 1260 | // } else { |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | function sn_sys_array_cumulative_sum(&$array) |
1271 | 1271 | { |
1272 | 1272 | $accum = 0; |
1273 | - foreach($array as &$value) |
|
1273 | + foreach ($array as &$value) |
|
1274 | 1274 | { |
1275 | 1275 | $accum += $value; |
1276 | 1276 | $value = $accum; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | $sn_data_density = sn_get_groups('planet_density'); |
1282 | 1282 | $density_price_chart = array(); |
1283 | 1283 | |
1284 | - foreach($sn_data_density as $density_id => $density_data) { |
|
1284 | + foreach ($sn_data_density as $density_id => $density_data) { |
|
1285 | 1285 | // Отсекаем записи с RARITY = 0 - служебные записи и супер-ядра |
1286 | 1286 | $density_data[UNIT_PLANET_DENSITY_RARITY] ? $density_price_chart[$density_id] = $density_data[UNIT_PLANET_DENSITY_RARITY] : false; |
1287 | 1287 | } |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | |
1290 | 1290 | $total_rarity = array_sum($density_price_chart); |
1291 | 1291 | |
1292 | - foreach($density_price_chart as &$density_data) { |
|
1292 | + foreach ($density_price_chart as &$density_data) { |
|
1293 | 1293 | $density_data = ceil($total_rarity / $density_data * $planet_row['field_max'] * PLANET_DENSITY_TO_DARK_MATTER_RATE); |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1297,18 +1297,18 @@ discard block |
||
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | function sn_sys_planet_core_transmute(&$user, &$planetrow) { |
1300 | - if(!sys_get_param_str('transmute')) { |
|
1300 | + if (!sys_get_param_str('transmute')) { |
|
1301 | 1301 | return array(); |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | global $lang; |
1305 | 1305 | |
1306 | 1306 | try { |
1307 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
1307 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
1308 | 1308 | throw new exception($lang['ov_core_err_not_a_planet'], ERR_ERROR); |
1309 | 1309 | } |
1310 | 1310 | |
1311 | - if($planetrow['density_index'] == ($new_density_index = sys_get_param_id('density_type'))) { |
|
1311 | + if ($planetrow['density_index'] == ($new_density_index = sys_get_param_id('density_type'))) { |
|
1312 | 1312 | throw new exception($lang['ov_core_err_same_density'], ERR_WARNING); |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | $planet_density_index = $planetrow['density_index']; |
1323 | 1323 | |
1324 | 1324 | $density_price_chart = planet_density_price_chart($planetrow); |
1325 | - if(!isset($density_price_chart[$new_density_index])) { |
|
1325 | + if (!isset($density_price_chart[$new_density_index])) { |
|
1326 | 1326 | // Hack attempt |
1327 | 1327 | throw new exception($lang['ov_core_err_denisty_type_wrong'], ERR_ERROR); |
1328 | 1328 | } |
@@ -1331,13 +1331,13 @@ discard block |
||
1331 | 1331 | // $transmute_cost = get_unit_param(UNIT_PLANET_DENSITY, 'cost'); |
1332 | 1332 | // $transmute_cost = $transmute_cost[RES_DARK_MATTER] * $density_price_chart[$new_density_index]; |
1333 | 1333 | $transmute_cost = $density_price_chart[$new_density_index]; |
1334 | - if($user_dark_matter < $transmute_cost) { |
|
1334 | + if ($user_dark_matter < $transmute_cost) { |
|
1335 | 1335 | throw new exception($lang['ov_core_err_no_dark_matter'], ERR_ERROR); |
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | $sn_data_planet_density = sn_get_groups('planet_density'); |
1339 | - foreach($sn_data_planet_density as $key => $value) { |
|
1340 | - if($key == $new_density_index) { |
|
1339 | + foreach ($sn_data_planet_density as $key => $value) { |
|
1340 | + if ($key == $new_density_index) { |
|
1341 | 1341 | break; |
1342 | 1342 | } |
1343 | 1343 | $prev_density_index = $key; |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | 'STATUS' => ERR_NONE, |
1369 | 1369 | 'MESSAGE' => sprintf($lang['ov_core_err_none'], $lang['uni_planet_density_types'][$planet_density_index], $lang['uni_planet_density_types'][$new_density_index], $new_density), |
1370 | 1370 | ); |
1371 | - } catch(exception $e) { |
|
1371 | + } catch (exception $e) { |
|
1372 | 1372 | sn_db_transaction_rollback(); |
1373 | 1373 | $result = array( |
1374 | 1374 | 'STATUS' => $e->getCode(), |
@@ -1384,9 +1384,9 @@ discard block |
||
1384 | 1384 | global $sn_module_list; |
1385 | 1385 | |
1386 | 1386 | $active_modules = 0; |
1387 | - if(isset($sn_module_list[$group]) && is_array($sn_module_list[$group])) |
|
1387 | + if (isset($sn_module_list[$group]) && is_array($sn_module_list[$group])) |
|
1388 | 1388 | { |
1389 | - foreach($sn_module_list[$group] as $payment_module) |
|
1389 | + foreach ($sn_module_list[$group] as $payment_module) |
|
1390 | 1390 | { |
1391 | 1391 | $active_modules += $payment_module->manifest['active']; |
1392 | 1392 | } |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | { |
1400 | 1400 | static $rates; |
1401 | 1401 | |
1402 | - if(!$rates) |
|
1402 | + if (!$rates) |
|
1403 | 1403 | { |
1404 | 1404 | global $config; |
1405 | 1405 | |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | RES_DARK_MATTER => 'rpg_exchange_darkMatter', |
1411 | 1411 | ); |
1412 | 1412 | |
1413 | - foreach($rates as &$rate) |
|
1413 | + foreach ($rates as &$rate) |
|
1414 | 1414 | { |
1415 | 1415 | $rate = classSupernova::$config->$rate; |
1416 | 1416 | } |
@@ -1423,13 +1423,13 @@ discard block |
||
1423 | 1423 | { |
1424 | 1424 | static $rates; |
1425 | 1425 | |
1426 | - if(!$rates) |
|
1426 | + if (!$rates) |
|
1427 | 1427 | { |
1428 | 1428 | $rates = get_resource_exchange(); |
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | $metal_cost = 0; |
1432 | - foreach($cost as $resource_id => $resource_value) |
|
1432 | + foreach ($cost as $resource_id => $resource_value) |
|
1433 | 1433 | { |
1434 | 1434 | $metal_cost += $rates[$resource_id] * $resource_value; |
1435 | 1435 | } |
@@ -1437,11 +1437,11 @@ discard block |
||
1437 | 1437 | return $metal_cost; |
1438 | 1438 | } |
1439 | 1439 | |
1440 | -function get_player_max_expeditons(&$user, $astrotech = -1){return sn_function_call('get_player_max_expeditons', array(&$user, $astrotech, &$result));} |
|
1440 | +function get_player_max_expeditons(&$user, $astrotech = -1) {return sn_function_call('get_player_max_expeditons', array(&$user, $astrotech, &$result)); } |
|
1441 | 1441 | function sn_get_player_max_expeditons(&$user, $astrotech = -1, &$result = 0) |
1442 | 1442 | { |
1443 | - if($astrotech == -1) { |
|
1444 | - if(!isset($user[UNIT_PLAYER_EXPEDITIONS_MAX])) |
|
1443 | + if ($astrotech == -1) { |
|
1444 | + if (!isset($user[UNIT_PLAYER_EXPEDITIONS_MAX])) |
|
1445 | 1445 | { |
1446 | 1446 | $astrotech = mrc_get_level($user, false, TECH_ASTROTECH); |
1447 | 1447 | $user[UNIT_PLAYER_EXPEDITIONS_MAX] = $astrotech >= 1 ? floor(sqrt($astrotech - 1)) : 0; |
@@ -1461,8 +1461,8 @@ discard block |
||
1461 | 1461 | function get_player_max_colonies(&$user, $astrotech = -1) { |
1462 | 1462 | global $config; |
1463 | 1463 | |
1464 | - if($astrotech == -1) { |
|
1465 | - if(!isset($user[UNIT_PLAYER_COLONIES_MAX])) { |
|
1464 | + if ($astrotech == -1) { |
|
1465 | + if (!isset($user[UNIT_PLAYER_COLONIES_MAX])) { |
|
1466 | 1466 | |
1467 | 1467 | $expeditions = get_player_max_expeditons($user); |
1468 | 1468 | $astrotech = mrc_get_level($user, false, TECH_ASTROTECH); |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | |
1498 | -function sn_powerup_get_price_matrix($powerup_id, $powerup_unit = false, $level_max = null, $plain = false){return sn_function_call('sn_powerup_get_price_matrix', array($powerup_id, $powerup_unit, $level_max, $plain, &$result));} |
|
1498 | +function sn_powerup_get_price_matrix($powerup_id, $powerup_unit = false, $level_max = null, $plain = false) {return sn_function_call('sn_powerup_get_price_matrix', array($powerup_id, $powerup_unit, $level_max, $plain, &$result)); } |
|
1499 | 1499 | function sn_sn_powerup_get_price_matrix($powerup_id, $powerup_unit = false, $level_max = null, $plain = false, &$result) { |
1500 | 1500 | global $sn_powerup_buy_discounts; |
1501 | 1501 | |
@@ -1505,10 +1505,10 @@ discard block |
||
1505 | 1505 | $is_upgrade = !empty($powerup_unit) && $powerup_unit; |
1506 | 1506 | |
1507 | 1507 | $level_current = $term_original = $time_left = 0; |
1508 | - if($is_upgrade) { |
|
1508 | + if ($is_upgrade) { |
|
1509 | 1509 | $time_finish = strtotime($powerup_unit['unit_time_finish']); |
1510 | 1510 | $time_left = max(0, $time_finish - SN_TIME_NOW); |
1511 | - if($time_left > 0) { |
|
1511 | + if ($time_left > 0) { |
|
1512 | 1512 | $term_original = $time_finish - strtotime($powerup_unit['unit_time_start']); |
1513 | 1513 | $level_current = $powerup_unit['unit_level']; |
1514 | 1514 | } |
@@ -1516,17 +1516,17 @@ discard block |
||
1516 | 1516 | |
1517 | 1517 | $level_max = $level_max > $powerup_data[P_MAX_STACK] ? $level_max : $powerup_data[P_MAX_STACK]; |
1518 | 1518 | $original_cost = 0; |
1519 | - for($i = 1; $i <= $level_max; $i++) { |
|
1519 | + for ($i = 1; $i <= $level_max; $i++) { |
|
1520 | 1520 | $base_cost = eco_get_total_cost($powerup_id, $i); |
1521 | 1521 | $base_cost = $base_cost[BUILD_CREATE][RES_DARK_MATTER]; |
1522 | - foreach($sn_powerup_buy_discounts as $period => $discount) { |
|
1522 | + foreach ($sn_powerup_buy_discounts as $period => $discount) { |
|
1523 | 1523 | $upgrade_price = floor($base_cost * $discount * $period / PERIOD_MONTH); |
1524 | 1524 | $result[$i][$period] = $upgrade_price; |
1525 | 1525 | $original_cost = $is_upgrade && $i == $level_current && $period <= $term_original ? $upgrade_price : $original_cost; |
1526 | 1526 | } |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - if($is_upgrade && $time_left) { |
|
1529 | + if ($is_upgrade && $time_left) { |
|
1530 | 1530 | $term_original = round($term_original / PERIOD_DAY); |
1531 | 1531 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
1532 | 1532 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
@@ -1587,14 +1587,14 @@ discard block |
||
1587 | 1587 | |
1588 | 1588 | function print_rr($var, $capture = false) { |
1589 | 1589 | $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>'; |
1590 | - if($capture) { |
|
1590 | + if ($capture) { |
|
1591 | 1591 | return $print; |
1592 | 1592 | } else { |
1593 | 1593 | print($print); |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | |
1597 | -function can_capture_planet(){return sn_function_call('can_capture_planet', array(&$result));} |
|
1597 | +function can_capture_planet() {return sn_function_call('can_capture_planet', array(&$result)); } |
|
1598 | 1598 | function sn_can_capture_planet(&$result) { |
1599 | 1599 | return $result = false; |
1600 | 1600 | } |
@@ -1625,9 +1625,9 @@ discard block |
||
1625 | 1625 | |
1626 | 1626 | function price_matrix_templatize(&$price_matrix_plain, &$price_matrix_original, &$price_matrix_upgrade, $user_dark_matter) { |
1627 | 1627 | $prices = array(); |
1628 | - foreach($price_matrix_original as $level_num => $level_data) { |
|
1628 | + foreach ($price_matrix_original as $level_num => $level_data) { |
|
1629 | 1629 | $price_per_period = array(); |
1630 | - foreach($level_data as $period => $price) { |
|
1630 | + foreach ($level_data as $period => $price) { |
|
1631 | 1631 | $price_text = pretty_number($price, true, $user_dark_matter, false, false); |
1632 | 1632 | $price_per_period[$period] = array( |
1633 | 1633 | 'PERIOD' => $period, |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | 'PRICE_UPGRADE' => $price_matrix_upgrade[$level_num][$period], |
1638 | 1638 | 'PRICE_UPGRADE_TEXT' => pretty_number($price_matrix_upgrade[$level_num][$period], true), |
1639 | 1639 | ); |
1640 | - if(isset($price_matrix_plain[$level_num][$period])) { |
|
1640 | + if (isset($price_matrix_plain[$level_num][$period])) { |
|
1641 | 1641 | $price_per_period[$period] += array( |
1642 | 1642 | 'PRICE_PLAIN_PERCENT' => ceil(100 - ($price / $price_matrix_plain[$level_num][$period]) * 100), |
1643 | 1643 | 'PRICE_PLAIN' => $price_matrix_plain[$level_num][$period], |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | require_once('general/math.php'); |
12 | 12 | require_once('general_pname.php'); |
13 | 13 | |
14 | -function sn_function_call($func_name, $func_arg = array()) |
|
15 | -{ |
|
14 | +function sn_function_call($func_name, $func_arg = array()) { |
|
16 | 15 | global $functions; // All data in $functions should be normalized to valid 'callable' state: '<function_name>'|array('<object_name>', '<method_name>') |
17 | 16 | |
18 | 17 | if(is_array($functions[$func_name]) && !is_callable($functions[$func_name])) |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | $result = call_user_func_array($func_chain_name, $func_arg); |
33 | 32 | } |
34 | 33 | } |
35 | - } |
|
36 | - else |
|
34 | + } else |
|
37 | 35 | { |
38 | 36 | // TODO: This is left for backward compatibility. Appropriate code should be rewrote! |
39 | 37 | $func_name = isset($functions[$func_name]) && is_callable($functions[$func_name]) ? $functions[$func_name] : ('sn_' . $func_name); |
@@ -64,13 +62,11 @@ discard block |
||
64 | 62 | |
65 | 63 | // ---------------------------------------------------------------------------------------------------------------- |
66 | 64 | // Fonction de lecture / ecriture / exploitation de templates |
67 | -function sys_file_read($filename) |
|
68 | -{ |
|
65 | +function sys_file_read($filename) { |
|
69 | 66 | return @file_get_contents($filename); |
70 | 67 | } |
71 | 68 | |
72 | -function sys_file_write($filename, $content) |
|
73 | -{ |
|
69 | +function sys_file_write($filename, $content) { |
|
74 | 70 | return @file_put_contents($filename, $content, FILE_APPEND); |
75 | 71 | } |
76 | 72 | |
@@ -149,19 +145,16 @@ discard block |
||
149 | 145 | false - return array('text' => $ret, 'class' => $class), where $ret - unstyled |
150 | 146 | */ |
151 | 147 | |
152 | -function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) |
|
153 | -{ |
|
148 | +function pretty_number($n, $floor = true, $color = false, $limit = false, $style = null) { |
|
154 | 149 | $n = floatval($n); |
155 | 150 | if(is_int($floor)) |
156 | 151 | { |
157 | 152 | $n = round($n, $floor); // , PHP_ROUND_HALF_DOWN |
158 | - } |
|
159 | - elseif($floor === true) |
|
153 | + } elseif($floor === true) |
|
160 | 154 | { |
161 | 155 | $n = floor($n); |
162 | 156 | $floor = 0; |
163 | - } |
|
164 | - else |
|
157 | + } else |
|
165 | 158 | { |
166 | 159 | $floor = 2; |
167 | 160 | } |
@@ -178,8 +171,7 @@ discard block |
||
178 | 171 | $suffix .= 'k'; |
179 | 172 | $ret = round($ret / 1000); |
180 | 173 | } |
181 | - } |
|
182 | - else |
|
174 | + } else |
|
183 | 175 | { |
184 | 176 | while($ret < -$limit) |
185 | 177 | { |
@@ -197,12 +189,10 @@ discard block |
||
197 | 189 | if($color === true) |
198 | 190 | { |
199 | 191 | $class = $n == 0 ? 'zero' : ($n > 0 ? 'positive' : 'negative'); |
200 | - } |
|
201 | - elseif($color >= 0) |
|
192 | + } elseif($color >= 0) |
|
202 | 193 | { |
203 | 194 | $class = $n == $color ? 'zero' : ($n < $color ? 'positive' : 'negative'); |
204 | - } |
|
205 | - else |
|
195 | + } else |
|
206 | 196 | { |
207 | 197 | $class = ($n == -$color) ? 'zero' : ($n < -$color ? 'negative' : 'positive'); |
208 | 198 | } |
@@ -210,8 +200,7 @@ discard block |
||
210 | 200 | if(!isset($style)) |
211 | 201 | { |
212 | 202 | $ret = "<span class='{$class}'>{$ret}</span>"; |
213 | - } |
|
214 | - else |
|
203 | + } else |
|
215 | 204 | { |
216 | 205 | $ret = $style ? $ret = $class : $ret = array('text' => $ret, 'class' => $class); |
217 | 206 | } |
@@ -259,8 +248,7 @@ discard block |
||
259 | 248 | // ---------------------------------------------------------------------------------------------------------------- |
260 | 249 | // Check input string for forbidden words |
261 | 250 | // |
262 | -function CheckInputStrings($String) |
|
263 | -{ |
|
251 | +function CheckInputStrings($String) { |
|
264 | 252 | global $ListCensure; |
265 | 253 | |
266 | 254 | return preg_replace($ListCensure, '*', $String); |
@@ -270,8 +258,7 @@ discard block |
||
270 | 258 | return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)); |
271 | 259 | } |
272 | 260 | |
273 | -function is_id($value) |
|
274 | -{ |
|
261 | +function is_id($value) { |
|
275 | 262 | return preg_match('/^\d+$/', $value) && ($value >= 0); |
276 | 263 | } |
277 | 264 | |
@@ -281,29 +268,24 @@ discard block |
||
281 | 268 | * |
282 | 269 | * @return string|array |
283 | 270 | */ |
284 | -function sys_get_param($param_name, $default = '') |
|
285 | -{ |
|
271 | +function sys_get_param($param_name, $default = '') { |
|
286 | 272 | return $_POST[$param_name] !== NULL ? $_POST[$param_name] : ($_GET[$param_name] !== NULL ? $_GET[$param_name] : $default); |
287 | 273 | } |
288 | 274 | |
289 | -function sys_get_param_id($param_name, $default = 0) |
|
290 | -{ |
|
275 | +function sys_get_param_id($param_name, $default = 0) { |
|
291 | 276 | return is_id($value = sys_get_param($param_name, $default)) ? $value : $default; |
292 | 277 | } |
293 | 278 | |
294 | -function sys_get_param_int($param_name, $default = 0) |
|
295 | -{ |
|
279 | +function sys_get_param_int($param_name, $default = 0) { |
|
296 | 280 | $value = sys_get_param($param_name, $default); |
297 | 281 | return $value === 'on' ? 1 : ($value === 'off' ? $default : intval($value)); |
298 | 282 | } |
299 | 283 | |
300 | -function sys_get_param_float($param_name, $default = 0) |
|
301 | -{ |
|
284 | +function sys_get_param_float($param_name, $default = 0) { |
|
302 | 285 | return floatval(sys_get_param($param_name, $default)); |
303 | 286 | } |
304 | 287 | |
305 | -function sys_get_param_escaped($param_name, $default = '') |
|
306 | -{ |
|
288 | +function sys_get_param_escaped($param_name, $default = '') { |
|
307 | 289 | return db_escape(sys_get_param($param_name, $default)); |
308 | 290 | } |
309 | 291 | /* |
@@ -312,24 +294,20 @@ discard block |
||
312 | 294 | return db_escape(strip_tags(sys_get_param($param_name, $default))); |
313 | 295 | } |
314 | 296 | */ |
315 | -function sys_get_param_date_sql($param_name, $default = '2000-01-01') |
|
316 | -{ |
|
297 | +function sys_get_param_date_sql($param_name, $default = '2000-01-01') { |
|
317 | 298 | $val = sys_get_param($param_name, $default); |
318 | 299 | return preg_match(PREG_DATE_SQL_RELAXED, $val) ? $val : $default; |
319 | 300 | } |
320 | 301 | |
321 | -function sys_get_param_str_unsafe($param_name, $default = '') |
|
322 | -{ |
|
302 | +function sys_get_param_str_unsafe($param_name, $default = '') { |
|
323 | 303 | return str_raw2unsafe(sys_get_param($param_name, $default)); |
324 | 304 | } |
325 | 305 | |
326 | -function sys_get_param_str($param_name, $default = '') |
|
327 | -{ |
|
306 | +function sys_get_param_str($param_name, $default = '') { |
|
328 | 307 | return db_escape(sys_get_param_str_unsafe($param_name, $default)); |
329 | 308 | } |
330 | 309 | |
331 | -function sys_get_param_str_both($param_name, $default = '') |
|
332 | -{ |
|
310 | +function sys_get_param_str_both($param_name, $default = '') { |
|
333 | 311 | $param = sys_get_param($param_name, $default); |
334 | 312 | $param_unsafe = str_raw2unsafe($param); |
335 | 313 | return array( |
@@ -339,8 +317,7 @@ discard block |
||
339 | 317 | ); |
340 | 318 | } |
341 | 319 | |
342 | -function sys_get_param_phone($param_name, $default = '') |
|
343 | -{ |
|
320 | +function sys_get_param_phone($param_name, $default = '') { |
|
344 | 321 | $phone_raw = sys_get_param_str_unsafe($param_name, $default = ''); |
345 | 322 | if($phone_raw) |
346 | 323 | { |
@@ -354,8 +331,7 @@ discard block |
||
354 | 331 | } |
355 | 332 | } |
356 | 333 | $phone = strlen($phone) < 11 ? '' : $phone; |
357 | - } |
|
358 | - else |
|
334 | + } else |
|
359 | 335 | { |
360 | 336 | $phone = ''; |
361 | 337 | } |
@@ -363,21 +339,18 @@ discard block |
||
363 | 339 | return array('raw' => $phone_raw, 'phone' => $phone); |
364 | 340 | } |
365 | 341 | |
366 | -function GetPhalanxRange($phalanx_level) |
|
367 | -{ |
|
342 | +function GetPhalanxRange($phalanx_level) { |
|
368 | 343 | return $phalanx_level > 1 ? pow($phalanx_level, 2) - 1 : 0; |
369 | 344 | } |
370 | 345 | |
371 | -function CheckAbandonPlanetState(&$planet) |
|
372 | -{ |
|
346 | +function CheckAbandonPlanetState(&$planet) { |
|
373 | 347 | if($planet['destruyed'] && $planet['destruyed'] <= SN_TIME_NOW) |
374 | 348 | { |
375 | 349 | DBStaticPlanet::db_planet_delete_by_id($planet['id']); |
376 | 350 | } |
377 | 351 | } |
378 | 352 | |
379 | -function eco_get_total_cost($unit_id, $unit_level) |
|
380 | -{ |
|
353 | +function eco_get_total_cost($unit_id, $unit_level) { |
|
381 | 354 | global $config; |
382 | 355 | |
383 | 356 | static $rate, $sn_group_resources_all, $sn_group_resources_loot; |
@@ -502,8 +475,7 @@ discard block |
||
502 | 475 | } |
503 | 476 | |
504 | 477 | function mrc_modify_value(&$user, $planet = array(), $mercenaries, $value) {return sn_function_call('mrc_modify_value', array(&$user, $planet, $mercenaries, $value));} |
505 | -function sn_mrc_modify_value(&$user, $planet = array(), $mercenaries, $value, $base_value = null) |
|
506 | -{ |
|
478 | +function sn_mrc_modify_value(&$user, $planet = array(), $mercenaries, $value, $base_value = null) { |
|
507 | 479 | if(!is_array($mercenaries)) |
508 | 480 | { |
509 | 481 | $mercenaries = array($mercenaries); |
@@ -557,18 +529,15 @@ discard block |
||
557 | 529 | return $random_string; |
558 | 530 | } |
559 | 531 | |
560 | -function js_safe_string($string) |
|
561 | -{ |
|
532 | +function js_safe_string($string) { |
|
562 | 533 | return str_replace(array("\r", "\n"), array('\r', '\n'), addslashes($string)); |
563 | 534 | } |
564 | 535 | |
565 | -function sys_safe_output($string) |
|
566 | -{ |
|
536 | +function sys_safe_output($string) { |
|
567 | 537 | return str_replace(array("&", "\"", "<", ">", "'"), array("&", """, "<", ">", "'"), $string); |
568 | 538 | } |
569 | 539 | |
570 | -function sys_user_options_pack(&$user) |
|
571 | -{ |
|
540 | +function sys_user_options_pack(&$user) { |
|
572 | 541 | global $user_option_list; |
573 | 542 | |
574 | 543 | $options = ''; |
@@ -595,8 +564,7 @@ discard block |
||
595 | 564 | return $options; |
596 | 565 | } |
597 | 566 | |
598 | -function sys_user_options_unpack(&$user) |
|
599 | -{ |
|
567 | +function sys_user_options_unpack(&$user) { |
|
600 | 568 | global $user_option_list; |
601 | 569 | |
602 | 570 | $option_list = array(); |
@@ -627,8 +595,7 @@ discard block |
||
627 | 595 | return $final_list; |
628 | 596 | } |
629 | 597 | |
630 | -function sys_unit_str2arr($fleet_string) |
|
631 | -{ |
|
598 | +function sys_unit_str2arr($fleet_string) { |
|
632 | 599 | $fleet_array = array(); |
633 | 600 | if(!empty($fleet_string)) |
634 | 601 | { |
@@ -649,8 +616,7 @@ discard block |
||
649 | 616 | return $fleet_array; |
650 | 617 | } |
651 | 618 | |
652 | -function sys_unit_arr2str($unit_list) |
|
653 | -{ |
|
619 | +function sys_unit_arr2str($unit_list) { |
|
654 | 620 | $fleet_string = array(); |
655 | 621 | if(isset($unit_list)) |
656 | 622 | { |
@@ -698,8 +664,7 @@ discard block |
||
698 | 664 | return @mail($email_unsafe, $title, $body, $head); |
699 | 665 | } |
700 | 666 | |
701 | -function sys_time_human($time, $full = false) |
|
702 | -{ |
|
667 | +function sys_time_human($time, $full = false) { |
|
703 | 668 | global $lang; |
704 | 669 | |
705 | 670 | $seconds = $time % 60; |
@@ -720,8 +685,7 @@ discard block |
||
720 | 685 | return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}'; |
721 | 686 | } |
722 | 687 | |
723 | -function sys_redirect($url) |
|
724 | -{ |
|
688 | +function sys_redirect($url) { |
|
725 | 689 | header("Location: {$url}"); |
726 | 690 | ob_end_flush(); |
727 | 691 | die(); |
@@ -729,8 +693,7 @@ discard block |
||
729 | 693 | |
730 | 694 | // TODO Для полноценного функионирования апдейтера пакет функций, включая эту должен быть вынесен раньше - или грузить general.php до апдейтера |
731 | 695 | function sys_get_unit_location($user, $planet, $unit_id){return sn_function_call('sys_get_unit_location', array($user, $planet, $unit_id));} |
732 | -function sn_sys_get_unit_location($user, $planet, $unit_id) |
|
733 | -{ |
|
696 | +function sn_sys_get_unit_location($user, $planet, $unit_id) { |
|
734 | 697 | return get_unit_param($unit_id, 'location'); |
735 | 698 | } |
736 | 699 | |
@@ -748,8 +711,7 @@ discard block |
||
748 | 711 | } |
749 | 712 | } |
750 | 713 | |
751 | -function sn_get_url_contents($url) |
|
752 | -{ |
|
714 | +function sn_get_url_contents($url) { |
|
753 | 715 | if(function_exists('curl_init')) |
754 | 716 | { |
755 | 717 | $crl = curl_init(); |
@@ -759,8 +721,7 @@ discard block |
||
759 | 721 | curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); |
760 | 722 | $return = curl_exec($crl); |
761 | 723 | curl_close($crl); |
762 | - } |
|
763 | - else |
|
724 | + } else |
|
764 | 725 | { |
765 | 726 | $return = @file_get_contents($url); |
766 | 727 | } |
@@ -768,8 +729,7 @@ discard block |
||
768 | 729 | return $return; |
769 | 730 | } |
770 | 731 | |
771 | -function get_engine_data($user, $engine_info) |
|
772 | -{ |
|
732 | +function get_engine_data($user, $engine_info) { |
|
773 | 733 | $sn_data_tech_bonus = get_unit_param($engine_info['tech'], 'bonus'); |
774 | 734 | |
775 | 735 | $user_tech_level = intval(mrc_get_level($user, false, $engine_info['tech'])); |
@@ -787,8 +747,7 @@ discard block |
||
787 | 747 | return $engine_info; |
788 | 748 | } |
789 | 749 | |
790 | -function get_ship_data($ship_id, $user) |
|
791 | -{ |
|
750 | +function get_ship_data($ship_id, $user) { |
|
792 | 751 | $ship_data = array(); |
793 | 752 | if(in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) |
794 | 753 | { |
@@ -810,8 +769,7 @@ discard block |
||
810 | 769 | |
811 | 770 | if(!function_exists('strptime')) |
812 | 771 | { |
813 | - function strptime($date, $format) |
|
814 | - { |
|
772 | + function strptime($date, $format) { |
|
815 | 773 | $masks = array( |
816 | 774 | '%d' => '(?P<d>[0-9]{2})', |
817 | 775 | '%m' => '(?P<m>[0-9]{2})', |
@@ -833,8 +791,7 @@ discard block |
||
833 | 791 | "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, |
834 | 792 | "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0, |
835 | 793 | ); |
836 | - } |
|
837 | - else |
|
794 | + } else |
|
838 | 795 | { |
839 | 796 | $ret = false; |
840 | 797 | } |
@@ -874,8 +831,7 @@ discard block |
||
874 | 831 | sys_redirect($redirect); |
875 | 832 | } |
876 | 833 | |
877 | -function sn_sys_handler_add(&$functions, $handler_list, $class_module_name = '', $sub_type = '') |
|
878 | -{ |
|
834 | +function sn_sys_handler_add(&$functions, $handler_list, $class_module_name = '', $sub_type = '') { |
|
879 | 835 | if(isset($handler_list) && is_array($handler_list) && !empty($handler_list)) |
880 | 836 | { |
881 | 837 | foreach($handler_list as $function_name => $function_data) |
@@ -883,8 +839,7 @@ discard block |
||
883 | 839 | if(is_string($function_data)) |
884 | 840 | { |
885 | 841 | $override_with = &$function_data; |
886 | - } |
|
887 | - elseif(isset($function_data['callable'])) |
|
842 | + } elseif(isset($function_data['callable'])) |
|
888 | 843 | { |
889 | 844 | $override_with = &$function_data['callable']; |
890 | 845 | } |
@@ -898,12 +853,10 @@ discard block |
||
898 | 853 | if(($point_position = strpos($override_with, '.')) === false && $class_module_name) |
899 | 854 | { |
900 | 855 | $override_with = array($class_module_name, $override_with); |
901 | - } |
|
902 | - elseif($point_position == 0) |
|
856 | + } elseif($point_position == 0) |
|
903 | 857 | { |
904 | 858 | $override_with = substr($override_with, 1); |
905 | - } |
|
906 | - elseif($point_position > 0) |
|
859 | + } elseif($point_position > 0) |
|
907 | 860 | { |
908 | 861 | $override_with = array(substr($override_with, 0, $point_position), substr($override_with, $point_position + 1)); |
909 | 862 | } |
@@ -911,8 +864,7 @@ discard block |
||
911 | 864 | if($overwrite) |
912 | 865 | { |
913 | 866 | $functions[$function_name] = array(); |
914 | - } |
|
915 | - elseif(!isset($functions[$function_name])) |
|
867 | + } elseif(!isset($functions[$function_name])) |
|
916 | 868 | { |
917 | 869 | $functions[$function_name] = array(); |
918 | 870 | $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : ''); |
@@ -929,7 +881,7 @@ discard block |
||
929 | 881 | |
930 | 882 | // TODO - поменять название |
931 | 883 | // Может принимать: (array)$user, $nick_render_array, $nick_render_array_html, $nick_render_string_compact |
932 | -function player_nick_render_to_html($result, $options = false){ |
|
884 | +function player_nick_render_to_html($result, $options = false) { |
|
933 | 885 | // TODO - обрабатывать разные случаи: $user, $render_nick_array, $string |
934 | 886 | |
935 | 887 | if(is_string($result) && strpos($result, ':{i:')) { |
@@ -1150,8 +1102,7 @@ discard block |
||
1150 | 1102 | // function sn_render_player_nick($render_user, $options = false, &$result) |
1151 | 1103 | |
1152 | 1104 | function get_unit_param($unit_id, $param_name = null, $user = null, $planet = null){return sn_function_call('get_unit_param', array($unit_id, $param_name, $user, $planet, &$result));} |
1153 | -function sn_get_unit_param($unit_id, $param_name = null, $user = null, $planet = null, &$result) |
|
1154 | -{ |
|
1105 | +function sn_get_unit_param($unit_id, $param_name = null, $user = null, $planet = null, &$result) { |
|
1155 | 1106 | global $sn_data; |
1156 | 1107 | |
1157 | 1108 | $result = isset($sn_data[$unit_id]) |
@@ -1165,8 +1116,7 @@ discard block |
||
1165 | 1116 | } |
1166 | 1117 | |
1167 | 1118 | function sn_get_groups($groups){return sn_function_call('sn_get_groups', array($groups, &$result));} |
1168 | -function sn_sn_get_groups($groups, &$result) |
|
1169 | -{ |
|
1119 | +function sn_sn_get_groups($groups, &$result) { |
|
1170 | 1120 | $result = is_array($result) ? $result : array(); |
1171 | 1121 | foreach($groups = is_array($groups) ? $groups : array($groups) as $group_name) |
1172 | 1122 | { |
@@ -1183,15 +1133,13 @@ discard block |
||
1183 | 1133 | * |
1184 | 1134 | * @return float|int |
1185 | 1135 | */ |
1186 | -function idval($value, $default = 0) |
|
1187 | -{ |
|
1136 | +function idval($value, $default = 0) { |
|
1188 | 1137 | $value = floatval($value); |
1189 | 1138 | return preg_match('#^(\d*)#', $value, $matches) && $matches[1] ? floatval($matches[1]) : $default; |
1190 | 1139 | } |
1191 | 1140 | |
1192 | 1141 | function unit_requirements_render($user, $planetrow, $unit_id, $field = 'require'){return sn_function_call('unit_requirements_render', array($user, $planetrow, $unit_id, $field, &$result));} |
1193 | -function sn_unit_requirements_render($user, $planetrow, $unit_id, $field = 'require', &$result) |
|
1194 | -{ |
|
1142 | +function sn_unit_requirements_render($user, $planetrow, $unit_id, $field = 'require', &$result) { |
|
1195 | 1143 | global $lang, $config; |
1196 | 1144 | |
1197 | 1145 | $sn_data_unit = get_unit_param($unit_id); |
@@ -1219,8 +1167,7 @@ discard block |
||
1219 | 1167 | return $result; |
1220 | 1168 | } |
1221 | 1169 | |
1222 | -function ally_get_ranks(&$ally) |
|
1223 | -{ |
|
1170 | +function ally_get_ranks(&$ally) { |
|
1224 | 1171 | global $ally_rights; |
1225 | 1172 | |
1226 | 1173 | $ranks = array(); |
@@ -1267,8 +1214,7 @@ discard block |
||
1267 | 1214 | return $array1; |
1268 | 1215 | } |
1269 | 1216 | |
1270 | -function sn_sys_array_cumulative_sum(&$array) |
|
1271 | -{ |
|
1217 | +function sn_sys_array_cumulative_sum(&$array) { |
|
1272 | 1218 | $accum = 0; |
1273 | 1219 | foreach($array as &$value) |
1274 | 1220 | { |
@@ -1379,8 +1325,7 @@ discard block |
||
1379 | 1325 | return $result; |
1380 | 1326 | } |
1381 | 1327 | |
1382 | -function sn_module_get_active_count($group = '*') |
|
1383 | -{ |
|
1328 | +function sn_module_get_active_count($group = '*') { |
|
1384 | 1329 | global $sn_module_list; |
1385 | 1330 | |
1386 | 1331 | $active_modules = 0; |
@@ -1395,8 +1340,7 @@ discard block |
||
1395 | 1340 | return $active_modules; |
1396 | 1341 | } |
1397 | 1342 | |
1398 | -function get_resource_exchange() |
|
1399 | -{ |
|
1343 | +function get_resource_exchange() { |
|
1400 | 1344 | static $rates; |
1401 | 1345 | |
1402 | 1346 | if(!$rates) |
@@ -1419,8 +1363,7 @@ discard block |
||
1419 | 1363 | return $rates; |
1420 | 1364 | } |
1421 | 1365 | |
1422 | -function get_unit_cost_in(&$cost, $in_resource = RES_METAL) |
|
1423 | -{ |
|
1366 | +function get_unit_cost_in(&$cost, $in_resource = RES_METAL) { |
|
1424 | 1367 | static $rates; |
1425 | 1368 | |
1426 | 1369 | if(!$rates) |
@@ -1438,8 +1381,7 @@ discard block |
||
1438 | 1381 | } |
1439 | 1382 | |
1440 | 1383 | function get_player_max_expeditons(&$user, $astrotech = -1){return sn_function_call('get_player_max_expeditons', array(&$user, $astrotech, &$result));} |
1441 | -function sn_get_player_max_expeditons(&$user, $astrotech = -1, &$result = 0) |
|
1442 | -{ |
|
1384 | +function sn_get_player_max_expeditons(&$user, $astrotech = -1, &$result = 0) { |
|
1443 | 1385 | if($astrotech == -1) { |
1444 | 1386 | if(!isset($user[UNIT_PLAYER_EXPEDITIONS_MAX])) |
1445 | 1387 | { |
@@ -1453,8 +1395,7 @@ discard block |
||
1453 | 1395 | } |
1454 | 1396 | } |
1455 | 1397 | |
1456 | -function get_player_max_expedition_duration(&$user, $astrotech = -1) |
|
1457 | -{ |
|
1398 | +function get_player_max_expedition_duration(&$user, $astrotech = -1) { |
|
1458 | 1399 | return $astrotech == -1 ? mrc_get_level($user, false, TECH_ASTROTECH) : $astrotech; |
1459 | 1400 | } |
1460 | 1401 | |
@@ -1481,8 +1422,7 @@ discard block |
||
1481 | 1422 | } |
1482 | 1423 | } |
1483 | 1424 | |
1484 | -function get_player_current_colonies(&$user) |
|
1485 | -{ |
|
1425 | +function get_player_current_colonies(&$user) { |
|
1486 | 1426 | return $user[UNIT_PLAYER_COLONIES_CURRENT] = isset($user[UNIT_PLAYER_COLONIES_CURRENT]) ? $user[UNIT_PLAYER_COLONIES_CURRENT] : max(0, DBStaticPlanet::db_planet_count_by_type($user['id']) - 1); |
1487 | 1427 | } |
1488 | 1428 |
@@ -283,7 +283,7 @@ |
||
283 | 283 | */ |
284 | 284 | function sys_get_param($param_name, $default = '') |
285 | 285 | { |
286 | - return $_POST[$param_name] !== NULL ? $_POST[$param_name] : ($_GET[$param_name] !== NULL ? $_GET[$param_name] : $default); |
|
286 | + return $_POST[$param_name] !== null ? $_POST[$param_name] : ($_GET[$param_name] !== null ? $_GET[$param_name] : $default); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | function sys_get_param_id($param_name, $default = 0) |
@@ -16,23 +16,23 @@ discard block |
||
16 | 16 | $sn_menu_admin_extra = array(); |
17 | 17 | |
18 | 18 | $sn_mvc = array( |
19 | - 'model' => array( |
|
20 | - 'options' => array('sn_options_model'), |
|
21 | - 'chat' => array('sn_chat_model'), |
|
22 | - 'chat_add' => array('sn_chat_add_model'), |
|
23 | - ), |
|
24 | - 'view' => array( |
|
25 | - 'options' => array('sn_options_view'), |
|
26 | - 'chat' => array('sn_chat_view'), |
|
27 | - 'chat_msg' => array('sn_chat_msg_view'), |
|
28 | - ), |
|
29 | - 'controller' => array(), |
|
30 | - 'i18n' => array( |
|
31 | - 'options' => array( |
|
32 | - 'options' => 'options', |
|
33 | - 'messages' => 'messages', |
|
34 | - ), |
|
35 | - ), |
|
19 | + 'model' => array( |
|
20 | + 'options' => array('sn_options_model'), |
|
21 | + 'chat' => array('sn_chat_model'), |
|
22 | + 'chat_add' => array('sn_chat_add_model'), |
|
23 | + ), |
|
24 | + 'view' => array( |
|
25 | + 'options' => array('sn_options_view'), |
|
26 | + 'chat' => array('sn_chat_view'), |
|
27 | + 'chat_msg' => array('sn_chat_msg_view'), |
|
28 | + ), |
|
29 | + 'controller' => array(), |
|
30 | + 'i18n' => array( |
|
31 | + 'options' => array( |
|
32 | + 'options' => 'options', |
|
33 | + 'messages' => 'messages', |
|
34 | + ), |
|
35 | + ), |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | $note_priority_classes = array( |
@@ -120,62 +120,62 @@ discard block |
||
120 | 120 | ); |
121 | 121 | |
122 | 122 | $sn_message_class_list = array( |
123 | - MSG_TYPE_NEW => array( |
|
124 | - 'name' => 'new_message', |
|
125 | - 'switchable' => false, |
|
126 | - 'email' => false, |
|
127 | - ), |
|
128 | - MSG_TYPE_ADMIN => array( |
|
129 | - 'name' => 'msg_admin', |
|
130 | - 'switchable' => false, |
|
131 | - 'email' => true, |
|
132 | - ), |
|
133 | - MSG_TYPE_PLAYER => array( |
|
134 | - 'name' => 'mnl_joueur', |
|
135 | - 'switchable' => false, |
|
136 | - 'email' => true, |
|
137 | - ), |
|
138 | - MSG_TYPE_ALLIANCE => array( |
|
139 | - 'name' => 'mnl_alliance', |
|
140 | - 'switchable' => false, |
|
141 | - 'email' => true, |
|
142 | - ), |
|
143 | - MSG_TYPE_SPY => array( |
|
144 | - 'name' => 'mnl_spy', |
|
145 | - 'switchable' => true, |
|
146 | - 'email' => true, |
|
147 | - ), |
|
148 | - MSG_TYPE_COMBAT => array( |
|
149 | - 'name' => 'mnl_attaque', |
|
150 | - 'switchable' => true, |
|
151 | - 'email' => true, |
|
152 | - ), |
|
153 | - MSG_TYPE_TRANSPORT => array( |
|
154 | - 'name' => 'mnl_transport', |
|
155 | - 'switchable' => true, |
|
156 | - 'email' => true, |
|
157 | - ), |
|
158 | - MSG_TYPE_RECYCLE => array( |
|
159 | - 'name' => 'mnl_exploit', |
|
160 | - 'switchable' => true, |
|
161 | - 'email' => true, |
|
162 | - ), |
|
163 | - MSG_TYPE_EXPLORE => array( |
|
164 | - 'name' => 'mnl_expedition', |
|
165 | - 'switchable' => true, |
|
166 | - 'email' => true, |
|
167 | - ), |
|
168 | - // 97 => 'mnl_general', |
|
169 | - MSG_TYPE_QUE => array( |
|
170 | - 'name' => 'mnl_buildlist', |
|
171 | - 'switchable' => true, |
|
172 | - 'email' => true, |
|
173 | - ), |
|
174 | - MSG_TYPE_OUTBOX => array( |
|
175 | - 'name' => 'mnl_outbox', |
|
176 | - 'switchable' => false, |
|
177 | - 'email' => false, |
|
178 | - ), |
|
123 | + MSG_TYPE_NEW => array( |
|
124 | + 'name' => 'new_message', |
|
125 | + 'switchable' => false, |
|
126 | + 'email' => false, |
|
127 | + ), |
|
128 | + MSG_TYPE_ADMIN => array( |
|
129 | + 'name' => 'msg_admin', |
|
130 | + 'switchable' => false, |
|
131 | + 'email' => true, |
|
132 | + ), |
|
133 | + MSG_TYPE_PLAYER => array( |
|
134 | + 'name' => 'mnl_joueur', |
|
135 | + 'switchable' => false, |
|
136 | + 'email' => true, |
|
137 | + ), |
|
138 | + MSG_TYPE_ALLIANCE => array( |
|
139 | + 'name' => 'mnl_alliance', |
|
140 | + 'switchable' => false, |
|
141 | + 'email' => true, |
|
142 | + ), |
|
143 | + MSG_TYPE_SPY => array( |
|
144 | + 'name' => 'mnl_spy', |
|
145 | + 'switchable' => true, |
|
146 | + 'email' => true, |
|
147 | + ), |
|
148 | + MSG_TYPE_COMBAT => array( |
|
149 | + 'name' => 'mnl_attaque', |
|
150 | + 'switchable' => true, |
|
151 | + 'email' => true, |
|
152 | + ), |
|
153 | + MSG_TYPE_TRANSPORT => array( |
|
154 | + 'name' => 'mnl_transport', |
|
155 | + 'switchable' => true, |
|
156 | + 'email' => true, |
|
157 | + ), |
|
158 | + MSG_TYPE_RECYCLE => array( |
|
159 | + 'name' => 'mnl_exploit', |
|
160 | + 'switchable' => true, |
|
161 | + 'email' => true, |
|
162 | + ), |
|
163 | + MSG_TYPE_EXPLORE => array( |
|
164 | + 'name' => 'mnl_expedition', |
|
165 | + 'switchable' => true, |
|
166 | + 'email' => true, |
|
167 | + ), |
|
168 | + // 97 => 'mnl_general', |
|
169 | + MSG_TYPE_QUE => array( |
|
170 | + 'name' => 'mnl_buildlist', |
|
171 | + 'switchable' => true, |
|
172 | + 'email' => true, |
|
173 | + ), |
|
174 | + MSG_TYPE_OUTBOX => array( |
|
175 | + 'name' => 'mnl_outbox', |
|
176 | + 'switchable' => false, |
|
177 | + 'email' => false, |
|
178 | + ), |
|
179 | 179 | ); |
180 | 180 | |
181 | 181 | $sn_message_groups = array( |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | SHIP_HUGE_DEATH_STAR => SHIP_HUGE_DEATH_STAR, SHIP_HUGE_SUPERNOVA => SHIP_HUGE_SUPERNOVA, |
1028 | 1028 | SHIP_CARGO_SMALL => SHIP_CARGO_SMALL, SHIP_CARGO_BIG => SHIP_CARGO_BIG, SHIP_CARGO_SUPER => SHIP_CARGO_SUPER, SHIP_CARGO_HYPER => SHIP_CARGO_HYPER, |
1029 | 1029 | SHIP_RECYCLER => SHIP_RECYCLER, SHIP_COLONIZER => SHIP_COLONIZER, SHIP_SPY => SHIP_SPY, SHIP_SATTELITE_SOLAR => SHIP_SATTELITE_SOLAR |
1030 | - ), |
|
1030 | + ), |
|
1031 | 1031 | // Defensive building list |
1032 | 1032 | 'defense' => array (UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL, |
1033 | 1033 | UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | SNC_VER_ERROR_MISSMATCH_KEY_ID => 'error', |
98 | 98 | ); |
99 | 99 | |
100 | -$tableList = array( 'aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter', |
|
100 | +$tableList = array('aks', 'alliance', 'alliance_requests', 'announce', 'annonce', 'banned', 'buddy', 'chat', 'config', 'counter', |
|
101 | 101 | 'errors', 'fleets', 'fleet_log', 'galaxy', 'iraks', 'logs', 'log_dark_matter', 'messages', 'notes', 'planets', 'quest', |
102 | 102 | 'quest_status', 'referrals', 'rw', 'statpoints', 'users' |
103 | 103 | ); |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | $user_option_list = array(); |
189 | 189 | |
190 | 190 | $user_option_list[OPT_MESSAGE] = array(); |
191 | -foreach($sn_message_class_list as $message_class_id => $message_class_data) |
|
191 | +foreach ($sn_message_class_list as $message_class_id => $message_class_data) |
|
192 | 192 | { |
193 | - if($message_class_data['switchable']) |
|
193 | + if ($message_class_data['switchable']) |
|
194 | 194 | { |
195 | 195 | $user_option_list[OPT_MESSAGE]["opt_{$message_class_data['name']}"] = 1; |
196 | 196 | } |
197 | 197 | |
198 | - if($message_class_data['email']) |
|
198 | + if ($message_class_data['email']) |
|
199 | 199 | { |
200 | 200 | $user_option_list[OPT_MESSAGE]["opt_email_{$message_class_data['name']}"] = 0; |
201 | 201 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_HYDROGEN, |
779 | 779 | UNIT_PLANET_DENSITY_RARITY => 30, // 1, // 40.00, // * 1/121 0,82645 |
780 | 780 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
781 | - UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ), |
|
781 | + UNIT_RESOURCES => array(RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,), |
|
782 | 782 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
783 | 783 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
784 | 784 | ), |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_METHANE, |
788 | 788 | UNIT_PLANET_DENSITY_RARITY => 130, // 6, // 6.67, // * 6,0 4,95868 |
789 | 789 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
790 | - UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ), |
|
790 | + UNIT_RESOURCES => array(RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,), |
|
791 | 791 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
792 | 792 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
793 | 793 | ), |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_WATER, |
797 | 797 | UNIT_PLANET_DENSITY_RARITY => 450, //20, // 2.00, // * 20,0 16,52893 |
798 | 798 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
799 | - UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ), |
|
799 | + UNIT_RESOURCES => array(RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,), |
|
800 | 800 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
801 | 801 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
802 | 802 | ), |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_RAW, |
807 | 807 | UNIT_PLANET_DENSITY_RARITY => 20, // 1, // 40.00, // *1,0 0,82645 |
808 | 808 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
809 | - UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ), |
|
809 | + UNIT_RESOURCES => array(RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,), |
|
810 | 810 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
811 | 811 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
812 | 812 | ), |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_SILICATE, |
816 | 816 | UNIT_PLANET_DENSITY_RARITY => 140, // 5.71, // * 7,0 5,78512 |
817 | 817 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
818 | - UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ), |
|
818 | + UNIT_RESOURCES => array(RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,), |
|
819 | 819 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
820 | 820 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
821 | 821 | ), |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_STONE, |
825 | 825 | UNIT_PLANET_DENSITY_RARITY => 500, // 1.90, // * 21,0 17,35537 |
826 | 826 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
827 | - UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ), |
|
827 | + UNIT_RESOURCES => array(RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,), |
|
828 | 828 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
829 | 829 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
830 | 830 | ), |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_STANDARD, |
835 | 835 | UNIT_PLANET_DENSITY_RARITY => 1000, // 1.0, // * 40,0 33,05785 |
836 | 836 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_NORMAL, |
837 | - UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ), |
|
837 | + UNIT_RESOURCES => array(RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,), |
|
838 | 838 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
839 | 839 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
840 | 840 | ), |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_ORE, |
845 | 845 | UNIT_PLANET_DENSITY_RARITY => 550, // 2.11, // * 19,0 15,70248 |
846 | 846 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
847 | - UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ), |
|
847 | + UNIT_RESOURCES => array(RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,), |
|
848 | 848 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
849 | 849 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
850 | 850 | ), |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_PERIDOT, |
854 | 854 | UNIT_PLANET_DENSITY_RARITY => 120, // 8.00, // * 5,0 4,13223 |
855 | 855 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
856 | - UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ), |
|
856 | + UNIT_RESOURCES => array(RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,), |
|
857 | 857 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
858 | 858 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
859 | 859 | ), |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_RAW, |
863 | 863 | UNIT_PLANET_DENSITY_RARITY => 25, // 40.00, // * 1,0 0,82645 |
864 | 864 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
865 | - UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ), |
|
865 | + UNIT_RESOURCES => array(RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,), |
|
866 | 866 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
867 | 867 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
868 | 868 | ), |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | ), |
993 | 993 | |
994 | 994 | // Tech list |
995 | - 'tech' => array ( |
|
995 | + 'tech' => array( |
|
996 | 996 | TECH_ARMOR => TECH_ARMOR, TECH_WEAPON => TECH_WEAPON, TECH_SHIELD => TECH_SHIELD, |
997 | 997 | TECH_SPY => TECH_SPY, TECH_COMPUTER => TECH_COMPUTER, |
998 | 998 | TECH_ENERGY => TECH_ENERGY, TECH_LASER => TECH_LASER, TECH_ION => TECH_ION, TECH_PLASMA => TECH_PLASMA, TECH_HYPERSPACE => TECH_HYPERSPACE, |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | ), |
1004 | 1004 | |
1005 | 1005 | // Mercenaries |
1006 | - 'mercenaries' => array ( |
|
1006 | + 'mercenaries' => array( |
|
1007 | 1007 | MRC_STOCKMAN => MRC_STOCKMAN, MRC_SPY => MRC_SPY, MRC_ACADEMIC => MRC_ACADEMIC, |
1008 | 1008 | MRC_ADMIRAL => MRC_ADMIRAL, MRC_COORDINATOR => MRC_COORDINATOR, MRC_NAVIGATOR => MRC_NAVIGATOR, |
1009 | 1009 | ), |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | SHIP_RECYCLER => SHIP_RECYCLER, SHIP_COLONIZER => SHIP_COLONIZER, SHIP_SPY => SHIP_SPY, SHIP_SATTELITE_SOLAR => SHIP_SATTELITE_SOLAR |
1030 | 1030 | ), |
1031 | 1031 | // Defensive building list |
1032 | - 'defense' => array (UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL, |
|
1032 | + 'defense' => array(UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL, |
|
1033 | 1033 | UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS, |
1034 | 1034 | UNIT_DEF_TURRET_ION => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA, |
1035 | 1035 | |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | ), |
1040 | 1040 | |
1041 | 1041 | // Missiles list |
1042 | - 'missile' => array (UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ), |
|
1042 | + 'missile' => array(UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,), |
|
1043 | 1043 | |
1044 | 1044 | // Combat units list |
1045 | 1045 | 'combat' => array( |
@@ -1079,9 +1079,9 @@ discard block |
||
1079 | 1079 | ), |
1080 | 1080 | |
1081 | 1081 | // Resource list |
1082 | - 'resources' => array ( 0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'), |
|
1082 | + 'resources' => array(0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'), |
|
1083 | 1083 | // Resources all |
1084 | - 'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ), |
|
1084 | + 'resources_all' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,), |
|
1085 | 1085 | // Resources can be produced on planet |
1086 | 1086 | 'resources_planet' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY), |
1087 | 1087 | // Resources can be looted from planet |
@@ -1100,13 +1100,13 @@ discard block |
||
1100 | 1100 | ), |
1101 | 1101 | |
1102 | 1102 | // Resources that can be tradeable in market trader AND be a quest_rewards |
1103 | - 'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ), |
|
1103 | + 'quest_rewards' => array(RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,), |
|
1104 | 1104 | |
1105 | 1105 | // // Ques list |
1106 | 1106 | // 'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH), |
1107 | 1107 | |
1108 | - 'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ), |
|
1109 | - 'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ), |
|
1108 | + 'STAT_COMMON' => array(STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,), |
|
1109 | + 'STAT_PLAYER' => array(STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,), |
|
1110 | 1110 | ), |
1111 | 1111 | |
1112 | 1112 | 'pages' => array( |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('INSIDE')) { |
|
3 | +if (!defined('INSIDE')) { |
|
4 | 4 | die('Hack attempt!'); |
5 | 5 | } |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | |
18 | 18 | $lang['r_list'] = "<option value=\"-1\">{$lang['All_players']}</option>"; |
19 | 19 | if ($ranks) { |
20 | - foreach($ranks as $id => $array) { |
|
21 | - $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
20 | + foreach ($ranks as $id => $array) { |
|
21 | + $lang['r_list'] .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $new_rank_name = sys_get_param_str('newRankName'); |
15 | 15 | if ($new_rank_name) |
16 | 16 | { |
17 | - foreach($ally_rights as $fieldName) |
|
17 | + foreach ($ally_rights as $fieldName) |
|
18 | 18 | { |
19 | 19 | $newRank[$fieldName] = 0; |
20 | 20 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | { |
29 | 29 | unset($ranks); |
30 | 30 | |
31 | - foreach($rankListInput as $rankID => $rank) |
|
31 | + foreach ($rankListInput as $rankID => $rank) |
|
32 | 32 | { |
33 | - foreach($ally_rights as $rightName) |
|
33 | + foreach ($ally_rights as $rightName) |
|
34 | 34 | { |
35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $d = sys_get_param_int('d'); |
42 | 42 | if ($d && isset($ranks[$d])) |
43 | 43 | { |
44 | - if(count($ranks) == 1) |
|
44 | + if (count($ranks) == 1) |
|
45 | 45 | { |
46 | 46 | message($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']); |
47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | if (count($ranks)) |
55 | 55 | { |
56 | - foreach($ranks as $rankID => $rank) |
|
56 | + foreach ($ranks as $rankID => $rank) |
|
57 | 57 | { |
58 | 58 | $rank_data = array( |
59 | 59 | 'ID' => $rankID, |
60 | 60 | 'NAME' => $rank['name'], |
61 | 61 | ); |
62 | 62 | |
63 | - for($i = 1; $i < count($rank); $i++) |
|
63 | + for ($i = 1; $i < count($rank); $i++) |
|
64 | 64 | { |
65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
65 | + $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
66 | 66 | $rank_data['N' . $i] = $ally_rights[$i]; |
67 | 67 | } |
68 | 68 |