Test Failed
Push — trunk ( 769658...cc4c01 )
by SuperNova.WS
15:09
created
admin/ajax_maintenance.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1));
6 6
 
7
-if($user['authlevel'] < 3)
7
+if ($user['authlevel'] < 3)
8 8
 {
9 9
   SnTemplate::messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']);
10 10
   die();
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
22
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23 23
   $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY);
24
-  while($row = db_fetch($query)) {
24
+  while ($row = db_fetch($query)) {
25 25
     $best_reports[] = $row['ube_report_id'];
26 26
   }
27 27
 }
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 
205 205
 function sn_maintenance_pack_user_list($user_list) {
206 206
   $user_list = explode(',', $user_list);
207
-  foreach($user_list as $key => $user_id) {
208
-    if(!is_numeric($user_id)) {
207
+  foreach ($user_list as $key => $user_id) {
208
+    if (!is_numeric($user_id)) {
209 209
       unset($user_list[$key]);
210 210
     }
211 211
   }
212 212
 
213 213
   $result = array();
214
-  if(!empty($user_list)) {
214
+  if (!empty($user_list)) {
215 215
     $query = doquery("SELECT `id` FROM `{{users}}` WHERE `id` in (" . implode(',', $user_list) . ")");
216
-    while($row = db_fetch($query)) {
216
+    while ($row = db_fetch($query)) {
217 217
       $result[] = $row['id'];
218 218
     }
219 219
   }
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 $old_server_status == GAME_DISABLE_NONE ? SN::$config->pass()->game_disable = GAME_DISABLE_MAINTENANCE : false;
229 229
 SN::db_transaction_commit();
230 230
 
231
-foreach($ques as $que_transaction) {
231
+foreach ($ques as $que_transaction) {
232 232
   SN::db_transaction_start();
233 233
 
234 234
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
235
-  foreach($que_transaction as $que) {
235
+  foreach ($que_transaction as $que) {
236 236
     set_time_limit(120);
237 237
     $QryResult = doquery($que);
238 238
     //$msg .= '<hr>' . $que . '<hr>';
Please login to merge, or discard this patch.
admin/adm_planet_list.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('INSIDE'  , true);
4
-define('INSTALL' , false);
3
+define('INSIDE', true);
4
+define('INSTALL', false);
5 5
 define('IN_ADMIN', true);
6 6
 
7 7
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR);
12 12
 
13 13
 $planet_active = sys_get_param_int('planet_active');
14
-if(!$planet_active) {
14
+if (!$planet_active) {
15 15
   $planet_type = sys_get_param_int('planet_type', 1);
16 16
   $planet_type = $planet_type == 3 ? 3 : 1;
17 17
 } else {
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $page_title =
42 42
   $lang['adm_planet_list_title'] . ': ' .
43
-  ($planet_active ? $lang['adm_planet_active'] :
44
-    ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
43
+  ($planet_active ? $lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? $lang['sys_moons'] : $lang['sys_planets']) : '')
45 44
   );
46 45
 $template->assign_vars(array(
47 46
   'PAGE_TITLE' => $page_title,
Please login to merge, or discard this patch.
dark_matter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 include_once('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) {
5
+if (SN::$gc->modules->countModulesInGroup('payment') && !SN_GOOGLE) {
6 6
   sys_redirect('metamatter.php');
7 7
 }
8 8
 
Please login to merge, or discard this patch.
flotenajax.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
   'planet' => $target_planet = sys_get_param_int('planet'),
36 36
 );
37 37
 
38
-if(!uni_coordinates_valid($target_coord))
38
+if (!uni_coordinates_valid($target_coord))
39 39
 {
40 40
   die($lang['gs_c02']);
41 41
 }
42 42
 
43 43
 $target_mission = sys_get_param_int('mission');
44 44
 $sn_group_missions = sn_get_groups('missions');
45
-if(!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX'])
45
+if (!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX'])
46 46
 {
47 47
   die($lang['gs_c00']);
48 48
 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 $target_coord['planet_type'] = $target_planet_check;
59 59
 $target_row = DBStaticPlanet::db_planet_by_vector($target_coord);
60 60
 
61
-if(empty($target_row))
61
+if (empty($target_row))
62 62
 {
63 63
   $target_row = array(
64 64
     'galaxy' => $target_coord['galaxy'],
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 $fleet_array = array();
73
-switch($target_mission)
73
+switch ($target_mission)
74 74
 {
75 75
   case MT_SPY:
76 76
     // $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs($user['spio_anz']));
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
   break;
80 80
 
81 81
   case MT_RECYCLE:
82
-    foreach(sn_get_groups('flt_recyclers') as $unit_id)
82
+    foreach (sn_get_groups('flt_recyclers') as $unit_id)
83 83
     {
84
-      if($unit_count = mrc_get_level($user, $planetrow, $unit_id))
84
+      if ($unit_count = mrc_get_level($user, $planetrow, $unit_id))
85 85
       {
86 86
         $fleet_array[$unit_id] = $unit_count;
87 87
       }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 $cant_attack = flt_can_attack($planetrow, $target_row, $fleet_array, $target_mission, $options);
103 103
 
104 104
 
105
-if($cant_attack != ATTACK_ALLOWED)
105
+if ($cant_attack != ATTACK_ALLOWED)
106 106
 {
107 107
   die($lang['fl_attack_error'][$cant_attack]);
108 108
 }
109 109
 
110
-$FleetDBArray   = array();
110
+$FleetDBArray = array();
111 111
 $db_changeset = array();
112
-foreach($fleet_array as $unit_id => $unit_count)
112
+foreach ($fleet_array as $unit_id => $unit_count)
113 113
 {
114 114
   $FleetDBArray[] = "{$unit_id},{$unit_count}";
115 115
   $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$unit_count, $user, $planetrow);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 $fleet_ship_count = array_sum($fleet_array);
120 120
 
121
-if($target_mission == MT_MISSILE)
121
+if ($target_mission == MT_MISSILE)
122 122
 {
123 123
   $distance = abs($target_coord['system'] - $planetrow['system']);
124 124
   $duration = round((30 + (60 * $distance)) / Universe::flt_server_flight_speed_multiplier());
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 {
137 137
   $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10);
138 138
 
139
-  if($planetrow['deuterium'] < $travel_data['consumption'])
139
+  if ($planetrow['deuterium'] < $travel_data['consumption'])
140 140
   {
141 141
     die($lang['gs_c13']);
142 142
   }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 $ships_sent = array();
175 175
 //$ships_sent_js = array();
176 176
 $ships_sent_js = 0;
177
-foreach($fleet_array as $unit_id => $unit_count)
177
+foreach ($fleet_array as $unit_id => $unit_count)
178 178
 {
179 179
   $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}";
180 180
   $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true);
@@ -183,6 +183,6 @@  discard block
 block discarded – undo
183 183
 //$ships_sent_js = implode(',', $ships_sent_js);
184 184
 $ships_sent_js = "{$unit_group}={$ships_sent_js}";
185 185
 
186
-$ResultMessage  = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}";
186
+$ResultMessage = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}";
187 187
 
188 188
 die($ResultMessage);
Please login to merge, or discard this patch.
stat.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
   global $who, $lang;
16 16
 
17 17
   // $sn_group_stat_common = sn_get_groups('STAT_COMMON');
18
-  foreach($array as $key => $value) {
19
-    if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) {
18
+  foreach ($array as $key => $value) {
19
+    if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) {
20 20
       continue;
21 21
     }
22 22
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 $subject_list = array(
49 49
   1 => array('header' => $lang['stat_player']),
50 50
 );
51
-if(!$source) {
51
+if (!$source) {
52 52
   $subject_list[2] = array('header' => $lang['stat_allys']);
53 53
 }
54 54
 stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 $page_count = floor($record_count / 100);
117 117
 $pages = array();
118
-for($i = 0; $i <= $page_count; $i++) {
118
+for ($i = 0; $i <= $page_count; $i++) {
119 119
   $first_element = $i * 100 + 1;
120 120
   $last_element = $first_element + 99;
121 121
   $pages[$first_element] = array(
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     'POINTS' => HelperString::numberFloorAndFormat($row['points']),
135 135
   );
136 136
 
137
-  if($who == WHO_IS_USER) {
137
+  if ($who == WHO_IS_USER) {
138 138
     $row_stat['ALLY_NAME'] = $row['ally_name'];
139 139
     $row_stat['ALLY_ID'] = $row['ally_id'];
140 140
     empty($row['username']) ? $row['username'] = $row['name'] : false;
Please login to merge, or discard this patch.
classes/SN.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -457,7 +457,8 @@  discard block
 block discarded – undo
457 457
     $location_info = &static::$location_info[$location_type];
458 458
     $id_field = $location_info[P_ID];
459 459
     $table_name = $location_info[P_TABLE_NAME];
460
-    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
460
+    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
461
+      // TODO Как-то вернуть может быть LIMIT 1 ?
461 462
     {
462 463
       if (static::$db->db_affected_rows()) {
463 464
         // Обновляем данные только если ряд был затронут
@@ -465,6 +466,7 @@  discard block
 block discarded – undo
465 466
 
466 467
         // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее
467 468
         _SnCacheInternal::$data[$location_type][$record_id] = null;
469
+    }
468 470
         // Вытаскиваем обновленную запись
469 471
         static::db_get_record_by_id($location_type, $record_id);
470 472
         _SnCacheInternal::cache_clear($location_type, false); // Мягкий сброс - только $queries
@@ -498,9 +500,11 @@  discard block
 block discarded – undo
498 500
     $set = trim($set);
499 501
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
500 502
     if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
501
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
503
+      if (static::$db->db_affected_rows()) {
504
+        // Обновляем данные только если ряд был затронут
502 505
       {
503 506
         $record_id = SN::$db->db_insert_id();
507
+      }
504 508
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
505 509
         $result = static::db_get_record_by_id($location_type, $record_id);
506 510
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -521,10 +525,12 @@  discard block
 block discarded – undo
521 525
     $id_field = $location_info[P_ID];
522 526
     $table_name = $location_info[P_TABLE_NAME];
523 527
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) {
524
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
528
+      if (static::$db->db_affected_rows()) {
529
+        // Обновляем данные только если ряд был затронут
525 530
       {
526 531
         _SnCacheInternal::cache_unset($location_type, $safe_record_id);
527 532
       }
533
+      }
528 534
     }
529 535
 
530 536
     return $result;
@@ -538,11 +544,13 @@  discard block
 block discarded – undo
538 544
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
539 545
 
540 546
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) {
541
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
547
+      if (static::$db->db_affected_rows()) {
548
+        // Обновляем данные только если ряд был затронут
542 549
       {
543 550
         // Обнуление кэша, потому что непонятно, что поменялось
544 551
         _SnCacheInternal::cache_clear($location_type);
545 552
       }
553
+      }
546 554
     }
547 555
 
548 556
     return $result;
Please login to merge, or discard this patch.
classes/Fleet/FleetStatic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
    * @return DbMysqliResultIterator|EmptyCountableIterator
19 19
    */
20 20
   public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) {
21
-    if(empty($planetIds) || !is_array($planetIds)) {
21
+    if (empty($planetIds) || !is_array($planetIds)) {
22 22
       return new EmptyCountableIterator();
23 23
     }
24 24
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $speeds = array();
42 42
     if (!empty($fleet)) {
43 43
       foreach ($fleet as $ship_id => $amount) {
44
-        if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile',]))) {
44
+        if ($amount && in_array($ship_id, sn_get_groups(['fleet', 'missile', ]))) {
45 45
           $single_ship_data = !empty($shipData[$ship_id]) ? $shipData[$ship_id] : get_ship_data($ship_id, $user);
46 46
           $speeds[]         = $single_ship_data['speed'];
47 47
         }
Please login to merge, or discard this patch.
classes/RequestInfo.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,15 +122,15 @@
 block discarded – undo
122 122
     SN::db_transaction_commit();
123 123
 
124 124
     $this->user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
125
-    $this->browser_id = db_get_set_unique_id_value('security_browser', 'browser_id', ['browser_user_agent' => $this->user_agent,]);
125
+    $this->browser_id = db_get_set_unique_id_value('security_browser', 'browser_id', ['browser_user_agent' => $this->user_agent, ]);
126 126
 
127 127
     $this->page_address    = substr($_SERVER['PHP_SELF'], strlen(SN_ROOT_RELATIVE));
128
-    $this->page_address_id = db_get_set_unique_id_value('security_url', 'url_id', ['url_string' => $this->page_address,]);
128
+    $this->page_address_id = db_get_set_unique_id_value('security_url', 'url_id', ['url_string' => $this->page_address, ]);
129 129
 
130 130
     // Not a simulator - because it can have loooooong string
131 131
     if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') !== 0 && !$skip_log_query) {
132 132
       $this->queryString = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
133
-      $this->queryStringId = db_get_set_unique_id_value('security_query_strings', 'id', ['query_string' => $this->queryString,]);
133
+      $this->queryStringId = db_get_set_unique_id_value('security_query_strings', 'id', ['query_string' => $this->queryString, ]);
134 134
     }
135 135
 
136 136
     $ip                      = sec_player_ip();
Please login to merge, or discard this patch.
classes/_SnCacheInternal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     //print("<br />CACHE CLEAR {$cache_id} " . ($hard ? 'HARD' : 'SOFT') . "<br />");
53 53
     if ($hard && !empty(_SnCacheInternal::$data[$location_type])) {
54 54
       // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях
55
-      array_walk(_SnCacheInternal::$data[$location_type], function (&$item) { $item = null; });
55
+      array_walk(_SnCacheInternal::$data[$location_type], function(&$item) { $item = null; });
56 56
     }
57 57
     _SnCacheInternal::$locator[$location_type] = [];
58 58
     _SnCacheInternal::cache_repack($location_type); // Перепаковываем внутренние структуры, если нужно
Please login to merge, or discard this patch.