Completed
Push — work-fleets ( 8474eb...046d2e )
by SuperNova.WS
08:49
created
includes/functions/qst_quest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     $template->assign_vars($quest_templatized);
180 180
     if (!empty($quest_templatized['quest_rewards_list'])) {
181 181
       foreach ($quest_templatized['quest_rewards_list'] as $quest_reward) {
182
-        $template->assign_block_vars(($block_name ? $block_name . '.' : '') . 'quest_rewards_list', $quest_reward);
182
+        $template->assign_block_vars(($block_name ? $block_name.'.' : '').'quest_rewards_list', $quest_reward);
183 183
       }
184 184
     }
185 185
   }
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 
249 249
         $comment_reward = array();
250 250
         foreach ($reward_list as $unit_id => $unit_amount) {
251
-          $comment_reward[] = $unit_amount . ' ' . classLocale::$lang['tech'][$unit_id];
251
+          $comment_reward[] = $unit_amount.' '.classLocale::$lang['tech'][$unit_id];
252 252
           $total_rewards[$user_id][$planet_id][$unit_id] += $unit_amount;
253 253
         }
254
-        $comment .= " {$classLocale['qst_msg_your_reward']} " . implode(',', $comment_reward);
254
+        $comment .= " {$classLocale['qst_msg_your_reward']} ".implode(',', $comment_reward);
255 255
 
256 256
         DBStaticMessages::msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['msg_from_admin'], classLocale::$lang['qst_msg_complete_subject'], $comment);
