Test Failed
Push — trunk ( e02d87...314b8c )
by SuperNova.WS
07:20
created
includes/includes/art_artifact.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 {
5 5
   global $lang;
6 6
 
7
-  if(!in_array($unit_id, sn_get_groups('artifacts')))
7
+  if (!in_array($unit_id, sn_get_groups('artifacts')))
8 8
   {
9 9
     return;
10 10
   }
@@ -13,17 +13,17 @@  discard block
 block discarded – undo
13 13
   $user = db_user_by_id($user['id'], true);
14 14
 
15 15
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
16
-  if($unit_level > 0)
16
+  if ($unit_level > 0)
17 17
   {
18 18
     $db_changeset = array();
19
-    switch($unit_id)
19
+    switch ($unit_id)
20 20
     {
21 21
       case ART_LHC:
22 22
       case ART_HOOK_SMALL:
23 23
       case ART_HOOK_MEDIUM:
24 24
       case ART_HOOK_LARGE:
25 25
         $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`');
26
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
26
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
27 27
         {
28 28
           $unit_level--;
29 29
           $updateDebris = false;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             break;
45 45
           }
46 46
 
47
-          if($moonSize)
47
+          if ($moonSize)
48 48
           {
49 49
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris);
50 50
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize));
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
       case ART_RCD_MEDIUM:
66 66
       case ART_RCD_LARGE:
67 67
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
68
-        if($planetrow['planet_type'] != PT_PLANET)
68
+        if ($planetrow['planet_type'] != PT_PLANET)
69 69
         {
70 70
           $message = $lang['art_rcd_err_moon'];
71 71
           break;
72 72
         }
73 73
 
74 74
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
75
-        if(!empty($que['items']))
75
+        if (!empty($que['items']))
76 76
         {
77 77
           $message = $lang['art_rcd_err_que'];
78 78
           break;
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
         $artifact_deploy = get_unit_param($unit_id, P_DEPLOY);
82 82
 
83 83
         $sectors_used = 0;
84
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
84
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
85 85
         {
86
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
86
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
87 87
             continue;
88 88
           $sectors_used += $levels_deployed;
89 89
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
90 90
         }
91 91
 
92
-        if($sectors_used == 0)
92
+        if ($sectors_used == 0)
93 93
         {
94 94
           $message = $lang['art_rcd_err_no_sense'];
95 95
           break;
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
         $que_item = null;
105 105
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
106 106
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
107
-        if(!empty($current_que))
107
+        if (!empty($current_que))
108 108
         {
109 109
           reset($current_que);
110 110
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
111 111
         }
112 112
 
113
-        if(!empty($que_item) && $que_item['que_time_left'] > 60)
113
+        if (!empty($que_item) && $que_item['que_time_left'] > 60)
114 114
         {
115 115
           $unit_level--;
116 116
           $old_time = $que_item['que_time_left'];
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
132 132
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
133 133
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
134
-        if(!empty($current_que))
134
+        if (!empty($current_que))
135 135
         {
136 136
           reset($current_que);
137 137
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
138 138
         }
139 139
 
140
-        if(isset($que_item) && $que_item['que_time_left'] > 60)
140
+        if (isset($que_item) && $que_item['que_time_left'] > 60)
141 141
         {
142 142
           $unit_level--;
143 143
           $old_time = $que_item['que_time_left'];
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
       break;
156 156
 
157 157
     }
158
-    if($unit_level != $artifact_level_old)
158
+    if ($unit_level != $artifact_level_old)
159 159
     {
160 160
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
161 161
       OldDbChangeSet::db_changeset_apply($db_changeset);
Please login to merge, or discard this patch.
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use Que\DBStaticQue;
6 6
 use Universe\Universe;
7 7
 
8
-function art_use(&$user, &$planetrow, $unit_id)
9
-{
8
+function art_use(&$user, &$planetrow, $unit_id) {
10 9
   global $lang;
11 10
 
12 11
   if(!in_array($unit_id, sn_get_groups('artifacts')))
@@ -53,14 +52,12 @@  discard block
 block discarded – undo
53 52
           {
54 53
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris);
55 54
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize));
56
-          }
57
-          else
55
+          } else
58 56
           {
59 57
             $message = $lang['art_lhc_moon_fail'];
60 58
           }
61 59
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
62
-        }
63
-        else
60
+        } else
64 61
         {
65 62
           $message = $lang['art_moon_exists'];
66 63
         }
@@ -88,8 +85,9 @@  discard block
 block discarded – undo
88 85
         $sectors_used = 0;
89 86
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
90 87
         {
91
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
92
-            continue;
88
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
89
+                      continue;
90
+          }
93 91
           $sectors_used += $levels_deployed;
94 92
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
95 93
         }
@@ -123,8 +121,7 @@  discard block
 block discarded – undo
123 121
           DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
124 122
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
125 123
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
126
-        }
127
-        else
124
+        } else
128 125
         {
129 126
           $message = $lang['art_heurestic_chip_no_research'];
130 127
         }
@@ -152,8 +149,7 @@  discard block
 block discarded – undo
152 149
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
153 150
           );
154 151
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
155
-        }
156
-        else
152
+        } else
157 153
         {
158 154
           $message = $lang['art_nano_builder_no_que'];
159 155
         }
@@ -165,8 +161,7 @@  discard block
 block discarded – undo
165 161
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
166 162
       OldDbChangeSet::db_changeset_apply($db_changeset);
167 163
     }
168
-  }
169
-  else
164
+  } else
170 165
   {
171 166
     $message = $lang['art_err_no_artifact'];
172 167
   }
Please login to merge, or discard this patch.
classes/Ube/Ube4_1/Ube4_1Calc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов
73 73
         $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100));
74 74
         $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100));
75
-        $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100));
75
+        $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100));
76 76
 
77 77
         $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count;
78 78
         $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count;
Please login to merge, or discard this patch.
classes/Fleet/MissionExplore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
    *
41 41
    * @var int[] $shipsToRemove
42 42
    */
43
-  protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY,];
43
+  protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY, ];
44 44
 
45 45
   // -------------------------------------------------------------------------------------------------------------------
46 46
   /**
Please login to merge, or discard this patch.
admin/userlist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 
86 86
   $template->assign_block_vars('user', array(
87 87
       'ID'              => $user_row['id'],
88
-      'NAME'            => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true,]),
88
+      'NAME'            => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true, ]),
89 89
       'NAME_HTML'       => htmlentities($user_row['username'], ENT_QUOTES, 'UTF-8'),
90 90
       'IP'              => $user_row['user_lastip'],
91 91
       'IP_MULTI'        => intval($multi_ip[$user_row['user_lastip']]),
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     ||
126 126
     (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet))
127 127
   ) {
128
-    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]);
128
+    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]);
129 129
     continue;
130 130
   }
131 131
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     'IS_CAPITAL'      => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'],
243 243
 
244 244
     'USER_ID'         => $uni_galaxyRowUser['id'],
245
-    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]),
245
+    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]),
246 246
     'USER_NAME_JS'    => js_safe_string($renderedNick),
247 247
     'USER_RANK'       => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'],
248 248
     'USER_BANNED'     => $uni_galaxyRowUser['banaday'],
Please login to merge, or discard this patch.
language/ru/buildings.mo.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 * DO NOT CHANGE
25 25
 */
26 26
 
27
-if (!defined('INSIDE')) die();
27
+if (!defined('INSIDE')) {
28
+  die();
29
+}
28 30
 
29 31
 $a_lang_array = array(
30 32
   'built' => 'Построено',
Please login to merge, or discard this patch.
language/en/buildings.mo.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
 * DO NOT CHANGE
27 27
 */
28 28
 
29
-if (!defined('INSIDE')) die();
29
+if (!defined('INSIDE')) {
30
+  die();
31
+}
30 32
 
31 33
 
32 34
 $a_lang_array = array(
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
@@ -419,7 +419,8 @@  discard block
 block discarded – undo
419 419
     $location_info = &static::$location_info[$location_type];
420 420
     $id_field = $location_info[P_ID];
421 421
     $table_name = $location_info[P_TABLE_NAME];
422
-    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
422
+    if ($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
423
+      // TODO Как-то вернуть может быть LIMIT 1 ?
423 424
     {
424 425
       if (static::$db->db_affected_rows()) {
425 426
         // Обновляем данные только если ряд был затронут
@@ -427,6 +428,7 @@  discard block
 block discarded – undo
427 428
 
428 429
         // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее
429 430
         _SnCacheInternal::$data[$location_type][$record_id] = null;
431
+    }
430 432
         // Вытаскиваем обновленную запись
431 433
         static::db_get_record_by_id($location_type, $record_id);
432 434
         _SnCacheInternal::cache_clear($location_type, false); // Мягкий сброс - только $queries
@@ -460,9 +462,11 @@  discard block
 block discarded – undo
460 462
     $set = trim($set);
461 463
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
462 464
     if ($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
463
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
465
+      if (static::$db->db_affected_rows()) {
466
+        // Обновляем данные только если ряд был затронут
464 467
       {
465 468
         $record_id = db_insert_id();
469
+      }
466 470
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
467 471
         $result = static::db_get_record_by_id($location_type, $record_id);
468 472
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -483,10 +487,12 @@  discard block
 block discarded – undo
483 487
     $id_field = $location_info[P_ID];
484 488
     $table_name = $location_info[P_TABLE_NAME];
485 489
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}")) {
486
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
490
+      if (static::$db->db_affected_rows()) {
491
+        // Обновляем данные только если ряд был затронут
487 492
       {
488 493
         _SnCacheInternal::cache_unset($location_type, $safe_record_id);
489 494
       }
495
+      }
490 496
     }
491 497
 
492 498
     return $result;
@@ -500,11 +506,13 @@  discard block
 block discarded – undo
500 506
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
501 507
 
502 508
     if ($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}")) {
503
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
509
+      if (static::$db->db_affected_rows()) {
510
+        // Обновляем данные только если ряд был затронут
504 511
       {
505 512
         // Обнуление кэша, потому что непонятно, что поменялось
506 513
         _SnCacheInternal::cache_clear($location_type);
507 514
       }
515
+      }
508 516
     }
509 517
 
510 518
     return $result;
Please login to merge, or discard this patch.
buildings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
 $mode = sys_get_param_escaped('mode');
22 22
 $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode)));
23 23
 
24
-if($building_sort = sys_get_param_id('sort_elements')) {
25
-  if(!empty($lang['player_option_building_sort'][$building_sort])) {
24
+if ($building_sort = sys_get_param_id('sort_elements')) {
25
+  if (!empty($lang['player_option_building_sort'][$building_sort])) {
26 26
     SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort;
27 27
     SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0);
28 28
   }
Please login to merge, or discard this patch.