@@ -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 | - doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
39 | + doquery("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 | - doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
56 | + doquery("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 |
@@ -55,8 +55,8 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * @param int|string $recordId |
|
59 | - * @param mixed|array $fieldList |
|
58 | + * @param integer $recordId |
|
59 | + * @param string[] $fieldList |
|
60 | 60 | * @param bool $forUpdate |
61 | 61 | * |
62 | 62 | * @return array|null |
@@ -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 |
@@ -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 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | static::buildSelect() |
50 | 50 | ->fields('id') |
51 | 51 | ->where(array( |
52 | - "`user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . " FOR UPDATE;" |
|
52 | + "`user_as_ally` IS NULL AND `user_bot` = ".USER_BOT_PLAYER." FOR UPDATE;" |
|
53 | 53 | )) |
54 | 54 | ); |
55 | 55 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | public static function db_user_lock_with_target_owner_and_acs($user, $planet = array()) { |
62 | 62 | static::$dbStatic->execute( |
63 | 63 | static::buildSelectLock() |
64 | - ->where(array("`id` = " . idval($user['id']) . |
|
65 | - (isset($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : ''))) |
|
64 | + ->where(array("`id` = ".idval($user['id']). |
|
65 | + (isset($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : ''))) |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | // doquery("SELECT 1 FROM {{users}} WHERE `id` = " . idval($user['id']) . |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public static function db_user_count($online = false) { |
75 | - $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); |
|
75 | + $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); |
|
76 | 76 | |
77 | 77 | return isset($result['user_count']) ? $result['user_count'] : 0; |
78 | 78 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u |
113 | 113 | LEFT JOIN {{referrals}} as r on r.id_partner = u.id |
114 | 114 | WHERE" . |
115 | - ($online ? " `onlinetime` >= " . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ' user_as_ally IS NULL') . |
|
115 | + ($online ? " `onlinetime` >= ".(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : ' user_as_ally IS NULL'). |
|
116 | 116 | " GROUP BY u.id |
117 | 117 | ORDER BY user_as_ally, {$sort} ASC"); |
118 | 118 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
171 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
171 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -260,28 +260,28 @@ discard block |
||
260 | 260 | $result = ''; |
261 | 261 | $result .= $this->stringEscape($this->operation); |
262 | 262 | |
263 | - $result .= ' ' . $this->selectFieldsToString($this->fields); |
|
263 | + $result .= ' '.$this->selectFieldsToString($this->fields); |
|
264 | 264 | |
265 | 265 | $result .= ' FROM'; |
266 | - $result .= ' `{{' . $this->stringEscape($this->table) . '}}`'; |
|
267 | - $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : ''; |
|
266 | + $result .= ' `{{'.$this->stringEscape($this->table).'}}`'; |
|
267 | + $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : ''; |
|
268 | 268 | |
269 | 269 | // TODO - fields should be escaped !! |
270 | - $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : ''; |
|
270 | + $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : ''; |
|
271 | 271 | |
272 | 272 | // TODO - fields should be escaped !! |
273 | - $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : ''; |
|
273 | + $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : ''; |
|
274 | 274 | |
275 | 275 | // TODO - fields should be escaped !! |
276 | - $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : ''; |
|
276 | + $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : ''; |
|
277 | 277 | |
278 | 278 | // TODO - fields should be escaped !! |
279 | - $result .= !empty($this->having) ? ' HAVING ' . implode(' AND ', $this->having) : ''; |
|
279 | + $result .= !empty($this->having) ? ' HAVING '.implode(' AND ', $this->having) : ''; |
|
280 | 280 | |
281 | 281 | // TODO - fields should be escaped !! |
282 | 282 | $limit = $this->fetchOne ? 1 : $this->limit; |
283 | 283 | $result .= !empty($limit) |
284 | - ? ' LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : '') |
|
284 | + ? ' LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : '') |
|
285 | 285 | : ''; |
286 | 286 | |
287 | 287 | $result .= |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected function processField($fieldName) { |
329 | 329 | if (is_bool($fieldName)) { |
330 | - $result = (string)intval($fieldName); |
|
330 | + $result = (string) intval($fieldName); |
|
331 | 331 | } elseif (is_null($fieldName)) { |
332 | 332 | $result = 'NULL'; |
333 | 333 | } elseif ($fieldName === '*') { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @return string |
346 | 346 | */ |
347 | 347 | protected function processFieldDefault($fieldName) { |
348 | - $result = (string)$fieldName; |
|
348 | + $result = (string) $fieldName; |
|
349 | 349 | if ( |
350 | 350 | $result != '' |
351 | 351 | && |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | !is_numeric($fieldName) |
357 | 357 | ) { |
358 | 358 | // Other should be formatted |
359 | - $result = '`' . $this->stringEscape($result) . '`'; |
|
359 | + $result = '`'.$this->stringEscape($result).'`'; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | return $result; |