@@ -1,5 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | -use DBStatic\DBStaticUser; |
|
| 3 | 2 | |
| 4 | 3 | /** |
| 5 | 4 | * |
@@ -444,7 +444,6 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | - * @param bool $skip_query_check |
|
| 448 | 447 | * |
| 449 | 448 | * @return array |
| 450 | 449 | */ |
@@ -455,7 +454,6 @@ discard block |
||
| 455 | 454 | } |
| 456 | 455 | |
| 457 | 456 | /** |
| 458 | - * @param bool $skip_query_check |
|
| 459 | 457 | * |
| 460 | 458 | * @return mixed|null |
| 461 | 459 | */ |
@@ -50,8 +50,8 @@ |
||
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @param template $template |
| 53 | - * @param $query_where |
|
| 54 | - * @param $query_limit |
|
| 53 | + * @param string $query_where |
|
| 54 | + * @param integer $query_limit |
|
| 55 | 55 | * |
| 56 | 56 | * @return array|bool|mysqli_result|null |
| 57 | 57 | */ |
@@ -215,6 +215,9 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
| 218 | + /** |
|
| 219 | + * @param string $username_unsafe |
|
| 220 | + */ |
|
| 218 | 221 | public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) { |
| 219 | 222 | // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ? |
| 220 | 223 | if (!($username_unsafe = trim($username_unsafe))) { |
@@ -269,7 +272,6 @@ discard block |
||
| 269 | 272 | |
| 270 | 273 | /** |
| 271 | 274 | * @param $user_id |
| 272 | - * @param array $set |
|
| 273 | 275 | * @param array $adjust |
| 274 | 276 | * |
| 275 | 277 | * @return array|bool|mysqli_result|null |
@@ -286,8 +288,8 @@ discard block |
||
| 286 | 288 | * <p>array - запись пользователя с установленным полем ['id']</p> |
| 287 | 289 | * @param bool $for_update @deprecated |
| 288 | 290 | * @param string $fields @deprecated список полей или '*'/'' для всех полей |
| 289 | - * @param null $player |
|
| 290 | - * @param bool|null $player Признак выбора записи пользователь типа "игрок" |
|
| 291 | + * @param boolean $player |
|
| 292 | + * @param boolean $player Признак выбора записи пользователь типа "игрок" |
|
| 291 | 293 | * <p>null - Можно выбрать запись любого типа</p> |
| 292 | 294 | * <p>true - Выбирается только запись типа "игрок"</p> |
| 293 | 295 | * <p>false - Выбирается только запись типа "альянс"</p> |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | WHERE |
| 27 | 27 | `user_as_ally` IS NULL |
| 28 | 28 | AND |
| 29 | - `user_bot` = " . USER_BOT_PLAYER . " |
|
| 29 | + `user_bot` = " . USER_BOT_PLAYER." |
|
| 30 | 30 | ORDER BY `id` DESC |
| 31 | 31 | LIMIT 1" |
| 32 | 32 | ; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | WHERE |
| 53 | 53 | `user_as_ally` IS NULL |
| 54 | 54 | AND |
| 55 | - `user_bot` = " . USER_BOT_PLAYER . " |
|
| 55 | + `user_bot` = " . USER_BOT_PLAYER." |
|
| 56 | 56 | ORDER BY `id`"; |
| 57 | 57 | $result = classSupernova::$db->doSelectIterator($query); |
| 58 | 58 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return DbResultIterator |
| 71 | 71 | */ |
| 72 | 72 | public static function db_user_list_non_bots() { |
| 73 | - $query = "SELECT `id` FROM `{{users}}` WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . " FOR UPDATE;"; |
|
| 73 | + $query = "SELECT `id` FROM `{{users}}` WHERE `user_as_ally` IS NULL AND `user_bot` = ".USER_BOT_PLAYER." FOR UPDATE;"; |
|
| 74 | 74 | $result = classSupernova::$db->doSelectIterator($query); |
| 75 | 75 | |
| 76 | 76 | // $query = |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $query = |
| 89 | 89 | "SELECT 1 |
| 90 | 90 | FROM `{{users}}` |
| 91 | - WHERE `id` = " . idval($user['id']) . |
|
| 92 | - (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') . |
|
| 91 | + WHERE `id` = " . idval($user['id']). |
|
| 92 | + (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : ''). |
|
| 93 | 93 | " FOR UPDATE"; |
| 94 | 94 | |
| 95 | 95 | classSupernova::$db->doSelect($query); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | FROM `{{users}}` |
| 107 | 107 | WHERE |
| 108 | 108 | `user_as_ally` IS NULL" . |
| 109 | - ($online ? ' AND `onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
| 109 | + ($online ? ' AND `onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
| 110 | 110 | )); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | LEFT JOIN |
| 119 | 119 | {{referrals}} as r on r.id_partner = u.id |
| 120 | 120 | WHERE " . |
| 121 | - ($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') . |
|
| 121 | + ($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL'). |
|
| 122 | 122 | " GROUP BY u.id |
| 123 | 123 | ORDER BY user_as_ally, {$sort} ASC"; |
| 124 | 124 | $result = classSupernova::$db->doSelectIterator($query); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
| 245 | 245 | |
| 246 | 246 | $user = classSupernova::$db->doSelectFetch( |
| 247 | - "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
| 247 | + "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
| 248 | 248 | . " FOR UPDATE" |
| 249 | 249 | ); |
| 250 | 250 | classSupernova::$gc->snCache->cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @param array $playerArray |
| 336 | 336 | */ |
| 337 | 337 | public static function renderNameAndCoordinates($playerArray) { |
| 338 | - return "{$playerArray['username']} " . uni_render_coordinates($playerArray); |
|
| 338 | + return "{$playerArray['username']} ".uni_render_coordinates($playerArray); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | define('INSTALL', false); |
| 13 | 13 | define('IN_ADMIN', true); |
| 14 | 14 | |
| 15 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 15 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 16 | 16 | |
| 17 | 17 | if ($user['authlevel'] < 3) { |
| 18 | 18 | AdminMessage(classLocale::$lang['adm_err_denied']); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | print("<td>Last online</td>"); |
| 102 | 102 | print("</tr>"); |
| 103 | 103 | foreach ($session_list as $user_id => $value) { |
| 104 | - $user_record = classSupernova::$db->doSelect("SELECT * FROM `{{users}}` WHERE `id` = " . idval($user_id)); |
|
| 104 | + $user_record = classSupernova::$db->doSelect("SELECT * FROM `{{users}}` WHERE `id` = ".idval($user_id)); |
|
| 105 | 105 | foreach ($value as $interval_data) { |
| 106 | 106 | print("<tr>"); |
| 107 | 107 | 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>"); |
| 108 | - print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
|
| 108 | + print("<td>".date(FMT_DATE_TIME_SQL, $user_record['onlinetime'])."</td>"); |
|
| 109 | 109 | print("</tr>"); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -65,11 +65,10 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public static function db_planet_by_vector($vector, $prefix = '', $for_update = false, $fields = '*') { |
| 68 | - $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
|
| 69 | - $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
|
| 70 | - $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
|
| 71 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
| 72 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
| 68 | + $galaxy = isset($vector[$prefix.'galaxy']) ? intval($vector[$prefix.'galaxy']) : 0; |
|
| 69 | + $system = isset($vector[$prefix.'system']) ? intval($vector[$prefix.'system']) : 0; |
|
| 70 | + $planet = isset($vector[$prefix.'planet']) ? intval($vector[$prefix.'planet']) : 0; |
|
| 71 | + $planet_type = isset($vector[$prefix.'planet_type']) ? intval($vector[$prefix.'planet_type']) : (isset($vector[$prefix.'type']) ? intval($vector[$prefix.'type']) : 0); |
|
| 73 | 72 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
| 74 | 73 | |
| 75 | 74 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -120,7 +119,7 @@ discard block |
||
| 120 | 119 | } |
| 121 | 120 | |
| 122 | 121 | return classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, |
| 123 | - "`planet_type` = " . PT_MOON . " AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
| 122 | + "`planet_type` = ".PT_MOON." AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
| 124 | 123 | } |
| 125 | 124 | |
| 126 | 125 | public static function db_planet_list_in_system($galaxy, $system) { |
@@ -146,7 +145,7 @@ discard block |
||
| 146 | 145 | ); |
| 147 | 146 | $order_by = classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT]; |
| 148 | 147 | empty($sort_orders[$order_by]) ? $order_by = SORT_ID : false; |
| 149 | - $order_by = $sort_orders[$order_by] . ' ' . (classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
| 148 | + $order_by = $sort_orders[$order_by].' '.(classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
| 150 | 149 | |
| 151 | 150 | // Compilating query |
| 152 | 151 | return classSupernova::$gc->cacheOperator->db_get_record_list(LOC_PLANET, |