Completed
Push — work-fleets ( b0b806...96df87 )
by SuperNova.WS
06:32
created
includes/classes/DBStatic/DBStaticQue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     if ($que_type == QUE_RESEARCH || $planet_id === null) {
39 39
       $query[] = "`que_planet_id` IS NULL";
40 40
     } elseif ($planet_id) {
41
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
41
+      $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")";
42 42
     }
43 43
     if ($que_type) {
44 44
       $query[] = "`que_type` = {$que_type}";
Please login to merge, or discard this patch.
includes/classes/DBStatic/DBStaticUser.php 2 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,6 +42,7 @@  discard block
 block discarded – undo
42 42
   }
43 43
 
44 44
   /**
45
+   * @param string $fields
45 46
    * @return DbResultIterator
46 47
    */
47 48
   protected static function playerSelectIterator($fields, $orderBy = '', $forUpdate = false, $groupHaving = '', $where = '', $limit = '') {
@@ -215,6 +216,9 @@  discard block
 block discarded – undo
215 216
     return $user_list;
216 217
   }
217 218
 
219
+  /**
220
+   * @param string $username_unsafe
221
+   */
218 222
   public static function db_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) {
219 223
     // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ?
220 224
     if (!($username_unsafe = trim($username_unsafe))) {
@@ -268,7 +272,6 @@  discard block
 block discarded – undo
268 272
 
269 273
   /**
270 274
    * @param       $user_id
271
-   * @param array $set
272 275
    * @param array $adjust
273 276
    *
274 277
    * @return array|bool|mysqli_result|null
@@ -285,8 +288,8 @@  discard block
 block discarded – undo
285 288
    *    <p>array - запись пользователя с установленным полем ['id']</p>
286 289
    * @param bool      $for_update @deprecated
287 290
    * @param string    $fields @deprecated список полей или '*'/'' для всех полей
288
-   * @param null      $player
289
-   * @param bool|null $player Признак выбора записи пользователь типа "игрок"
291
+   * @param boolean      $player
292
+   * @param boolean $player Признак выбора записи пользователь типа "игрок"
290 293
    *    <p>null - Можно выбрать запись любого типа</p>
291 294
    *    <p>true - Выбирается только запись типа "игрок"</p>
292 295
    *    <p>false - Выбирается только запись типа "альянс"</p>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -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); // В кэш-юзер так же заполнять индексы
Please login to merge, or discard this patch.
includes/includes/upd_helpers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
   // classSupernova::$db->sn_db_connect();
16 16
   if (!(strpos($query, '{{') === false)) {
17 17
     foreach ($update_tables as $tableName => $cork) {
18
-      $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query);
18
+      $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix.$tableName, $query);
19 19
     }
20 20
   }
21
-  !($result = classSupernova::$db->db_sql_query($query)) ? die('Query error for ' . $query . ': ' . classSupernova::$db->db_error()) : false;
21
+  !($result = classSupernova::$db->db_sql_query($query)) ? die('Query error for '.$query.': '.classSupernova::$db->db_error()) : false;
22 22
 
23 23
   return $result;
24 24
 }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
   global $update_tables, $update_indexes, $update_indexes_full, $update_foreigns;
86 86
 
87 87
   $tableName = $prefixed ? str_replace(classSupernova::$config->db_prefix, '', $prefix_table_name) : $prefix_table_name;
88
-  $prefix_table_name = $prefixed ? $prefix_table_name : classSupernova::$config->db_prefix . $prefix_table_name;
88
+  $prefix_table_name = $prefixed ? $prefix_table_name : classSupernova::$config->db_prefix.$prefix_table_name;
89 89
 
90 90
   upd_unset_table_info($tableName);
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1;
101 101
   }
102 102
 
103
-  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
+  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '".db_escape(classSupernova::$db_name)."' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
104 104
   while ($r1 = db_fetch($q1)) {
105 105
     $table_referenced = str_replace(classSupernova::$config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']);
106 106
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$db_prefix}{$table_name}` {$declaration}");
161 161
     $error = classSupernova::$db->db_error();
162 162
     if ($error) {
163
-      die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration));
163
+      die("Creating error for table `{$table_name}`: {$error}<br />".dump($declaration));
164 164
     }
165 165
     upd_do_query('set foreign_key_checks = 1;', true);
166 166
     upd_load_table_info($table_name, false);
Please login to merge, or discard this patch.