@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | defined('INSIDE') || die(); |
34 | 34 | |
35 | -if(php_sapi_name() == "cli") { |
|
35 | +if (php_sapi_name() == "cli") { |
|
36 | 36 | // In cli-mode |
37 | 37 | define('__DEBUG_CRLF', "\r\n"); |
38 | - define('__DEBUG_LINE', '-------------------------------------------------' . __DEBUG_CRLF); |
|
38 | + define('__DEBUG_LINE', '-------------------------------------------------'.__DEBUG_CRLF); |
|
39 | 39 | } else { |
40 | 40 | // Not in cli-mode |
41 | 41 | define('__DEBUG_CRLF', '<br />'); |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | public function log_file($message, $ident_change = 0) { |
53 | 53 | static $ident = 0; |
54 | 54 | |
55 | - if(!defined('SN_DEBUG_LOG')) { |
|
55 | + if (!defined('SN_DEBUG_LOG')) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - if($this->log_file_handler === null) { |
|
60 | - $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+'); |
|
59 | + if ($this->log_file_handler === null) { |
|
60 | + $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL.'/.logs/supernova.log', 'a+'); |
|
61 | 61 | @fwrite($this->log_file_handler, "\r\n\r\n"); |
62 | 62 | } |
63 | 63 | $ident_change < 0 ? $ident += $ident_change * 2 : false; |
64 | - if($this->log_file_handler) { |
|
65 | - @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n"); |
|
64 | + if ($this->log_file_handler) { |
|
65 | + @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()).str_repeat(' ', $ident + 1).$message."\r\n"); |
|
66 | 66 | } |
67 | 67 | $ident_change > 0 ? $ident += $ident_change * 2 : false; |
68 | 68 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | public function echo_log() { |
85 | - echo '<br><table><tr><td class=k colspan=4><a href="' . SN_ROOT_PHYSICAL . "admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>"; |
|
85 | + echo '<br><table><tr><td class=k colspan=4><a href="'.SN_ROOT_PHYSICAL."admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>"; |
|
86 | 86 | die(); |
87 | 87 | } |
88 | 88 | |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | $result = array(); |
93 | 93 | $transaction_id = classSupernova::$db->getTransaction()->getNextQueryTransactionId(); |
94 | 94 | $result[] = "tID {$transaction_id}"; |
95 | - foreach($backtrace as $a_trace) { |
|
96 | - if(in_array($a_trace['function'], $exclude_functions)) { |
|
95 | + foreach ($backtrace as $a_trace) { |
|
96 | + if (in_array($a_trace['function'], $exclude_functions)) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | $function = |
100 | 100 | ($a_trace['type'] |
101 | 101 | ? ($a_trace['type'] == '->' |
102 | - ? "({$a_trace['class']})" . get_class($a_trace['object']) |
|
102 | + ? "({$a_trace['class']})".get_class($a_trace['object']) |
|
103 | 103 | : $a_trace['class'] |
104 | - ) . $a_trace['type'] |
|
104 | + ).$a_trace['type'] |
|
105 | 105 | : '' |
106 | - ) . $a_trace['function'] . '()'; |
|
106 | + ).$a_trace['function'].'()'; |
|
107 | 107 | |
108 | 108 | $file = str_replace(SN_ROOT_PHYSICAL, '', str_replace('\\', '/', $a_trace['file'])); |
109 | 109 | |
110 | 110 | // $result[] = "{$function} ({$a_trace['line']})'{$file}'"; |
111 | 111 | $result[] = "{$function} - '{$file}' Line {$a_trace['line']}"; |
112 | 112 | |
113 | - if(!$long_comment) { |
|
113 | + if (!$long_comment) { |
|
114 | 114 | break; |
115 | 115 | } |
116 | 116 | } |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | public function dump($dump = false, $force_base = false, $deadlock = false) { |
125 | 125 | global $user, $planetrow; |
126 | 126 | |
127 | - if($dump === false) { |
|
127 | + if ($dump === false) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | 131 | $error_backtrace = array(); |
132 | 132 | $base_dump = false; |
133 | 133 | |
134 | - if($force_base === true) { |
|
134 | + if ($force_base === true) { |
|
135 | 135 | $base_dump = true; |
136 | 136 | } |
137 | 137 | |
138 | - if($dump === true) { |
|
138 | + if ($dump === true) { |
|
139 | 139 | $base_dump = true; |
140 | 140 | } else { |
141 | - if(!is_array($dump)) { |
|
141 | + if (!is_array($dump)) { |
|
142 | 142 | $dump = array('var' => $dump); |
143 | 143 | } |
144 | 144 | |
145 | - foreach($dump as $dump_var_name => $dump_var) { |
|
146 | - if($dump_var_name == 'base_dump') { |
|
145 | + foreach ($dump as $dump_var_name => $dump_var) { |
|
146 | + if ($dump_var_name == 'base_dump') { |
|
147 | 147 | $base_dump = $dump_var; |
148 | 148 | } else { |
149 | 149 | $error_backtrace[$dump_var_name] = $dump_var; |
@@ -151,22 +151,21 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
154 | + if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) { |
|
155 | 155 | $error_backtrace['deadlock'] = explode("\n", $q['Status']); |
156 | 156 | $error_backtrace['locks'] = classSupernova::$gc->snCache->getLocks(); |
157 | 157 | $error_backtrace['cSN_data'] = classSupernova::$gc->snCache->getData(); |
158 | - foreach($error_backtrace['cSN_data'] as &$location) { |
|
159 | - foreach($location as $location_id => &$location_data) { |
|
160 | - $location_data = isset($location_data['username']) ? $location_data['username'] : |
|
161 | - (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
158 | + foreach ($error_backtrace['cSN_data'] as &$location) { |
|
159 | + foreach ($location as $location_id => &$location_data) { |
|
160 | + $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id); |
|
162 | 161 | } |
163 | 162 | } |
164 | 163 | $error_backtrace['cSN_queries'] = classSupernova::$gc->snCache->getQueries(); |
165 | 164 | } |
166 | 165 | |
167 | - if($base_dump) { |
|
168 | - if(is_array($this->log_array) && count($this->log_array) > 0) { |
|
169 | - foreach($this->log_array as $log) { |
|
166 | + if ($base_dump) { |
|
167 | + if (is_array($this->log_array) && count($this->log_array) > 0) { |
|
168 | + foreach ($this->log_array as $log) { |
|
170 | 169 | $error_backtrace['queries'][] = $log; |
171 | 170 | } |
172 | 171 | } |
@@ -195,14 +194,14 @@ discard block |
||
195 | 194 | public function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) { |
196 | 195 | global $sys_stop_log_hit, $sys_log_disabled, $user; |
197 | 196 | |
198 | - if(empty(classSupernova::$db->connected)) { |
|
197 | + if (empty(classSupernova::$db->connected)) { |
|
199 | 198 | // TODO - писать ошибку в файл |
200 | 199 | die('SQL server currently unavailable. Please contact Administration...'); |
201 | 200 | } |
202 | 201 | |
203 | 202 | sn_db_transaction_rollback(); |
204 | 203 | |
205 | - if(classSupernova::$config->debug == 1) { |
|
204 | + if (classSupernova::$config->debug == 1) { |
|
206 | 205 | echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>"; |
207 | 206 | echo "<table>{$this->log}</table>"; |
208 | 207 | } |
@@ -214,16 +213,16 @@ discard block |
||
214 | 213 | |
215 | 214 | $userId = empty($user['id']) ? 0 : $user['id']; |
216 | 215 | |
217 | - if(!$sys_log_disabled) { |
|
216 | + if (!$sys_log_disabled) { |
|
218 | 217 | $query = "INSERT INTO `{{logs}}` SET |
219 | - `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($userId) . "', |
|
220 | - `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
|
221 | - `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" . |
|
218 | + `log_time` = '" . time()."', `log_code` = '".db_escape($error_code)."', `log_sender` = '".db_escape($userId)."', |
|
219 | + `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."', `log_text` = '".db_escape($message)."', |
|
220 | + `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'". |
|
222 | 221 | // ($error_backtrace ? ", `log_dump` = '" . db_escape(serialize($error_backtrace)) . "'" : '') . ";"; |
223 | - ", `log_dump` = '" . ($error_backtrace ? db_escape(serialize($error_backtrace)) : '') . "'" . ";"; |
|
224 | - classSupernova::$db->doSql($query, true) or die($fatal_error . classSupernova::$db->db_error()); |
|
222 | + ", `log_dump` = '".($error_backtrace ? db_escape(serialize($error_backtrace)) : '')."'".";"; |
|
223 | + classSupernova::$db->doSql($query, true) or die($fatal_error.classSupernova::$db->db_error()); |
|
225 | 224 | |
226 | - $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>" . classSupernova::$db->db_insert_id() . "</b>"; |
|
225 | + $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>".classSupernova::$db->db_insert_id()."</b>"; |
|
227 | 226 | |
228 | 227 | $sys_stop_log_hit = true; |
229 | 228 | $sys_log_disabled = true; |
@@ -233,7 +232,7 @@ discard block |
||
233 | 232 | ob_start(); |
234 | 233 | print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}"); |
235 | 234 | |
236 | - foreach($error_backtrace as $name => $value) { |
|
235 | + foreach ($error_backtrace as $name => $value) { |
|
237 | 236 | print(__DEBUG_LINE); |
238 | 237 | pdump($value, $name); |
239 | 238 | } |
@@ -245,7 +244,7 @@ discard block |
||
245 | 244 | public function warning($message, $title = 'System Message', $log_code = 300, $dump = false) { |
246 | 245 | global $user, $sys_log_disabled; |
247 | 246 | |
248 | - if(empty(classSupernova::$db->connected)) { |
|
247 | + if (empty(classSupernova::$db->connected)) { |
|
249 | 248 | // TODO - писать ошибку в файл |
250 | 249 | die('SQL server currently unavailable. Please contact Administration...'); |
251 | 250 | } |
@@ -254,12 +253,12 @@ discard block |
||
254 | 253 | |
255 | 254 | $userId = empty($user['id']) ? 0 : $user['id']; |
256 | 255 | |
257 | - if(!$sys_log_disabled) { |
|
256 | + if (!$sys_log_disabled) { |
|
258 | 257 | $query = "INSERT INTO `{{logs}}` SET |
259 | - `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($userId) . "', |
|
260 | - `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "', `log_text` = '" . db_escape($message) . "', |
|
261 | - `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" . |
|
262 | - ", `log_dump` = '" . ($error_backtrace ? db_escape(serialize($error_backtrace)) : '') . "'" . ";"; |
|
258 | + `log_time` = '" . time()."', `log_code` = '".db_escape($log_code)."', `log_sender` = '".db_escape($userId)."', |
|
259 | + `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."', `log_text` = '".db_escape($message)."', |
|
260 | + `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'". |
|
261 | + ", `log_dump` = '".($error_backtrace ? db_escape(serialize($error_backtrace)) : '')."'".";"; |
|
263 | 262 | classSupernova::$db->doSql($query, true); |
264 | 263 | } else { |
265 | 264 | // // TODO Здесь надо писать в файло |
@@ -272,11 +271,11 @@ discard block |
||
272 | 271 | // Dump variables nicer then var_dump() |
273 | 272 | |
274 | 273 | function dump($value, $varname = null, $level = 0, $dumper = '') { |
275 | - if(isset($varname)) { |
|
274 | + if (isset($varname)) { |
|
276 | 275 | $varname .= " = "; |
277 | 276 | } |
278 | 277 | |
279 | - if($level == -1) { |
|
278 | + if ($level == -1) { |
|
280 | 279 | $trans[' '] = '∴'; |
281 | 280 | $trans["\t"] = '⇒'; |
282 | 281 | $trans["\n"] = '¶;'; |
@@ -285,31 +284,31 @@ discard block |
||
285 | 284 | |
286 | 285 | return strtr(htmlspecialchars($value), $trans); |
287 | 286 | } |
288 | - if($level == 0) { |
|
287 | + if ($level == 0) { |
|
289 | 288 | // $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname; |
290 | - $dumper = mt_rand(10, 99) . '|' . $varname; |
|
289 | + $dumper = mt_rand(10, 99).'|'.$varname; |
|
291 | 290 | } |
292 | 291 | |
293 | 292 | $type = gettype($value); |
294 | 293 | $dumper .= $type; |
295 | 294 | |
296 | - if($type == TYPE_STRING) { |
|
297 | - $dumper .= '(' . strlen($value) . ')'; |
|
295 | + if ($type == TYPE_STRING) { |
|
296 | + $dumper .= '('.strlen($value).')'; |
|
298 | 297 | $value = dump($value, '', -1); |
299 | - } elseif($type == TYPE_BOOLEAN) { |
|
298 | + } elseif ($type == TYPE_BOOLEAN) { |
|
300 | 299 | $value = ($value ? 'true' : 'false'); |
301 | - } elseif($type == 'object') { |
|
300 | + } elseif ($type == 'object') { |
|
302 | 301 | $props = get_class_vars(get_class($value)); |
303 | - $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>'; |
|
304 | - foreach($props as $key => $val) { |
|
305 | - $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => '; |
|
302 | + $dumper .= '('.count($props).') <u>'.get_class($value).'</u>'; |
|
303 | + foreach ($props as $key => $val) { |
|
304 | + $dumper .= "\n".str_repeat("\t", $level + 1).$key.' => '; |
|
306 | 305 | $dumper .= dump($value->$key, '', $level + 1); |
307 | 306 | } |
308 | 307 | $value = ''; |
309 | - } elseif($type == TYPE_ARRAY) { |
|
310 | - $dumper .= '(' . count($value) . ')'; |
|
311 | - foreach($value as $key => $val) { |
|
312 | - $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => '; |
|
308 | + } elseif ($type == TYPE_ARRAY) { |
|
309 | + $dumper .= '('.count($value).')'; |
|
310 | + foreach ($value as $key => $val) { |
|
311 | + $dumper .= "\n".str_repeat("\t", $level + 1).dump($key, '', -1).' => '; |
|
313 | 312 | $dumper .= dump($val, '', $level + 1); |
314 | 313 | } |
315 | 314 | $value = ''; |
@@ -328,24 +327,24 @@ discard block |
||
328 | 327 | // $backtrace = $backtrace[1]; |
329 | 328 | |
330 | 329 | $caller = ''; |
331 | - if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
332 | - $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') . |
|
333 | - (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') . |
|
334 | - $backtrace[1]['function'] . |
|
330 | + if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) { |
|
331 | + $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : ''). |
|
332 | + (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : ''). |
|
333 | + $backtrace[1]['function']. |
|
335 | 334 | (!empty($backtrace[0]['file']) |
336 | 335 | ? ( |
337 | - ' (' . substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN) . |
|
338 | - (!empty($backtrace[0]['line']) ? ':' . $backtrace[0]['line'] : '') . |
|
336 | + ' ('.substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN). |
|
337 | + (!empty($backtrace[0]['line']) ? ':'.$backtrace[0]['line'] : ''). |
|
339 | 338 | ')' |
340 | 339 | ) |
341 | 340 | : '' |
342 | 341 | ); |
343 | - $caller = "\r\n" . $caller; |
|
342 | + $caller = "\r\n".$caller; |
|
344 | 343 | } |
345 | 344 | |
346 | - print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">' . |
|
347 | - dump($value, $varname) . |
|
348 | - $caller . |
|
345 | + print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">'. |
|
346 | + dump($value, $varname). |
|
347 | + $caller. |
|
349 | 348 | '</pre>' |
350 | 349 | ); |
351 | 350 | } |
@@ -355,24 +354,24 @@ discard block |
||
355 | 354 | } |
356 | 355 | |
357 | 356 | function pr($prePrint = false) { |
358 | - if($prePrint) { |
|
357 | + if ($prePrint) { |
|
359 | 358 | print(__DEBUG_CRLF); |
360 | 359 | } |
361 | - print(mt_rand() . __DEBUG_CRLF); |
|
360 | + print(mt_rand().__DEBUG_CRLF); |
|
362 | 361 | } |
363 | 362 | |
364 | 363 | function pc($prePrint = false) { |
365 | 364 | global $_PRINT_COUNT_VALUE; |
366 | 365 | $_PRINT_COUNT_VALUE++; |
367 | 366 | |
368 | - if($prePrint) { |
|
367 | + if ($prePrint) { |
|
369 | 368 | print(__DEBUG_CRLF); |
370 | 369 | } |
371 | - print($_PRINT_COUNT_VALUE . __DEBUG_CRLF); |
|
370 | + print($_PRINT_COUNT_VALUE.__DEBUG_CRLF); |
|
372 | 371 | } |
373 | 372 | |
374 | 373 | function prep($message) { |
375 | - print('<pre>' . $message . '</pre>'); |
|
374 | + print('<pre>'.$message.'</pre>'); |
|
376 | 375 | } |
377 | 376 | |
378 | 377 | function backtrace_no_arg() { |
@@ -396,9 +395,9 @@ discard block |
||
396 | 395 | */ |
397 | 396 | function pdie($message = '', $level = 0) { |
398 | 397 | $backtrace = debug_backtrace(); |
399 | - for($i = 0; $i < $level; $i++) { |
|
398 | + for ($i = 0; $i < $level; $i++) { |
|
400 | 399 | array_pop($backtrace); |
401 | 400 | } |
402 | 401 | |
403 | - die(__DEBUG_LINE . ($message ? $message . ' @ ' : '') . $backtrace[0]['file'] . ':' . $backtrace[0]['line']); |
|
402 | + die(__DEBUG_LINE.($message ? $message.' @ ' : '').$backtrace[0]['file'].':'.$backtrace[0]['line']); |
|
404 | 403 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | |
123 | 123 | $update_cache = false; |
124 | 124 | |
125 | - if(!empty($this->to_write)) { |
|
126 | - foreach($this->to_write as $key => $cork) { |
|
125 | + if (!empty($this->to_write)) { |
|
126 | + foreach ($this->to_write as $key => $cork) { |
|
127 | 127 | $value = is_array($this->data[$key]) ? serialize($this->data[$key]) : $this->data[$key]; // Сериализация для массивов при сохранении в БД |
128 | - $this->to_write[$key] = "({$this->user_id}, '" . db_escape($key) . "', '" . db_escape($value) . "')"; |
|
128 | + $this->to_write[$key] = "({$this->user_id}, '".db_escape($key)."', '".db_escape($value)."')"; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | classSupernova::$gc->db->doReplaceValuesDeprecated( |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $update_cache = true; |
144 | 144 | } |
145 | 145 | |
146 | - if(!empty($this->to_delete)) { |
|
147 | - foreach($this->to_delete as $key => &$value) { |
|
148 | - $value = is_string($key) ? "'". db_escape($key) . "'" : $key; |
|
146 | + if (!empty($this->to_delete)) { |
|
147 | + foreach ($this->to_delete as $key => &$value) { |
|
148 | + $value = is_string($key) ? "'".db_escape($key)."'" : $key; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | classSupernova::$db->doDeleteDanger( |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'player_id' => $this->user_id, |
155 | 155 | ), |
156 | 156 | array( |
157 | - "`option_id` IN (" . implode(',', $this->to_delete) . ")", |
|
157 | + "`option_id` IN (".implode(',', $this->to_delete).")", |
|
158 | 158 | ) |
159 | 159 | ); |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $update_cache = true; |
163 | 163 | } |
164 | 164 | |
165 | - if($update_cache) { |
|
165 | + if ($update_cache) { |
|
166 | 166 | $field_name = $this->cached_name(); |
167 | 167 | classSupernova::$cache->$field_name = $this->data; |
168 | 168 | } |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $this->load(); |
182 | 182 | } |
183 | 183 | protected function cached_name() { |
184 | - return 'options_' . $this->user_id; |
|
184 | + return 'options_'.$this->user_id; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | protected function load() { |
188 | - if($this->loaded) { |
|
188 | + if ($this->loaded) { |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $this->to_write = array(); |
194 | 194 | $this->to_delete = array(); |
195 | 195 | |
196 | - if(!$this->user_id) { |
|
196 | + if (!$this->user_id) { |
|
197 | 197 | $this->loaded = true; |
198 | 198 | return; |
199 | 199 | } |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | $field_name = $this->cached_name(); |
202 | 202 | $a_data = classSupernova::$cache->$field_name; |
203 | 203 | |
204 | - if(!empty($a_data)) { |
|
204 | + if (!empty($a_data)) { |
|
205 | 205 | $this->data = array_replace_recursive($this->data, $a_data); |
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
209 | 209 | $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE"); |
210 | - while($row = db_fetch($query)) { |
|
210 | + while ($row = db_fetch($query)) { |
|
211 | 211 | // $this->data[$row['option_id']] = $row['value']; |
212 | 212 | $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация |
213 | 213 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | protected function cached_name() { |
287 | - return 'options_' . $this->user_id; |
|
287 | + return 'options_'.$this->user_id; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // TODO - serialize/unserialize options |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | // Если в массиве индекса только один элемент - значит это просто индекс |
293 | 293 | is_array($option_id) && count($option_id) == 1 ? $option_id = reset($option_id) : false; |
294 | 294 | |
295 | - if(!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) { |
|
295 | + if (!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) { |
|
296 | 296 | $this->load(); |
297 | 297 | } |
298 | 298 | |
299 | - if(is_array($option_id)) { |
|
299 | + if (is_array($option_id)) { |
|
300 | 300 | $result = $this->data; |
301 | - foreach($option_id as $sub_key) { |
|
302 | - if(!isset($result) || !isset($result[$sub_key])) { |
|
301 | + foreach ($option_id as $sub_key) { |
|
302 | + if (!isset($result) || !isset($result[$sub_key])) { |
|
303 | 303 | $result = null; |
304 | 304 | break; |
305 | 305 | } |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | * @param null|mixed $value |
318 | 318 | */ |
319 | 319 | public function __set($option, $value = null) { |
320 | - if(empty($option) || !$this->user_id) { |
|
320 | + if (empty($option) || !$this->user_id) { |
|
321 | 321 | return; |
322 | 322 | } |
323 | 323 | |
324 | 324 | // Если в массиве индекса только один элемент - значит это просто индекс |
325 | - if(is_array($option) && count($option) == 1) { |
|
325 | + if (is_array($option) && count($option) == 1) { |
|
326 | 326 | // Разворачиваем его в индекс |
327 | 327 | $option = array(reset($option) => $value); |
328 | 328 | unset($value); |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | |
332 | 332 | $to_write = array(); |
333 | 333 | // Адресация многомерного массива через массив индексов в $option |
334 | - if(is_array($option) && isset($value)) { |
|
334 | + if (is_array($option) && isset($value)) { |
|
335 | 335 | $a_data = &$this->data; |
336 | - foreach($option as $option_id) { |
|
336 | + foreach ($option as $option_id) { |
|
337 | 337 | !is_array($a_data[$option_id]) ? $a_data[$option_id] = array() : false; |
338 | 338 | $a_data = &$a_data[$option_id]; |
339 | 339 | } |
340 | - if($a_data != $value) { |
|
340 | + if ($a_data != $value) { |
|
341 | 341 | $a_data = $value; |
342 | 342 | $to_write[reset($option)] = null; |
343 | 343 | } |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | // Пакетная запись из массива ключ -> значение |
346 | 346 | !is_array($option) ? $option = array($option => $value) : false; |
347 | 347 | |
348 | - foreach($option as $option_id => $option_value) { |
|
349 | - if($this->data[$option_id] !== $option_value) { |
|
348 | + foreach ($option as $option_id => $option_value) { |
|
349 | + if ($this->data[$option_id] !== $option_value) { |
|
350 | 350 | // TODO - вынести отдельно в обработчик |
351 | - if($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) { |
|
352 | - sn_setcookie(SN_COOKIE . '_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
|
351 | + if ($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) { |
|
352 | + sn_setcookie(SN_COOKIE.'_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $this->data[$option_id] = $option_value; |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
361 | - if(!empty($to_write)) { |
|
361 | + if (!empty($to_write)) { |
|
362 | 362 | $field_name = $this->cached_name(); |
363 | 363 | classSupernova::$cache->$field_name = $this->data; |
364 | 364 | |
365 | - foreach($to_write as $option_id => &$option_value) { |
|
365 | + foreach ($to_write as $option_id => &$option_value) { |
|
366 | 366 | $option_value = is_array($this->data[$option_id]) ? serialize($this->data[$option_id]) : $this->data[$option_id]; // Сериализация для массивов при сохранении в БД |
367 | - $to_write[$option_id] = "({$this->user_id}, '" . db_escape($option_id) . "', '" . db_escape($option_value) . "')"; |
|
367 | + $to_write[$option_id] = "({$this->user_id}, '".db_escape($option_id)."', '".db_escape($option_value)."')"; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | classSupernova::$gc->db->doReplaceValuesDeprecated( |
@@ -380,26 +380,26 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | protected function load() { |
383 | - if($this->loaded) { |
|
383 | + if ($this->loaded) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | 387 | $this->data = $this->defaults; |
388 | 388 | |
389 | - if(!$this->user_id) { |
|
389 | + if (!$this->user_id) { |
|
390 | 390 | return; |
391 | 391 | } |
392 | 392 | |
393 | 393 | $field_name = $this->cached_name(); |
394 | 394 | $a_data = classSupernova::$cache->$field_name; |
395 | 395 | |
396 | - if(!empty($a_data)) { |
|
396 | + if (!empty($a_data)) { |
|
397 | 397 | $this->data = array_replace($this->data, $a_data); |
398 | 398 | return; |
399 | 399 | } |
400 | 400 | |
401 | 401 | $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE"); |
402 | - while($row = db_fetch($query)) { |
|
402 | + while ($row = db_fetch($query)) { |
|
403 | 403 | // $this->data[$row['option_id']] = $row['value']; |
404 | 404 | $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация |
405 | 405 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | return $this->__get($offset); |
416 | 416 | } |
417 | 417 | public function offsetSet($offset, $value) { |
418 | - if(!is_null($offset)) { |
|
418 | + if (!is_null($offset)) { |
|
419 | 419 | // $this->data[$offset] = $value; |
420 | 420 | $this->__set($offset, $value); |
421 | 421 | } else { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | **/ |
24 | 24 | |
25 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
25 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param $resource_id |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $storage_fill = $caps_real['total_storage'][$resource_id] ? floor(mrc_get_level($user, $planetrow, $resource_id) / $caps_real['total_storage'][$resource_id] * 100) : 0; |
37 | 37 | |
38 | 38 | $template->assign_block_vars('resources', array( |
39 | - 'NAME' => classLocale::$lang["sys_" . pname_resource_name($resource_id)], |
|
39 | + 'NAME' => classLocale::$lang["sys_".pname_resource_name($resource_id)], |
|
40 | 40 | |
41 | 41 | 'HOURLY' => pretty_number($totalProduction, true, true), |
42 | 42 | 'WEEKLY' => pretty_number($totalProduction * 24 * 7, true, true), |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | $planetrow[$field_name] = $percent; |
77 | 77 | $SubQry[$field_name] = $percent; |
78 | 78 | } else { |
79 | - classSupernova::$debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
|
79 | + classSupernova::$debug->warning('Supplying wrong ID in production array - attempt to change some field - ID'.$prod_id, 'Resource Page', 301); |
|
80 | 80 | continue; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - if(!empty($SubQry)) { |
|
84 | + if (!empty($SubQry)) { |
|
85 | 85 | DBStaticPlanet::db_planet_update_set_by_id( |
86 | 86 | $planetrow['id'], |
87 | 87 | $SubQry |
@@ -11,24 +11,24 @@ discard block |
||
11 | 11 | * @copyright 2008 by Pada for XNova.project.es |
12 | 12 | */ |
13 | 13 | |
14 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
14 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
15 | 15 | |
16 | 16 | lng_include('overview'); |
17 | 17 | lng_include('universe'); |
18 | 18 | |
19 | 19 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
20 | 20 | if (!intval($sensorLevel)) { |
21 | - message (classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
21 | + message(classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ($planetrow['planet_type'] != PT_MOON) { |
25 | - message (classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
25 | + message(classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $scan_galaxy = sys_get_param_int('galaxy'); |
29 | 29 | $scan_system = sys_get_param_int('system'); |
30 | 30 | $scan_planet = sys_get_param_int('planet'); |
31 | -$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
31 | +$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
32 | 32 | $id = sys_get_param_id('id'); |
33 | 33 | |
34 | 34 | $source_galaxy = $planetrow['galaxy']; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | $sensorRange = GetPhalanxRange($sensorLevel); |
39 | 39 | |
40 | 40 | $system_distance = abs($source_system - $scan_system); |
41 | -if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
41 | +if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
42 | 42 | { |
43 | - message (classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
43 | + message(classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $cost = $sensorLevel * 1000; |
@@ -51,20 +51,20 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
54 | -if(!$planet_scanned['id']) |
|
54 | +if (!$planet_scanned['id']) |
|
55 | 55 | { |
56 | 56 | message(classLocale::$lang['phalanx_planet_not_exists'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
57 | 57 | } |
58 | 58 | |
59 | -if($planet_scanned['destruyed']) |
|
59 | +if ($planet_scanned['destruyed']) |
|
60 | 60 | { |
61 | - message (classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
61 | + message(classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | DBStaticPlanet::db_planet_update_adjust_by_id( |
65 | 65 | $user['current_planet'], |
66 | 66 | array( |
67 | - 'deuterium' => - $cost, |
|
67 | + 'deuterium' => -$cost, |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | //define('SN_RENDER_NAVBAR_PLANET', false); |
32 | 32 | |
33 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
33 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
34 | 34 | |
35 | 35 | //$ccc = 0; |
36 | 36 | //foreach(DBStaticUser::db_user_list_non_bots() as $ip) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $result = array(); |
51 | 51 | |
52 | -switch($mode = sys_get_param_str('mode')) { |
|
52 | +switch ($mode = sys_get_param_str('mode')) { |
|
53 | 53 | case 'manage': |
54 | 54 | sn_sys_sector_buy('overview.php?mode=manage'); |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $template = gettemplate('planet_manage', true); |
60 | 60 | $planet_id = sys_get_param_id('planet_id'); |
61 | 61 | |
62 | - if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
62 | + if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) { |
|
63 | 63 | $planetrow['name'] = $new_name_unsafe; |
64 | 64 | DBStaticPlanet::db_planet_update_set_by_id( |
65 | 65 | $planetrow['id'], |
@@ -67,21 +67,21 @@ discard block |
||
67 | 67 | 'name' => $new_name_unsafe, |
68 | 68 | ) |
69 | 69 | ); |
70 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
70 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
71 | 71 | try { |
72 | 72 | sn_db_transaction_start(); |
73 | 73 | $user = DBStaticUser::db_user_by_id($user['id'], true, '*'); |
74 | 74 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*'); |
75 | 75 | |
76 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
76 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
77 | 77 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
78 | 78 | } |
79 | 79 | |
80 | - if($planetrow['id'] == $user['id_planet']) { |
|
80 | + if ($planetrow['id'] == $user['id_planet']) { |
|
81 | 81 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
82 | 82 | } |
83 | 83 | |
84 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
84 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
85 | 85 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
86 | 86 | } |
87 | 87 | |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | ); |
107 | 107 | sn_db_transaction_commit(); |
108 | 108 | sys_redirect('overview.php?mode=manage'); |
109 | - } catch(exception $e) { |
|
109 | + } catch (exception $e) { |
|
110 | 110 | sn_db_transaction_rollback(); |
111 | 111 | $result[] = array( |
112 | 112 | 'STATUS' => $e->getCode(), |
113 | 113 | 'MESSAGE' => $e->getMessage(), |
114 | 114 | ); |
115 | 115 | } |
116 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
116 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
117 | 117 | try { |
118 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
118 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
119 | 119 | 'galaxy' => sys_get_param_int('new_galaxy'), |
120 | 120 | 'system' => sys_get_param_int('new_system'), |
121 | 121 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // $planetrow = $global_data['planet']; |
133 | 133 | |
134 | 134 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
135 | - if($can_teleport['result'] != ERR_NONE) { |
|
135 | + if ($can_teleport['result'] != ERR_NONE) { |
|
136 | 136 | throw new exception($can_teleport['message'], $can_teleport['result']); |
137 | 137 | } |
138 | 138 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | array() |
152 | 152 | ); |
153 | 153 | |
154 | - if($planetrow['id'] == $user['id_planet']) { |
|
154 | + if ($planetrow['id'] == $user['id_planet']) { |
|
155 | 155 | DBStaticUser::db_user_set_by_id( |
156 | 156 | $user['id'], |
157 | 157 | array( |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
172 | 172 | ); |
173 | 173 | sys_redirect('overview.php?mode=manage'); |
174 | - } catch(exception $e) { |
|
174 | + } catch (exception $e) { |
|
175 | 175 | sn_db_transaction_rollback(); |
176 | 176 | $result[] = array( |
177 | 177 | 'STATUS' => $e->getCode(), |
178 | 178 | 'MESSAGE' => $e->getMessage(), |
179 | 179 | ); |
180 | 180 | } |
181 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
181 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
182 | 182 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
183 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
184 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
183 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
184 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
185 | 185 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
186 | 186 | DBStaticPlanet::db_planet_update_set_by_id( |
187 | 187 | $user['current_planet'], |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
208 | 208 | } |
209 | 209 | } else { |
210 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
210 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
211 | 211 | } |
212 | - } elseif( |
|
212 | + } elseif ( |
|
213 | 213 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
214 | 214 | && ( |
215 | 215 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
225 | 225 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
226 | 226 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
227 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
228 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
227 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
228 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
229 | 229 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
230 | 230 | } else { |
231 | 231 | $planetrow['PLANET_GOVERNOR_LEVEL'] = 1; |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | lng_include('mrc_mercenary'); |
259 | 259 | int_planet_pretemplate($planetrow, $template); |
260 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
261 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
260 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
261 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
262 | 262 | continue; |
263 | 263 | } |
264 | 264 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
311 | 311 | )); |
312 | 312 | |
313 | - foreach($result as &$a_result) { |
|
313 | + foreach ($result as &$a_result) { |
|
314 | 314 | $template->assign_block_vars('result', $a_result); |
315 | 315 | } |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | default: |
321 | 321 | sn_sys_sector_buy(); |
322 | 322 | |
323 | - if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
323 | + if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) { |
|
324 | 324 | $planetrow['name'] = $new_name_unsafe; |
325 | 325 | DBStaticPlanet::db_planet_update_set_by_id( |
326 | 326 | $planetrow['id'], |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | $planet_count = 0; |
357 | 357 | $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*'); |
358 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
358 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
359 | 359 | sn_db_transaction_start(); |
360 | 360 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
361 | 361 | sn_db_transaction_commit(); |
@@ -366,16 +366,16 @@ discard block |
||
366 | 366 | |
367 | 367 | $planet_fleet_id = 0; |
368 | 368 | $fleet_list = $template_planet['fleet_list']; |
369 | - if($fleet_list['own']['count']) { |
|
369 | + if ($fleet_list['own']['count']) { |
|
370 | 370 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
371 | 371 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
372 | 372 | // $fleet_id++;tpl_parse_fleet_sn |
373 | 373 | } |
374 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
374 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
375 | 375 | continue; |
376 | 376 | } |
377 | 377 | $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']); |
378 | - if($moon) { |
|
378 | + if ($moon) { |
|
379 | 379 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
380 | 380 | } else { |
381 | 381 | $moon_fill = 0; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | tpl_assign_fleet($template, $fleets); |
416 | 416 | |
417 | 417 | $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']); |
418 | - if($lune) { |
|
418 | + if ($lune) { |
|
419 | 419 | $template->assign_vars(array( |
420 | 420 | 'MOON_ID' => $lune['id'], |
421 | 421 | 'MOON_IMG' => $lune['image'], |
@@ -427,15 +427,15 @@ discard block |
||
427 | 427 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
428 | 428 | |
429 | 429 | $planet_recyclers_orbiting = 0; |
430 | - foreach(Fleet::$snGroupRecyclers as $recycler_id) { |
|
430 | + foreach (Fleet::$snGroupRecyclers as $recycler_id) { |
|
431 | 431 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
432 | 432 | } |
433 | 433 | |
434 | 434 | int_planet_pretemplate($planetrow, $template); |
435 | 435 | |
436 | 436 | $sn_group_ques = sn_get_groups('ques'); |
437 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
438 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
437 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
438 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
439 | 439 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
440 | 440 | $template->assign_block_vars('ques', array( |
441 | 441 | 'ID' => $que_id, |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
444 | 444 | )); |
445 | 445 | |
446 | - if(!empty($this_que)) { |
|
447 | - foreach($this_que as $que_item) { |
|
446 | + if (!empty($this_que)) { |
|
447 | + foreach ($this_que as $que_item) { |
|
448 | 448 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
449 | 449 | } |
450 | 450 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | 'LENGTH' => $que_hangar_length, |
459 | 459 | )); |
460 | 460 | |
461 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
461 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
462 | 462 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
463 | 463 | $template->assign_block_vars('ques', array( |
464 | 464 | 'ID' => SUBQUE_DEFENSE, |
@@ -470,12 +470,12 @@ discard block |
||
470 | 470 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
471 | 471 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
472 | 472 | |
473 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
473 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
474 | 474 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
475 | 475 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
476 | 476 | } |
477 | 477 | |
478 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
478 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
479 | 479 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
480 | 480 | } |
481 | 481 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | )); |
533 | 533 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
534 | 534 | |
535 | - foreach($result as &$a_result) { |
|
535 | + foreach ($result as &$a_result) { |
|
536 | 536 | $template->assign_block_vars('result', $a_result); |
537 | 537 | } |
538 | 538 |
@@ -10,34 +10,34 @@ discard block |
||
10 | 10 | * @copyright 2008 By Chlorel for XNova |
11 | 11 | */ |
12 | 12 | |
13 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | |
15 | 15 | lng_include('fleet'); |
16 | 16 | |
17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
18 | 18 | { |
19 | 19 | sn_db_transaction_start(); |
20 | 20 | DBStaticUser::db_user_by_id($user['id'], true, 'id'); |
21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
23 | 23 | { |
24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
26 | 26 | { |
27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
28 | - if(!$NextDestTime) |
|
27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
28 | + if (!$NextDestTime) |
|
29 | 29 | { |
30 | 30 | $ship_list = sys_get_param('ships'); |
31 | 31 | $jumpMade = false; |
32 | - foreach($ship_list as $ship_id => $ship_count) |
|
32 | + foreach ($ship_list as $ship_id => $ship_count) |
|
33 | 33 | { |
34 | - if(!in_array($ship_id, Fleet::$snGroupFleet)) |
|
34 | + if (!in_array($ship_id, Fleet::$snGroupFleet)) |
|
35 | 35 | { |
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
40 | - if($ship_count) |
|
40 | + if ($ship_count) |
|
41 | 41 | { |
42 | 42 | $jumpMade = true; |
43 | 43 | DBStaticUnit::dbUpdateOrInsertUnit($ship_id, -$ship_count, $user, $planetrow['id']); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - if($jumpMade) |
|
48 | + if ($jumpMade) |
|
49 | 49 | { |
50 | 50 | DBStaticPlanet::db_planet_update_set_by_id( |
51 | 51 | $TargetGate['id'], |
@@ -67,31 +67,31 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
70 | - $RetMessage = classLocale::$lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
70 | + $RetMessage = classLocale::$lang['gate_jump_done']." - ".pretty_time(uni_get_time_to_jump($planetrow)); |
|
71 | 71 | } else { |
72 | 72 | $RetMessage = classLocale::$lang['gate_wait_data']; |
73 | 73 | } |
74 | 74 | } else { |
75 | - $RetMessage = classLocale::$lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
75 | + $RetMessage = classLocale::$lang['gate_wait_dest']." - ".pretty_time($NextDestTime); |
|
76 | 76 | } |
77 | 77 | } else { |
78 | 78 | $RetMessage = classLocale::$lang['gate_no_dest_g']; |
79 | 79 | } |
80 | 80 | } else { |
81 | - $RetMessage = classLocale::$lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
81 | + $RetMessage = classLocale::$lang['gate_wait_star']." - ".pretty_time($NextJumpTime); |
|
82 | 82 | } |
83 | 83 | sn_db_transaction_commit(); |
84 | 84 | message($RetMessage, classLocale::$lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
85 | 85 | } else { |
86 | 86 | $template = gettemplate('jumpgate', true); |
87 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
87 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
88 | 88 | { |
89 | 89 | $Combo = ''; |
90 | 90 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
91 | 91 | // while($CurMoon = db_fetch($MoonList)) |
92 | - foreach($MoonList as $CurMoon) |
|
92 | + foreach ($MoonList as $CurMoon) |
|
93 | 93 | { |
94 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
94 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
95 | 95 | { |
96 | 96 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
97 | 97 | $template->assign_block_vars('moon', array( |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - foreach(Fleet::$snGroupFleet as $Ship) |
|
108 | + foreach (Fleet::$snGroupFleet as $Ship) |
|
109 | 109 | { |
110 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
110 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
111 | 111 | { |
112 | 112 | continue; |
113 | 113 | } |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | define('INSTALL', false); |
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | |
7 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
7 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
8 | 8 | |
9 | 9 | // if($user['authlevel'] < 2) |
10 | -if($user['authlevel'] < 3) |
|
10 | +if ($user['authlevel'] < 3) |
|
11 | 11 | { |
12 | 12 | AdminMessage(classLocale::$lang['adm_err_denied']); |
13 | 13 | } |
14 | 14 | AdminMessage('Временно не работает'); |
15 | 15 | |
16 | -require("includes/admin_planet_edit.inc" . DOT_PHP_EX); |
|
16 | +require("includes/admin_planet_edit.inc".DOT_PHP_EX); |
|
17 | 17 | |
18 | 18 | $template = gettemplate('admin/admin_planet_edit', true); |
19 | 19 | |
@@ -21,30 +21,30 @@ discard block |
||
21 | 21 | $planet_id = sys_get_param_id('planet_id'); |
22 | 22 | |
23 | 23 | $unit_list = sys_get_param('unit_list'); |
24 | -if(sys_get_param('change_data') && !empty($unit_list)) |
|
24 | +if (sys_get_param('change_data') && !empty($unit_list)) |
|
25 | 25 | { |
26 | 26 | $query_string = array(); |
27 | - foreach($unit_list as $unit_id => $unit_amount) |
|
27 | + foreach ($unit_list as $unit_id => $unit_amount) |
|
28 | 28 | { |
29 | - if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
29 | + if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
30 | 30 | { |
31 | 31 | $query_string[] = $unit_query_string; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - if(!empty($query_string)) |
|
35 | + if (!empty($query_string)) |
|
36 | 36 | { |
37 | - classSupernova::$db->doUpdateReallyComplex("UPDATE {{" . TABLE_PLANETS . "}} SET " . implode(', ', $query_string) . " WHERE `id` = {$planet_id}"); |
|
37 | + classSupernova::$db->doUpdateReallyComplex("UPDATE {{".TABLE_PLANETS."}} SET ".implode(', ', $query_string)." WHERE `id` = {$planet_id}"); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if($planet_id) |
|
41 | +if ($planet_id) |
|
42 | 42 | { |
43 | 43 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
44 | 44 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
45 | 45 | } |
46 | 46 | |
47 | -foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
47 | +foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
48 | 48 | { |
49 | 49 | $template->assign_block_vars('page_menu', array( |
50 | 50 | 'ID' => $page_mode, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $template->assign_vars(array( |
56 | 56 | 'MODE' => $mode, |
57 | 57 | 'PLANET_ID' => $planet_id, |
58 | - 'PLANET_NAME' => empty($edit_planet_row) ? '' : classLocale::$lang['sys_planet_type'][$edit_planet_row['planet_type']] . ' ' . uni_render_planet($edit_planet_row), |
|
58 | + 'PLANET_NAME' => empty($edit_planet_row) ? '' : classLocale::$lang['sys_planet_type'][$edit_planet_row['planet_type']].' '.uni_render_planet($edit_planet_row), |
|
59 | 59 | 'PAGE_HINT' => classLocale::$lang['adm_planet_edit_hint'], |
60 | 60 | )); |
61 | 61 |
@@ -1,10 +1,10 @@ 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 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
7 | -if(!$user_admin) { |
|
7 | +if (!$user_admin) { |
|
8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
9 | 9 | } |
10 | 10 | |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
21 | 21 | |
22 | 22 | |
23 | -if(sys_get_param_str('isSaveOptions')) { |
|
23 | +if (sys_get_param_str('isSaveOptions')) { |
|
24 | 24 | require_once('includes/includes/sys_avatar.php'); |
25 | 25 | |
26 | 26 | $fieldChange = array(); |
27 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
27 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) { |
|
28 | 28 | $fieldChange['ally_tag'] = $new_tag; |
29 | 29 | DBStaticUser::db_user_set_by_id( |
30 | 30 | $ally['ally_user_id'], |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | ) |
34 | 34 | ); |
35 | 35 | } |
36 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
36 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) { |
|
37 | 37 | $fieldChange['ally_name'] = $new_name; |
38 | 38 | } |
39 | 39 | |
40 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
40 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) { |
|
41 | 41 | $fieldChange['ally_owner_range'] = $new_owner_rank; |
42 | 42 | } |
43 | 43 | |
44 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
44 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) { |
|
45 | 45 | $fieldChange['ally_web'] = $new_web; |
46 | 46 | } |
47 | 47 | |
48 | - if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
48 | + if (($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) { |
|
49 | 49 | $fieldChange['ally_request_notallow'] = sys_get_param_int('request_notallow', $ally['ally_request_notallow']); |
50 | 50 | } |
51 | 51 | |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | 'AVATAR_UPLOAD_STATUS' => $avatar_upload_result['STATUS'], |
56 | 56 | 'AVATAR_UPLOAD_MESSAGE' => $avatar_upload_result['MESSAGE'], |
57 | 57 | )); |
58 | - if($new_image != $ally['ally_image']) { |
|
58 | + if ($new_image != $ally['ally_image']) { |
|
59 | 59 | $fieldChange['ally_image'] = $new_image; |
60 | 60 | } |
61 | 61 | |
62 | - if(!empty($fieldChange)) { |
|
62 | + if (!empty($fieldChange)) { |
|
63 | 63 | classSupernova::$db->doUpdateRowSet( |
64 | 64 | TABLE_ALLIANCE, |
65 | 65 | $fieldChange, |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
72 | 72 | } |
73 | -} elseif(sys_get_param_str('isSaveText')) { |
|
73 | +} elseif (sys_get_param_str('isSaveText')) { |
|
74 | 74 | $text_unsafe = sys_get_param_str_unsafe('text'); |
75 | 75 | DBStaticAlly::db_ally_update_texts($text_unsafe, $ally['id'], $text_list[$allyTextID]['db_field']); |
76 | 76 | $ally[$text_list[$allyTextID]['db_field']] = db_escape($text_unsafe); |
77 | -} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
78 | - if(!$isAllyOwner) { |
|
77 | +} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
78 | + if (!$isAllyOwner) { |
|
79 | 79 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $newLeader = DBStaticUser::db_user_by_id($idNewLeader, false, `ally_id`); |
83 | - if($newLeader['ally_id'] == $user['ally_id']) { |
|
83 | + if ($newLeader['ally_id'] == $user['ally_id']) { |
|
84 | 84 | sn_db_transaction_start(); |
85 | 85 | DBStaticUser::db_user_set_by_id( |
86 | 86 | $user['id'], |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | sn_db_transaction_commit(); |
100 | 100 | sys_redirect('alliance.php'); |
101 | 101 | } |
102 | -} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
103 | - if(!$isAllyOwner) { |
|
102 | +} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
103 | + if (!$isAllyOwner) { |
|
104 | 104 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
105 | 105 | } |
106 | 106 | sn_db_transaction_start(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $request = DBStaticAlly::db_ally_request_count_by_id($ally); |
124 | 124 | |
125 | 125 | $template->assign_vars(array( |
126 | - 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
126 | + 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
127 | 127 | 'text' => $ally[$text_list[$allyTextID]['db_field']], |
128 | 128 | 'request_type' => classLocale::$lang[$text_list[$allyTextID]['text_type']], |
129 | 129 | 't' => $allyTextID, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $userAllyAdmins = DBStaticUser::db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
157 | 157 | unset($tmp); |
158 | 158 | // while ($userAllyAdmin = db_fetch($userAllyAdmins)) |
159 | - foreach($userAllyAdmins as $userAllyAdmin) { |
|
159 | + foreach ($userAllyAdmins as $userAllyAdmin) { |
|
160 | 160 | // pdump($userAllyAdmin); |
161 | 161 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
162 | 162 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | $template->assign_var('adminMembers', $tmp); |
165 | 165 | } |
166 | 166 | |
167 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
168 | - if(!$sn_ali_admin_action_locale['title']) { |
|
167 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
168 | + if (!$sn_ali_admin_action_locale['title']) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | $template->assign_block_vars('admin_actions', array( |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | // Pretty Safe |
3 | 3 | // TODO: Add ally_tag to usertable |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | 6 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | $ally_name_unsafe = sys_get_param_str_unsafe('name'); |
12 | 12 | $ally_name = db_escape($ally_name_unsafe); |
13 | 13 | |
14 | -if($ally_tag) { |
|
15 | - if(!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
14 | +if ($ally_tag) { |
|
15 | + if (!$ally_name_unsafe || !$ally_tag_unsafe) { |
|
16 | 16 | message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name); |
20 | - if($query) { |
|
20 | + if ($query) { |
|
21 | 21 | message(str_replace('%s', $query['ally_tag'] == $ally_tag_unsafe ? $ally_tag_unsafe : $ally_name_unsafe, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']); |
22 | 22 | } |
23 | 23 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | |
37 | 37 | $ally_user = classSupernova::$gc->cacheOperator->db_ins_record(LOC_USER, array( |
38 | - 'username' => "[" . $ally_tag_unsafe . "]", |
|
38 | + 'username' => "[".$ally_tag_unsafe."]", |
|
39 | 39 | 'register_time' => SN_TIME_NOW, |
40 | 40 | 'user_as_ally' => $ally_id, |
41 | 41 | )); |