@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) { |
65 | 65 | // return static::getRecord(array(static::$_idField => $recordId), $fieldList, $forUpdate); |
66 | - return static::getRecord(array(static::$_idField . '=' . $recordId), $fieldList, $forUpdate); |
|
66 | + return static::getRecord(array(static::$_idField.'='.$recordId), $fieldList, $forUpdate); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | DbSqlStatement::build(null, get_called_class()) |
85 | 85 | ->select() |
86 | 86 | ->fields(static::$_idField) |
87 | - ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")")) |
|
87 | + ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")")) |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 |
@@ -234,24 +234,24 @@ discard block |
||
234 | 234 | $result = ''; |
235 | 235 | $result .= $this->stringEscape($this->operation); |
236 | 236 | |
237 | - $result .= ' ' . $this->selectFieldsToString($this->fields); |
|
237 | + $result .= ' '.$this->selectFieldsToString($this->fields); |
|
238 | 238 | |
239 | 239 | $result .= ' FROM'; |
240 | - $result .= ' `{{' . $this->stringEscape($this->table) . '}}`'; |
|
241 | - $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : ''; |
|
240 | + $result .= ' `{{'.$this->stringEscape($this->table).'}}`'; |
|
241 | + $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : ''; |
|
242 | 242 | |
243 | 243 | // TODO - fields should be escaped !! |
244 | - $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : ''; |
|
244 | + $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : ''; |
|
245 | 245 | |
246 | 246 | // TODO - fields should be escaped !! |
247 | - $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : ''; |
|
247 | + $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : ''; |
|
248 | 248 | |
249 | 249 | // TODO - fields should be escaped !! |
250 | - $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : ''; |
|
250 | + $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : ''; |
|
251 | 251 | |
252 | 252 | // TODO - fields should be escaped !! |
253 | 253 | // TODO - separate offset and row_count |
254 | - $result .= !empty($this->limit) ? ' LIMIT ' . implode(' OFFSET ', $this->limit) : ''; |
|
254 | + $result .= !empty($this->limit) ? ' LIMIT '.implode(' OFFSET ', $this->limit) : ''; |
|
255 | 255 | |
256 | 256 | // TODO - protect from double escape! |
257 | 257 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected function processField($fieldName) { |
291 | 291 | if (is_bool($fieldName)) { |
292 | - $result = (string)intval($fieldName); |
|
292 | + $result = (string) intval($fieldName); |
|
293 | 293 | } elseif (is_null($fieldName)) { |
294 | 294 | $result = 'NULL'; |
295 | 295 | } elseif ($fieldName === '*') { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return string |
308 | 308 | */ |
309 | 309 | protected function processFieldDefault($fieldName) { |
310 | - $result = (string)$fieldName; |
|
310 | + $result = (string) $fieldName; |
|
311 | 311 | if ( |
312 | 312 | $result != '' |
313 | 313 | && |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | !is_numeric($fieldName) |
319 | 319 | ) { |
320 | 320 | // Other should be formatted |
321 | - $result = '`' . $this->stringEscape($result) . '`'; |
|
321 | + $result = '`'.$this->stringEscape($result).'`'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | return $result; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return array|bool|mysqli_result|null |
67 | 67 | */ |
68 | 68 | public static function db_user_list_non_bots() { |
69 | - $query = doquery("SELECT `id` FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . " FOR UPDATE;"); |
|
69 | + $query = doquery("SELECT `id` FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = ".USER_BOT_PLAYER." FOR UPDATE;"); |
|
70 | 70 | |
71 | 71 | return $query; |
72 | 72 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | public static function db_user_lock_with_target_owner_and_acs($user, $planet = array()) { |
75 | 75 | static::$dbStatic->execute( |
76 | 76 | static::buildSelectLock() |
77 | - ->where(array("`id` = " . idval($user['id']) . |
|
78 | - (isset($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : ''))) |
|
77 | + ->where(array("`id` = ".idval($user['id']). |
|
78 | + (isset($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : ''))) |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | // doquery("SELECT 1 FROM {{users}} WHERE `id` = " . idval($user['id']) . |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
112 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
112 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | public static function db_user_count($online = false) { |
130 | - $result = doquery('SELECT COUNT(id) AS user_count FROM `{{users}}` WHERE user_as_ally IS NULL' . ($online ? ' AND onlinetime > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ''), true); |
|
130 | + $result = doquery('SELECT COUNT(id) AS user_count FROM `{{users}}` WHERE user_as_ally IS NULL'.($online ? ' AND onlinetime > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ''), true); |
|
131 | 131 | |
132 | 132 | return isset($result['user_count']) ? $result['user_count'] : 0; |
133 | 133 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u |
168 | 168 | LEFT JOIN {{referrals}} as r on r.id_partner = u.id |
169 | 169 | WHERE" . |
170 | - ($online ? " `onlinetime` >= " . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ' user_as_ally IS NULL') . |
|
170 | + ($online ? " `onlinetime` >= ".(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ' user_as_ally IS NULL'). |
|
171 | 171 | " GROUP BY u.id |
172 | 172 | ORDER BY user_as_ally, {$sort} ASC"); |
173 | 173 | } |