@@ -110,6 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | /** |
112 | 112 | * @param BuddyContainer $cBuddy |
113 | + * @param BuddyContainer $params |
|
113 | 114 | * |
114 | 115 | * @throws BuddyException |
115 | 116 | */ |
@@ -154,6 +155,7 @@ discard block |
||
154 | 155 | * If it is own request - it will be deleted |
155 | 156 | * |
156 | 157 | * @param BuddyContainer $cBuddy |
158 | + * @param BuddyContainer $params |
|
157 | 159 | * |
158 | 160 | * @throws BuddyException |
159 | 161 | */ |
@@ -13,7 +13,7 @@ |
||
13 | 13 | ->setIdField($cModel->getIdFieldName()) |
14 | 14 | ->field('*') |
15 | 15 | ->from($cModel->getTableName()) |
16 | - ->where($cModel->getIdFieldName() . ' = "' . $dbId . '"'); |
|
16 | + ->where($cModel->getIdFieldName().' = "'.$dbId.'"'); |
|
17 | 17 | |
18 | 18 | return $stmt->selectRow(); |
19 | 19 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function load_db_settings($configFile = '') { |
92 | 92 | $dbsettings = array(); |
93 | 93 | |
94 | - empty($configFile) ? $configFile = SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX : false; |
|
94 | + empty($configFile) ? $configFile = SN_ROOT_PHYSICAL."config".DOT_PHP_EX : false; |
|
95 | 95 | |
96 | 96 | require $configFile; |
97 | 97 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | if (empty($this->dbsettings)) { |
114 | - $this->load_db_settings(SN_ROOT_PHYSICAL . "config.php"); |
|
114 | + $this->load_db_settings(SN_ROOT_PHYSICAL."config.php"); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $sql = $query; |
164 | 164 | if (strpos($sql, '{{') !== false) { |
165 | 165 | foreach ($this->table_list as $tableName) { |
166 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
166 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | |
235 | 235 | $queryResult = null; |
236 | 236 | try { |
237 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
237 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
238 | 238 | if (!$queryResult) { |
239 | 239 | throw new Exception(); |
240 | 240 | } |
241 | 241 | } catch (Exception $e) { |
242 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
242 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | return $queryResult; |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function doSelectDanger($table, $fields, $where = array(), $isOneRecord = DB_RECORDS_ALL, $forUpdate = DB_SELECT_PLAIN) { |
293 | 293 | // TODO - TEMPORARY UNTIL DbQuery |
294 | - if(!empty($where)) { |
|
294 | + if (!empty($where)) { |
|
295 | 295 | foreach ($where as $key => &$value) { |
296 | - if(!is_int($key)) { |
|
297 | - $value = "`$key` = '" . $this->db_escape($value). "'"; |
|
296 | + if (!is_int($key)) { |
|
297 | + $value = "`$key` = '".$this->db_escape($value)."'"; |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | 302 | $query = |
303 | - "SELECT " . implode(',', $fields) . |
|
304 | - " FROM `{{{$table}}}`" . |
|
305 | - (!empty($where) ? ' WHERE ' . implode(' AND ', $where) : '') . |
|
306 | - ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : '') . |
|
303 | + "SELECT ".implode(',', $fields). |
|
304 | + " FROM `{{{$table}}}`". |
|
305 | + (!empty($where) ? ' WHERE '.implode(' AND ', $where) : ''). |
|
306 | + ($isOneRecord == DB_RECORD_ONE ? ' LIMIT 1' : ''). |
|
307 | 307 | ($forUpdate == DB_SELECT_FOR_UPDATE ? ' FOR UPDATE' : '') |
308 | 308 | ; |
309 | 309 | |
@@ -613,10 +613,10 @@ discard block |
||
613 | 613 | $this->isWatching = true; |
614 | 614 | $msg = "\$query = \"{$query}\"\n\r"; |
615 | 615 | if (!empty($_POST)) { |
616 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
616 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
617 | 617 | } |
618 | 618 | if (!empty($_GET)) { |
619 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
619 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
620 | 620 | } |
621 | 621 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
622 | 622 | $this->isWatching = false; |
@@ -642,37 +642,37 @@ discard block |
||
642 | 642 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
643 | 643 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
644 | 644 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
645 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
645 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
646 | 646 | $report .= ">Database Inforamation\n"; |
647 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
648 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
649 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
650 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
651 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
652 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
653 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
654 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
655 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
656 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
647 | + $report .= "\tID - ".$user['id']."\n"; |
|
648 | + $report .= "\tUser - ".$user['username']."\n"; |
|
649 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
650 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
651 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
652 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
653 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
654 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
655 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
656 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
657 | 657 | $report .= "\n"; |
658 | 658 | |
659 | 659 | $report .= ">Query Information\n"; |
660 | - $report .= "\tQuery - " . $query . "\n"; |
|
660 | + $report .= "\tQuery - ".$query."\n"; |
|
661 | 661 | $report .= "\n"; |
662 | 662 | |
663 | 663 | $report .= ">\$_SERVER Information\n"; |
664 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
665 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
666 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
667 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
668 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
669 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
670 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
671 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
664 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
665 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
666 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
667 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
668 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
669 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
670 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
671 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
672 | 672 | |
673 | 673 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
674 | 674 | |
675 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
675 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
676 | 676 | fwrite($fp, $report); |
677 | 677 | fclose($fp); |
678 | 678 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | parent::__construct(); |
91 | 91 | |
92 | 92 | $this->assignAccessor('type', P_CONTAINER_SET, |
93 | - function (V2UnitContainer $that, $value) { |
|
93 | + function(V2UnitContainer $that, $value) { |
|
94 | 94 | $that->setDirect('type', $value); |
95 | 95 | $array = get_unit_param($value); |
96 | 96 | $that->unitInfo = $array; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | ); |
104 | 104 | $this->assignAccessor('type', P_CONTAINER_UNSET, |
105 | - function (V2UnitContainer $that, $value) { |
|
105 | + function(V2UnitContainer $that, $value) { |
|
106 | 106 | $that->setDirect('type', $value); |
107 | 107 | $array = get_unit_param($value); |
108 | 108 | $that->unitInfo = $array; |
@@ -129,7 +129,7 @@ |
||
129 | 129 | if (is_callable($callable)) { |
130 | 130 | $this->{$type}[$varName] = $callable; |
131 | 131 | } else { |
132 | - throw new Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $type . '] is not a callable or not accessible in the scope'); |
|
132 | + throw new Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$type.'] is not a callable or not accessible in the scope'); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |