@@ -187,6 +187,9 @@ |
||
187 | 187 | return $error_backtrace; |
188 | 188 | } |
189 | 189 | |
190 | + /** |
|
191 | + * @param string $die_message |
|
192 | + */ |
|
190 | 193 | public function error_fatal($die_message, $details = 'There is a fatal error on page') { |
191 | 194 | // TODO - Записывать детали ошибки в лог-файл |
192 | 195 | die($die_message); |
@@ -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'] = SnCache::getLocks(); |
157 | 157 | $error_backtrace['cSN_data'] = 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'] = 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->doExecute($query, true) or die($fatal_error . classSupernova::$db->db_error()); |
|
222 | + ", `log_dump` = '".($error_backtrace ? db_escape(serialize($error_backtrace)) : '')."'".";"; |
|
223 | + classSupernova::$db->doExecute($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->doExecute($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 | } |
@@ -173,6 +173,11 @@ discard block |
||
173 | 173 | */ |
174 | 174 | // OK v4 |
175 | 175 | // TODO - вынести в отдельный класс |
176 | +/** |
|
177 | + * @param string $db_id_field_name |
|
178 | + * @param string $db_table_name |
|
179 | + * @param string $db_value_field_name |
|
180 | + */ |
|
176 | 181 | function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) { |
177 | 182 | $current_value_safe = db_escape($current_value_unsafe); |
178 | 183 | $value_id = classSupernova::$db->doSelectFetch("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE"); |
@@ -474,8 +479,8 @@ discard block |
||
474 | 479 | |
475 | 480 | |
476 | 481 | /** |
477 | - * @param $user_id |
|
478 | - * @param $change_type |
|
482 | + * @param integer $user_id |
|
483 | + * @param integer $change_type |
|
479 | 484 | * @param $dark_matter |
480 | 485 | * @param $comment |
481 | 486 | * @param $row |
@@ -495,7 +500,7 @@ discard block |
||
495 | 500 | /** |
496 | 501 | * @param $user_id_safe |
497 | 502 | * |
498 | - * @return array|bool|mysqli_result|null |
|
503 | + * @return integer |
|
499 | 504 | */ |
500 | 505 | function db_referral_get_by_id($user_id_safe) { |
501 | 506 | $old_referral = classSupernova::$db->doSelectFetch("SELECT * FROM {{referrals}} WHERE `id` = {$user_id_safe} LIMIT 1 FOR UPDATE;"); |
@@ -523,9 +528,9 @@ discard block |
||
523 | 528 | |
524 | 529 | // Quests *********************************************************************************************************** |
525 | 530 | /** |
526 | - * @param $query_add_select |
|
531 | + * @param string $query_add_select |
|
527 | 532 | * @param $query_add_from |
528 | - * @param $query_add_where |
|
533 | + * @param string $query_add_where |
|
529 | 534 | * |
530 | 535 | * @return array|bool|mysqli_result|null |
531 | 536 | */ |
@@ -570,10 +575,10 @@ discard block |
||
570 | 575 | |
571 | 576 | /** |
572 | 577 | * @param $quest_name |
573 | - * @param $quest_type |
|
578 | + * @param integer $quest_type |
|
574 | 579 | * @param $quest_description |
575 | 580 | * @param $quest_conditions |
576 | - * @param $quest_rewards |
|
581 | + * @param string $quest_rewards |
|
577 | 582 | * @param $quest_id |
578 | 583 | */ |
579 | 584 | function db_quest_update($quest_name, $quest_type, $quest_description, $quest_conditions, $quest_rewards, $quest_id) { |
@@ -592,7 +597,7 @@ discard block |
||
592 | 597 | /** |
593 | 598 | * @param $banner |
594 | 599 | * @param $banned |
595 | - * @param $reason |
|
600 | + * @param string $reason |
|
596 | 601 | * @param $ban_until |
597 | 602 | */ |
598 | 603 | function db_ban_insert($banner, $banned, $reason, $ban_until) { |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | |
5 | 5 | function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) { |
6 | 6 | return classSupernova::$db->doSelect( |
7 | - "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') . |
|
7 | + "SELECT p.*, u.username".($table_parent_columns ? ', p1.name AS parent_name' : ''). |
|
8 | 8 | " FROM {{planets}} AS p |
9 | 9 | LEFT JOIN {{users}} AS u ON u.id = p.id_owner" . |
10 | - ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '') . |
|
11 | - " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
10 | + ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : ''). |
|
11 | + " WHERE ".($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | function db_planet_list_search($searchtext) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ORDER BY |
107 | 107 | sp.`{$Rank}_rank`, subject.{$source['id']} |
108 | 108 | LIMIT |
109 | - " . $start . ",100;"; |
|
109 | + ".$start.",100;"; |
|
110 | 110 | } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
111 | 111 | $query_str = |
112 | 112 | "SELECT |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ORDER BY |
120 | 120 | subject.{$Rank} DESC, subject.{$source['id']} |
121 | 121 | LIMIT |
122 | - " . $start . ",100;"; |
|
122 | + ".$start.",100;"; |
|
123 | 123 | } |
124 | 124 | } else { |
125 | 125 | // TODO |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ORDER BY |
137 | 137 | sp.`{$Rank}_rank`, subject.id |
138 | 138 | LIMIT |
139 | - " . $start . ",100;"; |
|
139 | + ".$start.",100;"; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return classSupernova::$db->doSelect($query_str); |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | */ |
366 | 366 | function db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module) { |
367 | 367 | $extra_conditions = |
368 | - ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '') . |
|
369 | - ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '') . |
|
370 | - ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '') . |
|
368 | + ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : ''). |
|
369 | + ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : ''). |
|
370 | + ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : ''). |
|
371 | 371 | ($flt_module ? "AND payment_module_name = '{$flt_module}' " : ''); |
372 | 372 | $query = classSupernova::$db->doSelect("SELECT * FROM `{{payment}}` WHERE 1 {$extra_conditions} ORDER BY payment_id DESC;"); |
373 | 373 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | // Log Online ************************************************************************************************************* |
397 | 397 | function db_log_online_insert() { |
398 | - classSupernova::$db->doInsert("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . classSupernova::$config->var_online_user_count); |
|
398 | + classSupernova::$db->doInsert("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = ".classSupernova::$config->var_online_user_count); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Log ************************************************************************************************************* |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | `ban_user_id` = '{$banned['id']}', |
604 | 604 | `ban_user_name` = '{$banned['username']}', |
605 | 605 | `ban_reason` = '{$reason}', |
606 | - `ban_time` = " . SN_TIME_NOW . ", |
|
606 | + `ban_time` = ".SN_TIME_NOW.", |
|
607 | 607 | `ban_until` = {$ban_until}, |
608 | 608 | `ban_issuer_id` = '{$banner['id']}', |
609 | 609 | `ban_issuer_name` = '{$banner['username']}', |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | `ban_user_name` = '{$banned['username']}', |
626 | 626 | `ban_reason` = '{$reason}', |
627 | 627 | `ban_time` = 0, |
628 | - `ban_until` = " . SN_TIME_NOW . ", |
|
628 | + `ban_until` = ".SN_TIME_NOW.", |
|
629 | 629 | `ban_issuer_id` = '{$banner['id']}', |
630 | 630 | `ban_issuer_name` = '{$banner['username']}', |
631 | 631 | `ban_issuer_email` = '{$banner['email']}' |
@@ -684,9 +684,9 @@ discard block |
||
684 | 684 | function db_ube_report_get_best_battles() { |
685 | 685 | $query = classSupernova::$db->doSelect("SELECT * |
686 | 686 | FROM `{{ube_report}}` |
687 | - WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS . " DAY)) |
|
687 | + WHERE `ube_report_time_process` < DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS." DAY)) |
|
688 | 688 | ORDER BY `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC |
689 | - LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW . ";"); |
|
689 | + LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW.";"); |
|
690 | 690 | |
691 | 691 | return $query; |
692 | 692 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $qry[] = "('{$item_name}', '{$item_value}')"; |
97 | 97 | } |
98 | 98 | } |
99 | - classSupernova::$db->doReplace("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
|
99 | + classSupernova::$db->doReplace("REPLACE INTO `{{".$this->table_name."}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES ".implode(',', $qry).";"); |
|
100 | 100 | |
101 | 101 | // И только после взятия блокировок - меняем значения в кэше |
102 | 102 | foreach ($item_list as $item_name => $item_value) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $note_id_edit |
37 | 37 | */ |
38 | 38 | public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
39 | - classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
39 | + classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
40 | 40 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
41 | 41 | WHERE `id` = {$note_id_edit} LIMIT 1;"); |
42 | 42 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param $note_sticky |
54 | 54 | */ |
55 | 55 | public static function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) { |
56 | - classSupernova::$db->doInsert("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
56 | + classSupernova::$db->doInsert("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
57 | 57 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};"); |
58 | 58 | } |
59 | 59 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | ->setIdField($entity->getIdFieldName()) |
19 | 19 | ->field('*') |
20 | 20 | ->from($entity->getTableName()) |
21 | - ->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"'); |
|
21 | + ->where($entity->getIdFieldName().' = "'.$entity->dbId.'"'); |
|
22 | 22 | |
23 | 23 | return $stmt->selectRow(); |
24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function deleteById($entity) { |
30 | 30 | $db = $entity->getDbStatic(); |
31 | 31 | |
32 | - $db->doDelete("DELETE FROM `{{" . $entity->getTableName() . "}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;"); |
|
32 | + $db->doDelete("DELETE FROM `{{".$entity->getTableName()."}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;"); |
|
33 | 33 | |
34 | 34 | return $db->db_affected_rows(); |
35 | 35 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $query = array(); |
44 | 44 | foreach ($entity->exportRowWithoutId() as $fieldName => $fieldValue) { |
45 | 45 | // TODO: MORE type detection |
46 | - if(!is_numeric($fieldValue)) { |
|
47 | - $fieldValue = "'" . $db->db_escape($fieldValue) . "'"; |
|
46 | + if (!is_numeric($fieldValue)) { |
|
47 | + $fieldValue = "'".$db->db_escape($fieldValue)."'"; |
|
48 | 48 | } |
49 | 49 | $query[] = "`{$fieldName}` = {$fieldValue}"; |
50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | return 0; |
56 | 56 | } |
57 | 57 | |
58 | - $db->doInsert("INSERT INTO `{{" . $entity->getTableName() . "}}` SET " . $query); |
|
58 | + $db->doInsert("INSERT INTO `{{".$entity->getTableName()."}}` SET ".$query); |
|
59 | 59 | |
60 | 60 | // TODO Exceptiion if db_insert_id() is empty |
61 | 61 | return $entity->dbId = $db->db_insert_id(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param db_mysql|null $db |
87 | 87 | */ |
88 | 88 | public static function setDb($db = null) { |
89 | - if(empty($db) || !($db instanceof db_mysql)) { |
|
89 | + if (empty($db) || !($db instanceof db_mysql)) { |
|
90 | 90 | $db = null; |
91 | 91 | } |
92 | 92 | static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function dbLoad($dbId, $lockSkip = false) { |
150 | 150 | $dbId = idval($dbId); |
151 | 151 | if ($dbId <= 0) { |
152 | - classSupernova::$debug->error(get_called_class() . '::' . __METHOD__ . ' $dbId not positive = ' . $dbId); |
|
152 | + classSupernova::$debug->error(get_called_class().'::'.__METHOD__.' $dbId not positive = '.$dbId); |
|
153 | 153 | |
154 | 154 | return; |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $this->dbGetLockById($this->_dbId); |
162 | 162 | } |
163 | 163 | |
164 | - $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;"); |
|
164 | + $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;"); |
|
165 | 165 | if (empty($db_row)) { |
166 | 166 | return; |
167 | 167 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($this->isNew()) { |
194 | 194 | // No DB_ID - new unit |
195 | 195 | if ($this->isEmpty()) { |
196 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave'); |
|
196 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave'); |
|
197 | 197 | } |
198 | 198 | $this->dbInsert(); |
199 | 199 | } else { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->dbDelete(); |
203 | 203 | } else { |
204 | 204 | if (!sn_db_transaction_check(false)) { |
205 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate'); |
|
205 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate'); |
|
206 | 206 | } |
207 | 207 | $this->dbUpdate(); |
208 | 208 | } |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | // TODO - protected |
231 | 231 | public function dbInsert() { |
232 | 232 | if (!$this->isNew()) { |
233 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert'); |
|
233 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert'); |
|
234 | 234 | } |
235 | 235 | $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet()); |
236 | 236 | |
237 | 237 | if (empty($this->_dbId)) { |
238 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert'); |
|
238 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert'); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | return $this->_dbId; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | public function dbUpdate() { |
249 | 249 | // TODO - Update |
250 | 250 | if ($this->isNew()) { |
251 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate'); |
|
251 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate'); |
|
252 | 252 | } |
253 | 253 | $this->db_field_update($this->dbMakeFieldSet(true)); |
254 | 254 | } |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | // TODO - protected |
260 | 260 | public function dbDelete() { |
261 | 261 | if ($this->isNew()) { |
262 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete'); |
|
262 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete'); |
|
263 | 263 | } |
264 | - classSupernova::$db->doDelete("DELETE FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId); |
|
264 | + classSupernova::$db->doDelete("DELETE FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId); |
|
265 | 265 | $this->_dbId = 0; |
266 | 266 | // Обо всём остальном должен позаботиться контейнер |
267 | 267 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $fields = implode(',', array_keys($field_set)); |
415 | 415 | |
416 | 416 | $result = 0; |
417 | - if (classSupernova::$db->doInsert("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
417 | + if (classSupernova::$db->doInsert("INSERT INTO `{{".static::$_table."}}` ({$fields}) VALUES ({$values});")) { |
|
418 | 418 | $result = classSupernova::$db->db_insert_id(); |
419 | 419 | } |
420 | 420 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | return empty($set_string) |
452 | 452 | ? true |
453 | - : classSupernova::$db->doUpdate("UPDATE `{{" . static::$_table . "}}` SET {$set_string} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId); |
|
453 | + : classSupernova::$db->doUpdate("UPDATE `{{".static::$_table."}}` SET {$set_string} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | `ally_name` = '{$ally_name}', |
67 | 67 | `ally_tag` = '{$ally_tag}', |
68 | 68 | `ally_owner` = '{$user['id']}', |
69 | - `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "', |
|
69 | + `ally_owner_range` = '".classLocale::$lang['ali_leaderRank']."', |
|
70 | 70 | `ally_members` = 1, |
71 | - `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0', |
|
71 | + `ranklist` = '" . classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0', |
|
72 | 72 | `ally_register_time`= " . SN_TIME_NOW |
73 | 73 | ); |
74 | 74 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param $POST_text |
90 | 90 | */ |
91 | 91 | public static function db_ally_request_insert($user, $id_ally, $POST_text) { |
92 | - classSupernova::$db->doInsert("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";"); |
|
92 | + classSupernova::$db->doInsert("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=".SN_TIME_NOW.";"); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param $ally |
140 | 140 | */ |
141 | 141 | public static function db_ally_update_by_changeset($ally_changeset, $ally) { |
142 | - classSupernova::$db->doUpdate("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
142 | + classSupernova::$db->doUpdate("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param $d |
251 | 251 | */ |
252 | 252 | public static function db_ally_request_deny($d) { |
253 | - classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;"); |
|
253 | + classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;"); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | JOIN {{users}} AS u ON u.id = cp.chat_player_player_id |
13 | 13 | WHERE |
14 | 14 | `chat_player_refresh_last` >= '{$sql_date}' |
15 | - AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ") |
|
15 | + AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.") |
|
16 | 16 | {$ally_add} |
17 | 17 | ORDER BY authlevel DESC, `username`"); |
18 | 18 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | `user` = '{$nick}', |
36 | 36 | `ally_id` = '{$ally_id}', |
37 | 37 | `message` = '{$message}', |
38 | - `timestamp` = " . SN_TIME_NOW . ", |
|
38 | + `timestamp` = ".SN_TIME_NOW.", |
|
39 | 39 | `chat_message_sender_name` = '{$chat_message_sender_name}', |
40 | 40 | `chat_message_recipient_id` = {$chat_message_recipient_id}, |
41 | 41 | `chat_message_recipient_name` = '{$chat_message_recipient_name}'" |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param $user |
142 | 142 | */ |
143 | 143 | public static function db_chat_player_update($user) { |
144 | - classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
144 | + classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param $user |
213 | 213 | */ |
214 | 214 | public static function db_chat_player_update_activity($user) { |
215 | - classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '" . classSupernova::$db->db_escape(SN_TIME_SQL) . "' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
215 | + classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | } |
219 | 219 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @return array|bool|mysqli_result|null |
24 | 24 | */ |
25 | 25 | public static function db_missile_list_by_arrival() { |
26 | - $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;"); |
|
26 | + $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;"); |
|
27 | 27 | |
28 | 28 | return $iraks; |
29 | 29 | } |