257 257
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         if (!empty($resourcesChange)) {
291 291
           $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id;
292
-          if($planet_id) {
292
+          if ($planet_id) {
293 293
             // update planet
294 294
             DBStaticPlanet::db_planet_update_resources($resourcesChange, $planet_id);
295 295
           } else {
Please login to merge, or discard this patch.
includes/classes/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/SnDbCachedOperator.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -314,6 +314,9 @@  discard block
 block discarded – undo
314 314
     return $result;
315 315
   }
316 316
 
317
+  /**
318
+   * @param integer $location_type
319
+   */
317 320
   public static function db_ins_field_set($location_type, $field_set, $serialize = false) {
318 321
     // TODO multiinsert
319 322
     !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set, $serialize) : false;
@@ -350,7 +353,7 @@  discard block
 block discarded – undo
350 353
   /**
351 354
    * Блокирует указанные таблицу/список таблиц
352 355
    *
353
-   * @param string|array $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
356
+   * @param string $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
354 357
    * <p>string - название таблицы для блокировки</p>
355 358
    * <p>array - массив, где ключ - имя таблицы, а значение - условия блокировки элементов</p>
356 359
    */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
           $query = $this->db->doSelect(
183 183
             "SELECT
184 184
               distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id
185
-            FROM {{{$location_info[P_TABLE_NAME]}}}" .
186
-            ($filter ? ' WHERE ' . $filter : '') .
185
+            FROM {{{$location_info[P_TABLE_NAME]}}}".
186
+            ($filter ? ' WHERE '.$filter : '').
187 187
             ($fetch ? ' LIMIT 1' : ''));
188 188
           while ($row = db_fetch($query)) {
189 189
             // Исключаем из списка родительских ИД уже заблокированные записи
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
           if ($indexes_str = implode(',', $parent_id_list)) {
197 197
             $parent_id_field = static::$location_info[$owner_location_type][P_ID];
198 198
             classSupernova::$gc->cacheOperator->db_get_record_list($owner_location_type,
199
-              $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
199
+              $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
200 200
           }
201 201
         }
202 202
       }
203 203
 
204 204
       $query = $this->db->doSelect(
205
-        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" .
205
+        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}".
206 206
         (($filter = trim($filter)) ? " WHERE {$filter}" : '')
207 207
         . " FOR UPDATE"
208 208
       );
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     $condition = trim($condition);
277 277
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
278 278
 
279
-    if ($result = $this->db->doUpdate("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) {
279
+    if ($result = $this->db->doUpdate("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) {
280 280
 
281 281
       if ($this->db->db_affected_rows()) { // Обновляем данные только если ряд был затронут
282 282
         // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
   public function db_lock_tables($tables) {
347 347
     $tables = is_array($tables) ? $tables : array($tables => '');
348 348
     foreach ($tables as $table_name => $condition) {
349
-      $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : ''));
349
+      $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : ''));
350 350
     }
351 351
   }
352 352
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -298,9 +298,11 @@
 block discarded – undo
298 298
     $set = trim($set);
299 299
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
300 300
     if ($result = $this->db->doInsert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
301
-      if ($this->db->db_affected_rows()) // Обновляем данные только если ряд был затронут
301
+      if ($this->db->db_affected_rows()) {
302
+        // Обновляем данные только если ряд был затронут
302 303
       {
303 304
         $record_id = $this->db->db_insert_id();
305
+      }
304 306
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
305 307
         $result = $this->db_get_record_by_id($location_type, $record_id);
306 308
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(SN_IN_FLEET !== true) {
5
+if (SN_IN_FLEET !== true) {
6 6
   classSupernova::$debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 $fleetid = sys_get_param_id('fleetid');
10 10
 
11
-if(!is_numeric($fleetid) || empty($fleetid)) {
11
+if (!is_numeric($fleetid) || empty($fleetid)) {
12 12
   header("Location: fleet.php");
13 13
   exit();
14 14
 }
15 15
 
16 16
 $objFleet = new Fleet();
17 17
 $objFleet->dbLoad($fleetid);
18
-if(!$objFleet->dbId) {
18
+if (!$objFleet->dbId) {
19 19
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
20 20
 }
21 21
 
22
-if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
22
+if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
23 23
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
24 24
 }
25 25
 
26
-if($objFleet->playerOwnerId != $user['id']) {
26
+if ($objFleet->playerOwnerId != $user['id']) {
27 27
   classSupernova::$debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
28 28
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
29 29
 }
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 
35 35
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
36 36
 
37
-if($userToAdd_unsafe) {
37
+if ($userToAdd_unsafe) {
38 38
   $userToAdd = db_escape($userToAdd_unsafe);
39 39
   $userToAddID = DBStaticUser::db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
40 40
   $userToAddID = $userToAddID['id'];
41 41
 
42
-  if($objFleet->target_owner_id == $userToAddID) {
42
+  if ($objFleet->target_owner_id == $userToAddID) {
43 43
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
44 44
   }
45 45
 
46
-  if($userToAddID) {
47
-    if(!$aks) {
46
+  if ($userToAddID) {
47
+    if (!$aks) {
48 48
       // No AСS exists - making one
49
-      if(!$objFleet->group_id) {
49
+      if (!$objFleet->group_id) {
50 50
         DBStaticFleetACS::db_acs_insert($fleetid, $user, $objFleet);
51 51
 
52 52
         $aks = DBStaticFleetACS::db_acs_get_by_fleet($fleetid);
@@ -61,22 +61,22 @@  discard block
 block discarded – undo
61 61
 
62 62
     $isUserExists = false;
63 63
     $invited_ar = explode(",", $aks['eingeladen']);
64
-    foreach($invited_ar as $inv) {
65
-      if($userToAddID == $inv) {
64
+    foreach ($invited_ar as $inv) {
65
+      if ($userToAddID == $inv) {
66 66
         $isUserExists = true;
67 67
       }
68 68
     }
69 69
 
70
-    if(count($invited_ar) >= 5) {
70
+    if (count($invited_ar) >= 5) {
71 71
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
72 72
     }
73 73
 
74
-    if($isUserExists) {
74
+    if ($isUserExists) {
75 75
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
76 76
     } else {
77 77
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
78 78
       !(DBStaticFleetACS::db_acs_update($userToAddID, $fleetid)) ? die(sprintf(classLocale::$lang['fl_aks_adding_error'], classSupernova::$db->db_error())) : false;
79
-      $aks['eingeladen'] .= ',' . $userToAddID;
79
+      $aks['eingeladen'] .= ','.$userToAddID;
80 80
     }
81 81
     DBStaticMessages::msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'],
82 82
       classLocale::$lang['fl_aks_invite_message_header'], sprintf(classLocale::$lang['fl_aks_invite_message'], $user['username']));
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_ACS],
94 94
 ));
95 95
 
96
-if($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
-  foreach($members as $row) {
96
+if ($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
97
+  foreach ($members as $row) {
98 98
     $template->assign_block_vars('invited', array(
99 99
       'NAME' => $row['username'],
100 100
     ));
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
120 120
 
121 121
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
122
-foreach($fleet_data['ships'] as $ship_data) {
122
+foreach ($fleet_data['ships'] as $ship_data) {
123 123
   $template->assign_block_vars('fleets.ships', $ship_data);
124 124
 }
125 125
 
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Pretty Safe
3 3
 // TODO: Add ally_tag to usertable
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
 $ally_name_raw = sys_get_param_str_unsafe('name');
12 12
 $ally_name = db_escape($ally_name_raw);
13 13
 
14
-if($ally_tag) {
15
-  if(!$ally_name_raw || !$ally_tag_raw) {
14
+if ($ally_tag) {
15
+  if (!$ally_name_raw || !$ally_tag_raw) {
16 16
     message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']);
17 17
   }
18 18
 
19 19
   $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name);
20
-  if($query) {
20
+  if ($query) {
21 21
     message(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']);
22 22
   }
23 23
 
24 24
   DBStaticAlly::db_ally_insert($ally_name, $ally_tag, $user);
25 25
   $ally_id = classSupernova::$db->db_insert_id();
26
-  DBStaticUser::db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= " . SN_TIME_NOW . "");
26
+  DBStaticUser::db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= ".SN_TIME_NOW."");
27 27
 
28
-  $ally_user = classSupernova::$gc->cacheOperator->db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_id}");
28
+  $ally_user = classSupernova::$gc->cacheOperator->db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = ".SN_TIME_NOW.", `user_as_ally` = {$ally_id}");
29 29
   // $ally_user_id = db_insert_id();
30 30
   $ally_user_id = is_array($ally_user) ? $ally_user['id'] : 'NULL';
31 31
   DBStaticAlly::db_ally_update_ally_user($ally_user_id, $ally_id);
Please login to merge, or discard this patch.