|
@@ -38,7 +38,7 @@ discard block |
|
|
block discarded – undo |
|
38
|
38
|
*/ |
|
39
|
39
|
// TODO - remove or use something else |
|
40
|
40
|
public static function renderNameAndCoordinates($playerArray) { |
|
41
|
|
- return "{$playerArray['username']} " . uni_render_coordinates($playerArray); |
|
|
41
|
+ return "{$playerArray['username']} ".uni_render_coordinates($playerArray); |
|
42
|
42
|
} |
|
43
|
43
|
|
|
44
|
44
|
/** |
|
@@ -115,7 +115,7 @@ discard block |
|
|
block discarded – undo |
|
115
|
115
|
* @return int |
|
116
|
116
|
*/ |
|
117
|
117
|
public static function db_user_count($online = false) { |
|
118
|
|
- $iterator = static::playerSelectIterator('COUNT(`id`)', '', false, '', ($online ? '`onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '')); |
|
|
118
|
+ $iterator = static::playerSelectIterator('COUNT(`id`)', '', false, '', ($online ? '`onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '')); |
|
119
|
119
|
|
|
120
|
120
|
return intval(classSupernova::$db->getDbIteratorFirstValue($iterator)); |
|
121
|
121
|
} |
|
@@ -128,7 +128,7 @@ discard block |
|
|
block discarded – undo |
|
128
|
128
|
LEFT JOIN |
|
129
|
129
|
{{referrals}} as r on r.id_partner = u.id |
|
130
|
130
|
WHERE " . |
|
131
|
|
- ($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') . |
|
|
131
|
+ ($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL'). |
|
132
|
132
|
" GROUP BY u.id |
|
133
|
133
|
ORDER BY user_as_ally, {$sort} ASC"; |
|
134
|
134
|
$result = classSupernova::$db->doSelectIterator($query); |
|
@@ -145,7 +145,7 @@ discard block |
|
|
block discarded – undo |
|
145
|
145
|
`{{users}}` |
|
146
|
146
|
WHERE |
|
147
|
147
|
`user_as_ally` IS NULL |
|
148
|
|
- AND `user_bot` = " . USER_BOT_PLAYER . " |
|
|
148
|
+ AND `user_bot` = " . USER_BOT_PLAYER." |
|
149
|
149
|
AND `user_birthday` IS NOT NULL |
|
150
|
150
|
AND (`user_birthday_celebrated` IS NULL OR DATE_ADD(`user_birthday_celebrated`, INTERVAL 1 YEAR) < CURRENT_DATE) |
|
151
|
151
|
HAVING |
|
@@ -166,8 +166,8 @@ discard block |
|
|
block discarded – undo |
|
166
|
166
|
$query = |
|
167
|
167
|
"SELECT 1 |
|
168
|
168
|
FROM `{{users}}` |
|
169
|
|
- WHERE `id` = " . idval($user['id']) . |
|
170
|
|
- (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') . |
|
|
169
|
+ WHERE `id` = " . idval($user['id']). |
|
|
170
|
+ (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : ''). |
|
171
|
171
|
" FOR UPDATE"; |
|
172
|
172
|
|
|
173
|
173
|
classSupernova::$db->doSelect($query); |
|
@@ -243,7 +243,7 @@ discard block |
|
|
block discarded – undo |
|
243
|
243
|
$username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
|
244
|
244
|
|
|
245
|
245
|
$user = classSupernova::$db->doSelectFetch( |
|
246
|
|
- "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
|
246
|
+ "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
247
|
247
|
. " FOR UPDATE" |
|
248
|
248
|
); |
|
249
|
249
|
classSupernova::$gc->snCache->cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |