@@ -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) { |
@@ -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 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | protected function compileFrom() { |
246 | - $this->_compiledQuery[] = 'FROM `{{' . $this->stringEscape($this->table) . '}}`'; |
|
246 | + $this->_compiledQuery[] = 'FROM `{{'.$this->stringEscape($this->table).'}}`'; |
|
247 | 247 | if (!empty($this->alias)) { |
248 | - $this->_compiledQuery[] = 'AS `' . $this->stringEscape($this->alias) . '`'; |
|
248 | + $this->_compiledQuery[] = 'AS `'.$this->stringEscape($this->alias).'`'; |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | |
255 | 255 | protected function compileWhere() { |
256 | 256 | // TODO - fields should be escaped !! |
257 | - !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false; |
|
257 | + !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | protected function compileGroupBy() { |
261 | 261 | // TODO - fields should be escaped !! |
262 | - !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false; |
|
262 | + !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.implode(',', $this->arrayEscape($this->groupBy)) : false; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | protected function compileOrderBy() { |
266 | 266 | // TODO - fields should be escaped !! |
267 | - !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
267 | + !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | protected function compileHaving() { |
271 | 271 | // TODO - fields should be escaped !! |
272 | - !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false; |
|
272 | + !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | protected function compileLimit() { |
276 | 276 | // TODO - fields should be escaped !! |
277 | 277 | if ($limit = $this->fetchOne ? 1 : $this->limit) { |
278 | - $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : ''); |
|
278 | + $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : ''); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @return string |
350 | 350 | */ |
351 | 351 | protected function processFieldString($fieldName) { |
352 | - $result = (string)$fieldName; |
|
352 | + $result = (string) $fieldName; |
|
353 | 353 | if ( |
354 | 354 | $result != '' |
355 | 355 | && |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | !($fieldName instanceof DbSqlLiteral) |
358 | 358 | ) { |
359 | 359 | // Other should be formatted |
360 | - $result = '`' . $this->stringEscape($result) . '`'; |
|
360 | + $result = '`'.$this->stringEscape($result).'`'; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | return $result; |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | protected function processField($fieldName) { |
372 | 372 | if (is_bool($fieldName)) { |
373 | - $result = (string)intval($fieldName); |
|
373 | + $result = (string) intval($fieldName); |
|
374 | 374 | } elseif (is_numeric($fieldName)) { |
375 | 375 | $result = $fieldName; |
376 | 376 | } elseif (is_null($fieldName)) { |
@@ -41,10 +41,10 @@ |
||
41 | 41 | $alias = $this->makeAliasFromField($functionName, $field); |
42 | 42 | } |
43 | 43 | |
44 | - $this->literal = strtoupper($functionName) . '(' . $this->makeFieldFromString($field) . ')'; |
|
44 | + $this->literal = strtoupper($functionName).'('.$this->makeFieldFromString($field).')'; |
|
45 | 45 | |
46 | 46 | if ($alias) { |
47 | - $this->literal .= ' AS `' . $alias . '`'; |
|
47 | + $this->literal .= ' AS `'.$alias.'`'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $this; |
@@ -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 |