@@ -286,7 +286,6 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * Функция пытается залогиниться по всем известным провайдерам |
288 | 288 | * |
289 | - * @param null $result |
|
290 | 289 | */ |
291 | 290 | public function login() { |
292 | 291 | if(empty(sn_module::$sn_module_list['auth'])) { |
@@ -823,10 +822,17 @@ discard block |
||
823 | 822 | |
824 | 823 | // OK v4.5 |
825 | 824 | // TODO - REMEMBER_ME |
825 | + |
|
826 | + /** |
|
827 | + * @param integer $period |
|
828 | + */ |
|
826 | 829 | protected static function cookie_set($value, $impersonate = false, $period = null) { |
827 | 830 | sn_setcookie($impersonate ? SN_COOKIE_U_I : SN_COOKIE_U, $value, $period === null ? SN_TIME_NOW + PERIOD_YEAR : $period, SN_ROOT_RELATIVE); |
828 | 831 | } |
829 | 832 | |
833 | + /** |
|
834 | + * @param string $message |
|
835 | + */ |
|
830 | 836 | protected static function flog($message, $die = false) { |
831 | 837 | if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
832 | 838 | return; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // Проверить наличие такого имени в истории имён |
223 | 223 | do { |
224 | 224 | sn_db_transaction_rollback(); |
225 | - $this->player_suggested_name = 'Emperor ' . mt_rand($max_user_id + 1, $max_user_id + 1000); |
|
225 | + $this->player_suggested_name = 'Emperor '.mt_rand($max_user_id + 1, $max_user_id + 1000); |
|
226 | 226 | sn_db_transaction_start(); |
227 | 227 | } while (db_player_name_exists($this->player_suggested_name)); |
228 | 228 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($player_name_submitted) { |
232 | 232 | $this->register_player_db_create($this->player_suggested_name); // OK 4.5 |
233 | 233 | if ($this->register_status == LOGIN_SUCCESS) { |
234 | - sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
|
234 | + sys_redirect(SN_ROOT_VIRTUAL.'overview.php'); |
|
235 | 235 | } elseif ($this->register_status == REGISTER_ERROR_PLAYER_NAME_EXISTS && $original_suggest == $this->player_suggested_name) { |
236 | 236 | // self::$player_suggested_name .= ' ' . $this->account->account_id; |
237 | 237 | } |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | ); |
258 | 258 | |
259 | 259 | if ($this->register_status == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
260 | - $prohibited_characters = array_map(function ($value) { |
|
261 | - return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
|
260 | + $prohibited_characters = array_map(function($value) { |
|
261 | + return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'"; |
|
262 | 262 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
263 | 263 | $template_result[F_PLAYER_REGISTER_MESSAGE] .= implode(', ', $prohibited_characters); |
264 | 264 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | foreach ($this->providers as $provider_id => $provider) { |
307 | 307 | $login_status = $provider->login(); // OK v4.5 |
308 | - self::flog(($provider->manifest['name'] . '->' . 'login_try - ') . (empty($provider->account->account_id) ? classLocale::$lang['sys_login_messages'][$provider->account_login_status] : dump($provider))); |
|
308 | + self::flog(($provider->manifest['name'].'->'.'login_try - ').(empty($provider->account->account_id) ? classLocale::$lang['sys_login_messages'][$provider->account_login_status] : dump($provider))); |
|
309 | 309 | if ($login_status == LOGIN_SUCCESS && is_object($provider->account) && $provider->account instanceof Account && $provider->account->account_id) { |
310 | 310 | $this->providers_authorised[$provider_id] = &$this->providers[$provider_id]; |
311 | 311 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | if (!$this->is_player_register) { |
346 | 346 | // Нет - отправляем на процесс регистрации |
347 | 347 | $partner_id = sys_get_param_int('id_ref', sys_get_param_int('partner_id')); |
348 | - sys_redirect(SN_ROOT_VIRTUAL . 'index.php?page=player_register&player_register=1' . ($partner_id ? '&id_ref=' . $partner_id : '')); |
|
348 | + sys_redirect(SN_ROOT_VIRTUAL.'index.php?page=player_register&player_register=1'.($partner_id ? '&id_ref='.$partner_id : '')); |
|
349 | 349 | } |
350 | 350 | } else { |
351 | 351 | // Да, есть доступные игроки, которые так же прописаны в базе |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | if ($redirect === true) { |
408 | - sys_redirect(SN_ROOT_RELATIVE . (empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php')); |
|
408 | + sys_redirect(SN_ROOT_RELATIVE.(empty($_COOKIE[SN_COOKIE_U]) ? 'login.php' : 'admin/overview.php')); |
|
409 | 409 | } elseif ($redirect !== false) { |
410 | 410 | sys_redirect($redirect); |
411 | 411 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | */ |
802 | 802 | // OK v4 |
803 | 803 | public static function password_encode($password, $salt) { |
804 | - return md5($password . $salt); |
|
804 | + return md5($password.$salt); |
|
805 | 805 | } |
806 | 806 | /** |
807 | 807 | * Генерирует соль |
@@ -827,10 +827,10 @@ discard block |
||
827 | 827 | } |
828 | 828 | list($called, $caller) = debug_backtrace(false); |
829 | 829 | $caller_name = |
830 | - (!empty($caller['class']) ? $caller['class'] : '') . |
|
831 | - (!empty($caller['type']) ? $caller['type'] : '') . |
|
832 | - (!empty($caller['function']) ? $caller['function'] : '') . |
|
833 | - (!empty($called['line']) ? ':' . $called['line'] : ''); |
|
830 | + (!empty($caller['class']) ? $caller['class'] : ''). |
|
831 | + (!empty($caller['type']) ? $caller['type'] : ''). |
|
832 | + (!empty($caller['function']) ? $caller['function'] : ''). |
|
833 | + (!empty($called['line']) ? ':'.$called['line'] : ''); |
|
834 | 834 | |
835 | 835 | $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false; |
836 | 836 | |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | if ($die) { |
839 | 839 | // pdump($caller); |
840 | 840 | // pdump(debug_backtrace(false)); |
841 | - $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
|
841 | + $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в ".get_called_class()." (располагается в ".get_class()."). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * @param string $query |
159 | 159 | * |
160 | - * @return mixed|string |
|
160 | + * @return string |
|
161 | 161 | */ |
162 | 162 | public function replaceTablePlaceholders($query) { |
163 | 163 | $sql = $query; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | - * @param $query |
|
174 | + * @param string $query |
|
175 | 175 | */ |
176 | 176 | protected function logQuery($query) { |
177 | 177 | if (!classSupernova::$config->debug) { |
@@ -286,6 +286,7 @@ discard block |
||
286 | 286 | * @param array $fields |
287 | 287 | * @param array $where |
288 | 288 | * @param bool $isOneRecord |
289 | + * @param boolean $forUpdate |
|
289 | 290 | * |
290 | 291 | * @return array|bool|mysqli_result|null |
291 | 292 | */ |
@@ -331,6 +332,11 @@ discard block |
||
331 | 332 | |
332 | 333 | |
333 | 334 | // INSERT/REPLACE |
335 | + |
|
336 | + /** |
|
337 | + * @param string $table |
|
338 | + * @param integer $replace |
|
339 | + */ |
|
334 | 340 | protected function doSet($table, $fieldsAndValues, $replace = DB_INSERT_PLAIN) { |
335 | 341 | $query = DbQuery::build($this) |
336 | 342 | ->setTable($table) |
@@ -368,6 +374,10 @@ discard block |
||
368 | 374 | |
369 | 375 | |
370 | 376 | // INSERTERS |
377 | + |
|
378 | + /** |
|
379 | + * @param string $query |
|
380 | + */ |
|
371 | 381 | public function doInsertComplex($query) { |
372 | 382 | return $this->doSql($query); |
373 | 383 | } |
@@ -387,7 +397,7 @@ discard block |
||
387 | 397 | * Values should be passed as-is |
388 | 398 | * |
389 | 399 | * @param string $table |
390 | - * @param array $fields |
|
400 | + * @param string[] $fields |
|
391 | 401 | * @param string[] $values |
392 | 402 | * |
393 | 403 | * @return array|bool|mysqli_result|null |
@@ -440,7 +450,7 @@ discard block |
||
440 | 450 | * Self-contained - means no params used |
441 | 451 | * Such queries usually used to make large amount of in-base calculations |
442 | 452 | * |
443 | - * @param $query |
|
453 | + * @param string $query |
|
444 | 454 | * |
445 | 455 | * @return array|bool|mysqli_result|null |
446 | 456 | */ |
@@ -457,13 +467,16 @@ discard block |
||
457 | 467 | } |
458 | 468 | |
459 | 469 | /** |
460 | - * @param $DbQuery DbQuery |
|
470 | + * @param DbQuery $DbQuery DbQuery |
|
461 | 471 | */ |
462 | 472 | public function doUpdateDbQueryAdjust($DbQuery) { |
463 | 473 | return $this->doUpdateDbQuery($DbQuery); |
464 | 474 | } |
465 | 475 | |
466 | 476 | |
477 | + /** |
|
478 | + * @param boolean $isOneRecord |
|
479 | + */ |
|
467 | 480 | protected function doUpdateWhere($table, $fieldsSet, $fieldsAdjust = array(), $where = array(), $isOneRecord = DB_RECORDS_ALL, $whereDanger = array()) { |
468 | 481 | $query = DbQuery::build($this) |
469 | 482 | ->setTable($table) |
@@ -482,6 +495,9 @@ discard block |
||
482 | 495 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORD_ONE); |
483 | 496 | } |
484 | 497 | |
498 | + /** |
|
499 | + * @param string $table |
|
500 | + */ |
|
485 | 501 | public function doUpdateTableSet($table, $fieldsAndValues, $where = array()) { |
486 | 502 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORDS_ALL); |
487 | 503 | } |
@@ -597,6 +613,10 @@ discard block |
||
597 | 613 | } |
598 | 614 | |
599 | 615 | // TODO Заменить это на новый логгер |
616 | + |
|
617 | + /** |
|
618 | + * @param string $query |
|
619 | + */ |
|
600 | 620 | protected function security_watch_user_queries($query) { |
601 | 621 | global $user; |
602 | 622 | |
@@ -620,6 +640,9 @@ discard block |
||
620 | 640 | } |
621 | 641 | |
622 | 642 | |
643 | + /** |
|
644 | + * @param string $query |
|
645 | + */ |
|
623 | 646 | public function security_query_check_bad_words($query) { |
624 | 647 | if ($this->skipQueryCheck) { |
625 | 648 | return; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function load_db_settings($configFile = '') { |
99 | 99 | $dbsettings = array(); |
100 | 100 | |
101 | - empty($configFile) ? $configFile = SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX : false; |
|
101 | + empty($configFile) ? $configFile = SN_ROOT_PHYSICAL."config".DOT_PHP_EX : false; |
|
102 | 102 | |
103 | 103 | require $configFile; |
104 | 104 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | if (empty($this->dbsettings)) { |
121 | - $this->load_db_settings(SN_ROOT_PHYSICAL . "config.php"); |
|
121 | + $this->load_db_settings(SN_ROOT_PHYSICAL."config.php"); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $sql = $query; |
171 | 171 | if (strpos($sql, '{{') !== false) { |
172 | 172 | foreach ($this->table_list as $tableName) { |
173 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
173 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -241,12 +241,12 @@ discard block |
||
241 | 241 | |
242 | 242 | $queryResult = null; |
243 | 243 | try { |
244 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
244 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
245 | 245 | if (!$queryResult) { |
246 | 246 | throw new Exception(); |
247 | 247 | } |
248 | 248 | } catch (Exception $e) { |
249 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
249 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $queryResult; |
@@ -300,16 +300,16 @@ discard block |
||
300 | 300 | if (!empty($where)) { |
301 | 301 | foreach ($where as $key => &$value) { |
302 | 302 | if (!is_int($key)) { |
303 | - $value = "`$key` = '" . $this->db_escape($value) . "'"; |
|
303 | + $value = "`$key` = '".$this->db_escape($value)."'"; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | 308 | $query = |
309 | - "SELECT " . implode(',', $fields) . |
|
310 | - " FROM `{{{$table}}}`" . |
|
311 | - (!empty($where) ? ' WHERE ' . implode(' AND ', $where) : '') . |
|
312 | - ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : '') . |
|
309 | + "SELECT ".implode(',', $fields). |
|
310 | + " FROM `{{{$table}}}`". |
|
311 | + (!empty($where) ? ' WHERE '.implode(' AND ', $where) : ''). |
|
312 | + ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : ''). |
|
313 | 313 | ($forUpdate == DB_SELECT_FOR_UPDATE ? ' FOR UPDATE' : ''); |
314 | 314 | |
315 | 315 | return $this->doSql($query); |
@@ -603,10 +603,10 @@ discard block |
||
603 | 603 | $this->isWatching = true; |
604 | 604 | $msg = "\$query = \"{$query}\"\n\r"; |
605 | 605 | if (!empty($_POST)) { |
606 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
606 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
607 | 607 | } |
608 | 608 | if (!empty($_GET)) { |
609 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
609 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
610 | 610 | } |
611 | 611 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
612 | 612 | $this->isWatching = false; |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | |
622 | 622 | global $user, $dm_change_legit, $mm_change_legit; |
623 | 623 | |
624 | - switch(true) { |
|
624 | + switch (true) { |
|
625 | 625 | case stripos($query, 'RUNCATE TABL') != false: |
626 | 626 | case stripos($query, 'ROP TABL') != false: |
627 | 627 | case stripos($query, 'ENAME TABL') != false: |
@@ -632,37 +632,37 @@ discard block |
||
632 | 632 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
633 | 633 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
634 | 634 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
635 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
635 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
636 | 636 | $report .= ">Database Inforamation\n"; |
637 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
638 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
639 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
640 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
641 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
642 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
643 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
644 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
645 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
646 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
637 | + $report .= "\tID - ".$user['id']."\n"; |
|
638 | + $report .= "\tUser - ".$user['username']."\n"; |
|
639 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
640 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
641 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
642 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
643 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
644 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
645 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
646 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
647 | 647 | $report .= "\n"; |
648 | 648 | |
649 | 649 | $report .= ">Query Information\n"; |
650 | - $report .= "\tQuery - " . $query . "\n"; |
|
650 | + $report .= "\tQuery - ".$query."\n"; |
|
651 | 651 | $report .= "\n"; |
652 | 652 | |
653 | 653 | $report .= ">\$_SERVER Information\n"; |
654 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
655 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
656 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
657 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
658 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
659 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
660 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
661 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
654 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
655 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
656 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
657 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
658 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
659 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
660 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
661 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
662 | 662 | |
663 | 663 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
664 | 664 | |
665 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
665 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
666 | 666 | fwrite($fp, $report); |
667 | 667 | fclose($fp); |
668 | 668 | |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | $prefix_length = strlen($this->db_prefix); |
684 | 684 | |
685 | 685 | $tl = array(); |
686 | - while($row = $this->db_fetch($query)) { |
|
686 | + while ($row = $this->db_fetch($query)) { |
|
687 | 687 | foreach ($row as $table_name) { |
688 | 688 | if (strpos($table_name, $this->db_prefix) === 0) { |
689 | 689 | $table_name = substr($table_name, $prefix_length); |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | if (is_bool($query)) { |
818 | 818 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
819 | 819 | } |
820 | - while($row = db_fetch($query)) { |
|
820 | + while ($row = db_fetch($query)) { |
|
821 | 821 | $result[$row['Variable_name']] = $row['Value']; |
822 | 822 | } |
823 | 823 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
40 | 40 | * <p>false - всё равно - для совместимости с $for_update</p> |
41 | 41 | * |
42 | - * @return bool Текущий статус транзакции |
|
42 | + * @return null|boolean Текущий статус транзакции |
|
43 | 43 | */ |
44 | 44 | public function check($status = null) { |
45 | 45 | $error_msg = false; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | if (!empty($error_msg)) { |
60 | 60 | // TODO - Убрать позже |
61 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
61 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
62 | 62 | $backtrace = debug_backtrace(); |
63 | 63 | array_shift($backtrace); |
64 | 64 | pdump($backtrace); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function start($level = '') { |
72 | 72 | $this->check(null); |
73 | 73 | |
74 | - $level ? $this->db->doSql('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
74 | + $level ? $this->db->doSql('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
75 | 75 | |
76 | 76 | $this->transaction_id++; |
77 | 77 | $this->db->doSql('START TRANSACTION'); |
@@ -85,6 +85,9 @@ |
||
85 | 85 | return $this->db->doSelectIterator($query); |
86 | 86 | } |
87 | 87 | |
88 | + /** |
|
89 | + * @param string $table |
|
90 | + */ |
|
88 | 91 | public function doUpdateRowSetAffected($table, $fieldsAndValues, $where) { |
89 | 92 | $this->db->doUpdateRowSet($table, $fieldsAndValues, $where); |
90 | 93 | return $this->db->db_affected_rows(); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | - * @param mixed $value |
|
29 | + * @param string $value |
|
30 | 30 | * |
31 | 31 | * @return $this |
32 | 32 | */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return $this |
32 | 32 | */ |
33 | 33 | public function literal($value) { |
34 | - $this->literal = (string)$value; |
|
34 | + $this->literal = (string) $value; |
|
35 | 35 | |
36 | 36 | return $this; |
37 | 37 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $alias = $this->aliasFromField($functionName, $field); |
65 | 65 | } |
66 | 66 | |
67 | - $this->literal = strtoupper($functionName) . '(' . $this->quoteField($field) . ')'; |
|
67 | + $this->literal = strtoupper($functionName).'('.$this->quoteField($field).')'; |
|
68 | 68 | |
69 | 69 | if (self::SQL_LITERAL_ALIAS_NONE !== $alias && !empty($alias)) { |
70 | - $this->literal .= ' AS `' . $alias . '`'; |
|
70 | + $this->literal .= ' AS `'.$alias.'`'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $this; |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $alias = $this->aliasFromField($functionName, $field); |
125 | 125 | } |
126 | 126 | |
127 | - $this->literal = $this->quoteField($field) . ' IS NULL'; |
|
127 | + $this->literal = $this->quoteField($field).' IS NULL'; |
|
128 | 128 | |
129 | 129 | if (!empty($alias)) { |
130 | - $this->literal .= ' AS `' . $alias . '`'; |
|
130 | + $this->literal .= ' AS `'.$alias.'`'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $this; |
@@ -293,7 +293,7 @@ |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | - * @param $ranklist |
|
296 | + * @param string $ranklist |
|
297 | 297 | * @param $user |
298 | 298 | */ |
299 | 299 | public static function db_ally_update_ranklist($ranklist, $user) { |
@@ -72,12 +72,12 @@ |
||
72 | 72 | */ |
73 | 73 | public static function db_ally_insert($ally_name_unsafe, $ally_tag_unsafe, $userId) { |
74 | 74 | $ally = classSupernova::$db->doInsertSet(TABLE_ALLIANCE, array( |
75 | - 'ally_name' => (string)$ally_name_unsafe, |
|
76 | - 'ally_tag' => (string)$ally_tag_unsafe, |
|
75 | + 'ally_name' => (string) $ally_name_unsafe, |
|
76 | + 'ally_tag' => (string) $ally_tag_unsafe, |
|
77 | 77 | 'ally_owner' => $userId, |
78 | - 'ally_owner_range' => (string)classLocale::$lang['ali_leaderRank'], |
|
79 | - 'ally_members' => (int)1, |
|
80 | - 'ranklist' => (string)(classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0"), |
|
78 | + 'ally_owner_range' => (string) classLocale::$lang['ali_leaderRank'], |
|
79 | + 'ally_members' => (int) 1, |
|
80 | + 'ranklist' => (string) (classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0"), |
|
81 | 81 | 'ally_register_time' => SN_TIME_NOW, |
82 | 82 | )); |
83 | 83 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param $user_id |
22 | - * @param $nickUnsafe |
|
22 | + * @param string $nickUnsafe |
|
23 | 23 | * @param $ally_id |
24 | 24 | * @param $message_unsafe |
25 | 25 | * @param $chat_message_sender_name_unsafe |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param $alliance |
55 | 55 | * @param $where_add |
56 | 56 | * @param $start_row |
57 | - * @param $page_limit |
|
57 | + * @param integer $page_limit |
|
58 | 58 | * |
59 | 59 | * @return array|bool|mysqli_result|null |
60 | 60 | */ |
@@ -12,7 +12,7 @@ |
||
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 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * @param $fleet_group_id_list |
|
78 | + * @param string $fleet_group_id_list |
|
79 | 79 | */ |
80 | 80 | public static function db_acs_delete_by_list($fleet_group_id_list) { |
81 | 81 | doquery("DELETE FROM {{aks}} WHERE `id` IN ({$fleet_group_id_list})"); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public static function db_acs_insert($fleetid, $userId, $objFleet) { |
53 | 53 | classSupernova::$db->doInsertSet(TABLE_AKS, array( |
54 | - 'name' => classLocale::$lang['flt_acs_prefix'] . $fleetid, |
|
54 | + 'name' => classLocale::$lang['flt_acs_prefix'].$fleetid, |
|
55 | 55 | 'teilnehmer' => $userId, |
56 | 56 | 'flotten' => $fleetid, |
57 | 57 | 'ankunft' => $objFleet->time_arrive_to_target, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * @param $user |
7 | 7 | * @param $planet_dst |
8 | - * @param $time_limit |
|
8 | + * @param integer $time_limit |
|
9 | 9 | * |
10 | 10 | * @return array|bool|mysqli_result|null |
11 | 11 | */ |