@@ -78,6 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | + /** |
|
82 | + * @param integer $config_user_birthday_range |
|
83 | + */ |
|
81 | 84 | public static function db_user_list_to_celebrate($config_user_birthday_range) { |
82 | 85 | return doquery( |
83 | 86 | "SELECT |
@@ -163,6 +166,9 @@ discard block |
||
163 | 166 | } |
164 | 167 | |
165 | 168 | |
169 | + /** |
|
170 | + * @param boolean $player |
|
171 | + */ |
|
166 | 172 | public static function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { |
167 | 173 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); |
168 | 174 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | static::buildSelect() |
55 | 55 | ->fields('id') |
56 | 56 | ->where(array( |
57 | - "`user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . " FOR UPDATE;" |
|
57 | + "`user_as_ally` IS NULL AND `user_bot` = ".USER_BOT_PLAYER." FOR UPDATE;" |
|
58 | 58 | )) |
59 | 59 | ); |
60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // ); |
70 | 70 | |
71 | 71 | return static::prepareExecute( |
72 | - "SELECT 1 FROM {{users}} WHERE `id` = :userId" . |
|
72 | + "SELECT 1 FROM {{users}} WHERE `id` = :userId". |
|
73 | 73 | (!empty($planet['id_owner']) ? ' OR `id` = :planetOwnerId' : ''), |
74 | 74 | array( |
75 | 75 | ':userId' => idval($user['id']), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public static function db_user_count($online = false) { |
82 | 82 | return static::prepareFetchValue( |
83 | - 'SELECT COUNT(id) AS user_count FROM `{{users}}` WHERE user_as_ally IS NULL' . |
|
83 | + 'SELECT COUNT(id) AS user_count FROM `{{users}}` WHERE user_as_ally IS NULL'. |
|
84 | 84 | ($online ? ' AND onlinetime > :onlineTime' : ''), |
85 | 85 | array( |
86 | 86 | ':onlineTime' => SN_TIME_NOW - classSupernova::$config->game_users_online_timeout, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | LEFT JOIN |
98 | 98 | {{referrals}} as r on r.id_partner = u.id |
99 | 99 | WHERE " . |
100 | - ($online ? "`onlinetime` >= :onlineTime" : 'user_as_ally IS NULL') . |
|
100 | + ($online ? "`onlinetime` >= :onlineTime" : 'user_as_ally IS NULL'). |
|
101 | 101 | " GROUP BY u.id |
102 | 102 | ORDER BY user_as_ally, {$sort} ASC", |
103 | 103 | array( |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
185 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
185 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | define('INSTALL', false); |
11 | 11 | define('IN_ADMIN', true); |
12 | 12 | |
13 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | |
15 | 15 | if ($user['authlevel'] < 3) { |
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ($value as $interval_data) { |
112 | 112 | print("<tr>"); |
113 | 113 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
114 | - print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
|
114 | + print("<td>".date(FMT_DATE_TIME_SQL, $user_record['onlinetime'])."</td>"); |
|
115 | 115 | print("</tr>"); |
116 | 116 | } |
117 | 117 | } |
@@ -45,8 +45,8 @@ |
||
45 | 45 | */ |
46 | 46 | protected function quoteStringAsFieldByRef(&$string) { |
47 | 47 | $string = $this->stringEscape($string); |
48 | - if ((string)$string && '*' != $string) { |
|
49 | - $string = '`' . $string . '`'; |
|
48 | + if ((string) $string && '*' != $string) { |
|
49 | + $string = '`'.$string.'`'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @param mixed &$value |
24 | 24 | */ |
25 | 25 | public static function makeArrayRef(&$value, $index = 0) { |
26 | - if(!is_array($value)) { |
|
26 | + if (!is_array($value)) { |
|
27 | 27 | $value = array($index => $value); |
28 | 28 | } |
29 | 29 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @param string $query |
126 | 126 | * |
127 | - * @return mixed|string |
|
127 | + * @return string |
|
128 | 128 | */ |
129 | 129 | public function replaceTablePlaceholders($query) { |
130 | 130 | $sql = $query; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * @param $query |
|
142 | - * @param $fetch |
|
141 | + * @param string $query |
|
142 | + * @param boolean $fetch |
|
143 | 143 | */ |
144 | 144 | protected function logQuery($query, $fetch) { |
145 | 145 | if (!classSupernova::$config->debug) { |
@@ -257,6 +257,10 @@ discard block |
||
257 | 257 | |
258 | 258 | |
259 | 259 | // TODO Заменить это на новый логгер |
260 | + |
|
261 | + /** |
|
262 | + * @param string $query |
|
263 | + */ |
|
260 | 264 | protected function security_watch_user_queries($query) { |
261 | 265 | global $user; |
262 | 266 | |
@@ -280,6 +284,9 @@ discard block |
||
280 | 284 | } |
281 | 285 | |
282 | 286 | |
287 | + /** |
|
288 | + * @param string $query |
|
289 | + */ |
|
283 | 290 | public function security_query_check_bad_words($query, $skip_query_check = false) { |
284 | 291 | if ($skip_query_check) { |
285 | 292 | return; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function load_db_settings() { |
66 | 66 | $dbsettings = array(); |
67 | 67 | |
68 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
68 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
69 | 69 | |
70 | 70 | $this->dbsettings = $dbsettings; |
71 | 71 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $sql = $query; |
131 | 131 | if (strpos($sql, '{{') !== false) { |
132 | 132 | foreach ($this->table_list as $tableName) { |
133 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
133 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $arr = debug_backtrace(); |
151 | 151 | $file = end(explode('/', $arr[0]['file'])); |
152 | 152 | $line = $arr[0]['line']; |
153 | - classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> " . ($fetch ? '+' : ' ') . " </th></tr>"); |
|
153 | + classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> ".($fetch ? '+' : ' ')." </th></tr>"); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | classSupernova::$debug->add_to_array($sql_comment); |
170 | 170 | } |
171 | 171 | |
172 | - $sql_commented = '/* ' . implode("<br />", $sql_comment) . '<br /> */ '; |
|
172 | + $sql_commented = '/* '.implode("<br />", $sql_comment).'<br /> */ '; |
|
173 | 173 | if (defined('DEBUG_SQL_ONLINE') && constant('DEBUG_SQL_ONLINE') === true) { |
174 | 174 | classSupernova::$debug->warning($sql_commented, 'SQL Debug', LOG_DEBUG_SQL); |
175 | 175 | } |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | ->execute() |
253 | 253 | ->getResult(); |
254 | 254 | } else { |
255 | - $queryResult = $this->db_sql_query($stringQuery . $queryTrace); |
|
255 | + $queryResult = $this->db_sql_query($stringQuery.$queryTrace); |
|
256 | 256 | } |
257 | 257 | if (!$queryResult) { |
258 | 258 | throw new Exception(); |
259 | 259 | } |
260 | 260 | } catch (Exception $e) { |
261 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
261 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | if ($fetch) { |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | $this->isWatching = true; |
284 | 284 | $msg = "\$query = \"{$query}\"\n\r"; |
285 | 285 | if (!empty($_POST)) { |
286 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
286 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
287 | 287 | } |
288 | 288 | if (!empty($_GET)) { |
289 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
289 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
290 | 290 | } |
291 | 291 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
292 | 292 | $this->isWatching = false; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | global $user, $dm_change_legit, $mm_change_legit; |
303 | 303 | |
304 | - switch(true) { |
|
304 | + switch (true) { |
|
305 | 305 | case stripos($query, 'RUNCATE TABL') != false: |
306 | 306 | case stripos($query, 'ROP TABL') != false: |
307 | 307 | case stripos($query, 'ENAME TABL') != false: |
@@ -312,37 +312,37 @@ discard block |
||
312 | 312 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
313 | 313 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
314 | 314 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
315 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
315 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
316 | 316 | $report .= ">Database Inforamation\n"; |
317 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
318 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
319 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
320 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
321 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
322 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
323 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
324 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
325 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
326 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
317 | + $report .= "\tID - ".$user['id']."\n"; |
|
318 | + $report .= "\tUser - ".$user['username']."\n"; |
|
319 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
320 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
321 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
322 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
323 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
324 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
325 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
326 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
327 | 327 | $report .= "\n"; |
328 | 328 | |
329 | 329 | $report .= ">Query Information\n"; |
330 | - $report .= "\tQuery - " . $query . "\n"; |
|
330 | + $report .= "\tQuery - ".$query."\n"; |
|
331 | 331 | $report .= "\n"; |
332 | 332 | |
333 | 333 | $report .= ">\$_SERVER Information\n"; |
334 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
335 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
336 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
337 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
338 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
339 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
340 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
341 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
334 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
335 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
336 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
337 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
338 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
339 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
340 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
341 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
342 | 342 | |
343 | 343 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
344 | 344 | |
345 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
345 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
346 | 346 | fwrite($fp, $report); |
347 | 347 | fclose($fp); |
348 | 348 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $prefix_length = strlen($this->db_prefix); |
364 | 364 | |
365 | 365 | $tl = array(); |
366 | - while($row = $this->db_fetch($query)) { |
|
366 | + while ($row = $this->db_fetch($query)) { |
|
367 | 367 | foreach ($row as $table_name) { |
368 | 368 | if (strpos($table_name, $this->db_prefix) === 0) { |
369 | 369 | $table_name = substr($table_name, $prefix_length); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | if (is_bool($query)) { |
495 | 495 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
496 | 496 | } |
497 | - while($row = db_fetch($query)) { |
|
497 | + while ($row = db_fetch($query)) { |
|
498 | 498 | $result[$row['Variable_name']] = $row['Value']; |
499 | 499 | } |
500 | 500 |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $query |
|
64 | + */ |
|
62 | 65 | public function setQuery($query) { |
63 | 66 | $this->query = $query; |
64 | 67 | |
@@ -72,6 +75,9 @@ discard block |
||
72 | 75 | } |
73 | 76 | } |
74 | 77 | |
78 | + /** |
|
79 | + * @param string $comment |
|
80 | + */ |
|
75 | 81 | public function commentAdd($comment) { |
76 | 82 | if (empty($this->values[static::COMMENT_PLACEHOLDER])) { |
77 | 83 | $this->query .= ' ' . static::COMMENT_PLACEHOLDER; |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | public function commentRemove() { |
69 | 69 | if (!empty($this->values[static::COMMENT_PLACEHOLDER])) { |
70 | 70 | unset($this->values[static::COMMENT_PLACEHOLDER]); |
71 | - $this->query = str_replace(' ' . static::COMMENT_PLACEHOLDER, '', $this->query); |
|
71 | + $this->query = str_replace(' '.static::COMMENT_PLACEHOLDER, '', $this->query); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function commentAdd($comment) { |
76 | 76 | if (empty($this->values[static::COMMENT_PLACEHOLDER])) { |
77 | - $this->query .= ' ' . static::COMMENT_PLACEHOLDER; |
|
77 | + $this->query .= ' '.static::COMMENT_PLACEHOLDER; |
|
78 | 78 | } |
79 | 79 | $this->values[static::COMMENT_PLACEHOLDER] = $comment; |
80 | 80 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | // Removing comment placeholder from statement |
114 | 114 | $this->queryPrepared = str_replace(static::COMMENT_PLACEHOLDER, $this->comment, $this->queryPrepared); |
115 | 115 | // Removing comment value from values list |
116 | - $this->paramsPrepared = array_filter($this->paramsPrepared, function ($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
116 | + $this->paramsPrepared = array_filter($this->paramsPrepared, function($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
117 | 117 | // TODO - Add comment value directly to statement |
118 | 118 | } |
119 | 119 |
@@ -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; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $arguments = func_get_args(); |
109 | 109 | |
110 | 110 | // Special case - call method with array of fields |
111 | - if(count($arguments) == 1 && is_array($arguments[0])) { |
|
111 | + if (count($arguments) == 1 && is_array($arguments[0])) { |
|
112 | 112 | $arguments = array_shift($arguments); |
113 | 113 | } |
114 | 114 | |
115 | - foreach($arguments as $arg) { |
|
115 | + foreach ($arguments as $arg) { |
|
116 | 116 | $this->fields[] = $arg; |
117 | 117 | } |
118 | 118 | |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | protected function compileFrom() { |
296 | - $this->_compiledQuery[] = 'FROM `{{' . $this->escapeString($this->table) . '}}`'; |
|
296 | + $this->_compiledQuery[] = 'FROM `{{'.$this->escapeString($this->table).'}}`'; |
|
297 | 297 | if (!empty($this->alias)) { |
298 | - $this->_compiledQuery[] = 'AS `' . $this->escapeString($this->alias) . '`'; |
|
298 | + $this->_compiledQuery[] = 'AS `'.$this->escapeString($this->alias).'`'; |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -305,29 +305,29 @@ discard block |
||
305 | 305 | |
306 | 306 | protected function compileWhere() { |
307 | 307 | // TODO - fields should be escaped !! |
308 | - !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false; |
|
308 | + !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | protected function compileGroupBy() { |
312 | 312 | // TODO - fields should be escaped !! |
313 | 313 | // !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false; |
314 | - !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . $this->selectFieldsToString($this->groupBy) : false; |
|
314 | + !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.$this->selectFieldsToString($this->groupBy) : false; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | protected function compileOrderBy() { |
318 | 318 | // TODO - fields should be escaped !! |
319 | - !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
319 | + !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | protected function compileHaving() { |
323 | 323 | // TODO - fields should be escaped !! |
324 | - !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false; |
|
324 | + !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | protected function compileLimit() { |
328 | 328 | // TODO - fields should be escaped !! |
329 | 329 | if ($limit = $this->fetchOne ? 1 : $this->limit) { |
330 | - $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : ''); |
|
330 | + $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : ''); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -371,14 +371,14 @@ discard block |
||
371 | 371 | */ |
372 | 372 | protected function processField($fieldName) { |
373 | 373 | if (is_bool($fieldName)) { |
374 | - $result = (string)intval($fieldName); |
|
374 | + $result = (string) intval($fieldName); |
|
375 | 375 | } elseif (is_numeric($fieldName)) { |
376 | 376 | $result = $fieldName; |
377 | 377 | } elseif (is_null($fieldName)) { |
378 | 378 | $result = 'NULL'; |
379 | 379 | } else { |
380 | 380 | // Field has other type - string or should be convertible to string |
381 | - $result = (string)$fieldName; |
|
381 | + $result = (string) $fieldName; |
|
382 | 382 | if (!$fieldName instanceof DbSqlLiteral) { |
383 | 383 | $result = $this->quoteField($fieldName); |
384 | 384 | } |