Test Failed
Branch work-fleets (d40084)
by SuperNova.WS
05:20
created
blitz_register.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 global $user;
6 6
 
7
-if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
7
+if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) {
8 8
   $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : (
9 9
   !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : ''
10 10
   );
11 11
 
12
-  if($error_message) {
12
+  if ($error_message) {
13 13
     message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10);
14 14
     die();
15 15
   }
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round'));
19 19
 $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price'));
20 20
 
21
-if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
21
+if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
22 22
   sn_db_transaction_start();
23 23
   $user = DBStaticUser::db_user_by_id($user['id'], true);
24 24
   $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round);
25
-  if(sys_get_param_str('register_me')) {
26
-    if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
25
+  if (sys_get_param_str('register_me')) {
26
+    if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
27 27
       db_blitz_reg_insert($user, $current_round);
28 28
       classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
29 29
     }
30
-  } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) {
30
+  } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) {
31 31
     db_blitz_reg_delete($user, $current_round);
32 32
     classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица");
33 33
   }
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 $blitz_players = 0;
43 43
 $blitz_prize_dark_matter = 0;
44 44
 $blitz_prize_places = 0;
45
-if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
46
-  if(sys_get_param_str('generate')) {
45
+if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) {
46
+  if (sys_get_param_str('generate')) {
47 47
     $next_id = 0;
48 48
     $query = db_blitz_reg_get_random_id($current_round);
49
-    while($row = db_fetch($query)) {
49
+    while ($row = db_fetch($query)) {
50 50
       $next_id++;
51
-      $blitz_name = 'Игрок' . $next_id;
51
+      $blitz_name = 'Игрок'.$next_id;
52 52
       $blitz_password = sys_random_string(8);
53 53
       db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row, $current_round);
54 54
     }
55
-  } elseif(sys_get_param_str('import_generated')) {
55
+  } elseif (sys_get_param_str('import_generated')) {
56 56
     // ЭТО НА БЛИЦЕ!!!
57 57
     DBStaticUser::db_player_list_blitz_delete_players();
58 58
     DBStaticPlanet::db_planets_purge();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $system = $system_step;
75 75
     $planet = round(Vector::$knownPlanets / 2);
76 76
 
77
-    foreach($imported_string as &$string_data) {
77
+    foreach ($imported_string as &$string_data) {
78 78
       $string_data = explode(',', $string_data);
79 79
       $username_safe = $string_data[0];
80 80
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
       $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false);
96 96
 
97
-      if(($system += $system_step) >= Vector::$knownSystems) {
97
+      if (($system += $system_step) >= Vector::$knownSystems) {
98 98
         $galaxy++;
99 99
         $system = $system_step;
100 100
       }
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
     classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players);
105 105
     // pdump($imported_string);
106 106
     // generated_string
107
-  } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
107
+  } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) {
108 108
     $blitz_result = explode(';', $blitz_result_string);
109 109
     $blitz_last_update = $blitz_result[0]; // Пока не используется
110 110
     unset($blitz_result[0]);
111
-    foreach($blitz_result as $blitz_result_data) {
111
+    foreach ($blitz_result as $blitz_result_data) {
112 112
       $blitz_result_data = explode(',', $blitz_result_data);
113
-      if(count($blitz_result_data) == 5) {
113
+      if (count($blitz_result_data) == 5) {
114 114
         $blitz_result_data[1] = db_escape($blitz_result_data[1]);
115 115
         db_blitz_reg_update_results($blitz_result_data, $current_round);
116 116
       }
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
     $blitz_result = array();
119 119
   }
120 120
 
121
-  if(classSupernova::$config->game_mode == GAME_BLITZ) {
121
+  if (classSupernova::$config->game_mode == GAME_BLITZ) {
122 122
     $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update'));
123
-    foreach(DBStaticUser::db_player_list_export_blitz_info() as $row) {
123
+    foreach (DBStaticUser::db_player_list_export_blitz_info() as $row) {
124 124
       $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}";
125 125
     }
126 126
   } else {
127 127
     $query = db_blitz_reg_get_player_list($current_round);
128
-    while($row = db_fetch($query)) {
128
+    while ($row = db_fetch($query)) {
129 129
       $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}";
130 130
       $row['blitz_online'] ? $blitz_prize_players_active++ : false;
131 131
       $blitz_players++;
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
     $blitz_prize_dark_matter = $blitz_prize_players_active * 20000;
134 134
     $blitz_prize_places = ceil($blitz_prize_players_active / 5);
135 135
 
136
-    if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
136
+    if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) {
137 137
       // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter');
138 138
       $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places');
139 139
       sn_db_transaction_start();
140 140
       $query = db_blitz_reg_get_player_list_order_by_place($current_round);
141
-      while($row = db_fetch($query)) {
142
-        if(!$row['blitz_place']) {
141
+      while ($row = db_fetch($query)) {
142
+        if (!$row['blitz_place']) {
143 143
           continue;
144 144
         }
145 145
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 
149 149
         $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter'];
150 150
         pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']);
151
-        if($reward) {
151
+        if ($reward) {
152 152
           rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf(
153 153
             classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name']
154 154
           ));
155 155
           db_blitz_reg_update_apply_results($reward, $row, $current_round);
156 156
         }
157 157
 
158
-        if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
158
+        if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) {
159 159
           break;
160 160
         }
161 161
       }
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 
171 171
 $player_registered = false;
172 172
 $query = db_blitz_reg_get_player_list_and_users($current_round);
173
-while($row = db_fetch($query)) {
173
+while ($row = db_fetch($query)) {
174 174
   $tpl_player_data = array(
175 175
     'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)),
176 176
   );
177 177
 
178
-  if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
178
+  if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) {
179 179
     // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда
180 180
     $tpl_player_data = array_merge($tpl_player_data, array(
181 181
       'ID'                       => $row['id'],
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
   }
189 189
 
190 190
   $template->assign_block_vars('registrations', $tpl_player_data);
191
-  if($row['id'] == $user['id']) {
191
+  if ($row['id'] == $user['id']) {
192 192
     $player_registered = $row;
193 193
   }
194 194
 }
Please login to merge, or discard this patch.
includes/classes/DBMysqliStatementIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     $fields[0] = &$this->_result;
16 16
 
17
-    while($field = mysqli_fetch_field($data)) {
17
+    while ($field = mysqli_fetch_field($data)) {
18 18
       $fields[] = &$out[$field->name];
19 19
     }
20 20
 
Please login to merge, or discard this patch.
includes/classes/HelperArray.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
     static::makeArrayRef($arrayNew);
102 102
     static::makeArrayRef($arrayOld);
103 103
 
104
-    switch($mergeStrategy) {
104
+    switch ($mergeStrategy) {
105 105
       case HelperArray::MERGE_PHP:
106 106
         $arrayOld = array_merge($arrayOld, $arrayNew);
107 107
       break;
Please login to merge, or discard this patch.
includes/classes/UBE/ArrayAccessV2.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
    * @param mixed $offset <p>
119 119
    * The offset to assign the value to.
120 120
    * </p>
121
-   * @param mixed $value <p>
121
+   * @param Unit $value <p>
122 122
    * The value to set.
123 123
    * </p>
124 124
    *
Please login to merge, or discard this patch.
includes/classes/UBE/ContainerArrayOfObject.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
    * @param array  $arguments
20 20
    */
21 21
   public function __call($method_name, array $arguments) {
22
-    foreach($this->_container as $object) {
23
-      if(is_object($object) && method_exists($object, $method_name)) {
22
+    foreach ($this->_container as $object) {
23
+      if (is_object($object) && method_exists($object, $method_name)) {
24 24
         call_user_func_array(array($object, $method_name), $arguments);
25 25
       }
26 26
     }
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
    */
36 36
   public function getSumProperty($property_name) {
37 37
     $result = 0.0;
38
-    foreach($this->_container as $object) {
39
-      if(is_object($object) && property_exists($object, $property_name)) {
38
+    foreach ($this->_container as $object) {
39
+      if (is_object($object) && property_exists($object, $property_name)) {
40 40
         $result += $object->$property_name;
41 41
       }
42 42
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
    * @return mixed
53 53
    */
54 54
   public function aggregateByMethod($method_name, &$result) {
55
-    foreach($this->_container as $object) {
56
-      if(is_object($object) && method_exists($object, $method_name)) {
55
+    foreach ($this->_container as $object) {
56
+      if (is_object($object) && method_exists($object, $method_name)) {
57 57
         call_user_func(array($object, $method_name), $result);
58 58
       }
59 59
     }
Please login to merge, or discard this patch.
includes/classes/UnitList.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
    */
90 90
   public function offsetSet($offset, $value) {
91 91
     if (isset($this->mapUnitIdToDb[$value->unitId])) {
92
-      classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId ' . $value->unitId . ' already exists');
92
+      classSupernova::$debug->error('UnitList::offsetSet: Unit with UnitId '.$value->unitId.' already exists');
93 93
     }
94 94
     $this->mapUnitIdToDb[$value->unitId] = $value;
95 95
     parent::offsetSet($offset, $value);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
   public function unitGetCount($unit_id) {
204 204
     if (empty($this->mapUnitIdToDb[$unit_id])) {
205
-      throw new Exception('Unit [' . $unit_id . '] is not exists in UnitList');
205
+      throw new Exception('Unit ['.$unit_id.'] is not exists in UnitList');
206 206
     }
207 207
 
208 208
     return $this->mapUnitIdToDb[$unit_id]->count;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
    */
248 248
   public function unitsCostInMetal($shipCostInMetalPerPiece) {
249 249
     $shipsCostInMetal = array();
250
-    foreach($this->mapUnitIdToDb as $ship_id => $ship) {
250
+    foreach ($this->mapUnitIdToDb as $ship_id => $ship) {
251 251
       $shipsCostInMetal[$ship_id] = $ship->count * $shipCostInMetalPerPiece[$ship_id];
252 252
     }
253 253
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      */
330 330
     $objFleet = $this->getLocatedAt();
331 331
     if (empty($objFleet)) {
332
-      throw new Exception('No fleet owner on UnitList::unitsRender() in ' . __FILE__ . '@' . __LINE__);
332
+      throw new Exception('No fleet owner on UnitList::unitsRender() in '.__FILE__.'@'.__LINE__);
333 333
     }
334 334
 
335 335
     $tplShips = array();
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 
473 473
   // TODO - DEBUG - REMOVE =============================================================================================
474 474
   public function _dump() {
475
-    print(__FILE__ . ':' . __LINE__ . "<br />");
476
-    print("Located at " . $this->getLocationDbId() . " type " . $this->getLocationType() . "<br />");
475
+    print(__FILE__.':'.__LINE__."<br />");
476
+    print("Located at ".$this->getLocationDbId()." type ".$this->getLocationType()."<br />");
477 477
 
478 478
     print('<table border="1">');
479 479
     print('<tr>');
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
 
530 530
       print('<td>');
531 531
       $type = $unit->getType();
532
-      print("[{$type}] " . classLocale::$lang['tech'][$type]);
532
+      print("[{$type}] ".classLocale::$lang['tech'][$type]);
533 533
       print('</td>');
534 534
 
535 535
       print('<td>');
536
-      print("[{$unit->unitId}] " . classLocale::$lang['tech'][$unit->unitId]);
536
+      print("[{$unit->unitId}] ".classLocale::$lang['tech'][$unit->unitId]);
537 537
       print('</td>');
538 538
 
539 539
       print('<td>');
Please login to merge, or discard this patch.
includes/includes/flt_mission_recycle.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function flt_mission_recycle($mission_data) {
13 13
   $objFleet = $mission_data->fleet;
14 14
   $destination_planet = &$mission_data->dst_planet;
15
-  if(empty($destination_planet['id'])) {
15
+  if (empty($destination_planet['id'])) {
16 16
     $objFleet->markReturned();
17 17
     $objFleet->dbSave();
18 18
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
   $RecyclerCapacity = 0;
23 23
   $OtherFleetCapacity = 0;
24 24
 
25
-  foreach($objFleet->shipsIterator() as $unit_id => $unit) {
26
-    if(in_array($unit_id, Fleet::$snGroupFleet)) {
25
+  foreach ($objFleet->shipsIterator() as $unit_id => $unit) {
26
+    if (in_array($unit_id, Fleet::$snGroupFleet)) {
27 27
       $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit->count;
28
-      if(in_array($unit_id, Fleet::$snGroupRecyclers)) {
28
+      if (in_array($unit_id, Fleet::$snGroupRecyclers)) {
29 29
         $RecyclerCapacity += $capacity;
30 30
       } else {
31 31
         $OtherFleetCapacity += $capacity;
@@ -34,33 +34,33 @@  discard block
 block discarded – undo
34 34
   }
35 35
 
36 36
   $fleet_resources_amount = $objFleet->resourcesGetTotal();
37
-  if($fleet_resources_amount > $OtherFleetCapacity) {
37
+  if ($fleet_resources_amount > $OtherFleetCapacity) {
38 38
     // Если во флоте есть другие корабли И количество ресурсов больше, чем их ёмкость трюмов - значит часть этих ресурсов лежит в трюмах переработчиков
39 39
     // Уменьшаем ёмкость переработчиков на указанную величину
40 40
     $RecyclerCapacity -= ($fleet_resources_amount - $OtherFleetCapacity);
41 41
   }
42 42
 
43 43
   $resources_recycled = array();
44
-  if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
44
+  if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
45 45
     $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
46 46
     $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
47 47
   } else {
48
-    if(($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
48
+    if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
49 49
       ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)
50 50
     ) {
51 51
       $resources_recycled[RES_METAL] = $RecyclerCapacity / 2;
52 52
       $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity / 2;
53 53
     } else {
54
-      if($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
54
+      if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
55 55
         $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
56
-        if($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
56
+        if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
57 57
           $resources_recycled[RES_METAL] = $RecyclerCapacity - $resources_recycled[RES_CRYSTAL];
58 58
         } else {
59 59
           $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
60 60
         }
61 61
       } else {
62 62
         $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
63
-        if($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
63
+        if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
64 64
           $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity - $resources_recycled[RES_METAL];
65 65
         } else {
66 66
           $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
Please login to merge, or discard this patch.
includes/includes/flt_mission_relocate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
   $destination_planet = &$mission_data->dst_planet;
16 16
 
17
-  if(empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) {
17
+  if (empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) {
18 18
     $objFleet->markReturnedAndSave();
19 19
 
20 20
     return CACHE_FLEET;
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
       $fleet_resources[RES_METAL], classLocale::$lang['Metal'],
28 28
       $fleet_resources[RES_CRYSTAL], classLocale::$lang['Crystal'],
29 29
       $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium']
30
-    ) . '<br />' . classLocale::$lang['sys_relocate_mess_user'];
31
-  foreach($objFleet->shipsIterator() as $ship_id => $ship) {
32
-    $Message .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship->count . '<br />';
30
+    ).'<br />'.classLocale::$lang['sys_relocate_mess_user'];
31
+  foreach ($objFleet->shipsIterator() as $ship_id => $ship) {
32
+    $Message .= classLocale::$lang['tech'][$ship_id].' - '.$ship->count.'<br />';
33 33
   }
34 34
   DBStaticMessages::msg_send_simple_message(
35 35
     $objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT,
Please login to merge, or discard this patch.
includes/includes/market_fleeter.inc 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
5
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
6 6
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
7 7
 }
8 8
 
9
-$page_title .= ' - ' . classLocale::$lang["eco_mrk_{$submode}"];
9
+$page_title .= ' - '.classLocale::$lang["eco_mrk_{$submode}"];
10 10
 
11 11
 $template = gettemplate('market_fleet', true);
12 12
 $template->assign_vars(array(
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
   'rpg_cost' => $rpg_cost,
15 15
 ));
16 16
 
17
-if(is_array($shipList)) {
18
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
17
+if (is_array($shipList)) {
18
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
19 19
     $intError = MARKET_NO_DM;
20 20
   }
21 21
 
@@ -28,34 +28,34 @@  discard block
 block discarded – undo
28 28
   // Блокируем запись о запасах кораблей у трейдера
29 29
   db_config_get_stockman_fleet();
30 30
 
31
-  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"] . '<ul>';
31
+  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"].'<ul>';
32 32
   $qry = array();
33 33
   $total = array();
34 34
   $db_changeset = array();
35
-  foreach($shipList as $shipID => &$shipCount) {
35
+  foreach ($shipList as $shipID => &$shipCount) {
36 36
     $shipCount = ceil(floatval($shipCount));
37
-    if(!$shipCount) {
37
+    if (!$shipCount) {
38 38
       continue;
39 39
     }
40 40
 
41
-    if($shipCount < 0) {
41
+    if ($shipCount < 0) {
42 42
       classSupernova::$debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
43 43
       $intError = MARKET_NEGATIVE_SHIPS;
44 44
       break;
45 45
     }
46 46
 
47
-    if($mode == MARKET_SCRAPPER) {
47
+    if ($mode == MARKET_SCRAPPER) {
48 48
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
49
-    } elseif($mode == MARKET_STOCKMAN) {
49
+    } elseif ($mode == MARKET_STOCKMAN) {
50 50
       $amount = $stock[$shipID];
51 51
     }
52 52
 
53
-    if($amount < $shipCount) {
53
+    if ($amount < $shipCount) {
54 54
       $intError = $error_no_stock;
55 55
       break;
56 56
     }
57 57
 
58
-    if(!in_array($shipID, Fleet::$snGroupFleet)) {
58
+    if (!in_array($shipID, Fleet::$snGroupFleet)) {
59 59
       classSupernova::$debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
60 60
       $intError = MARKET_NOT_A_SHIP;
61 61
       break;
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
72 72
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
73 73
 
74
-    foreach($resTemp as $resID => $resCount) {
74
+    foreach ($resTemp as $resID => $resCount) {
75 75
       $total[$resID] += $resCount;
76 76
     }
77 77
 
78
-    $message .= "<li>{$classLocale['tech'][$shipID]}: " . pretty_number($shipCount);
78
+    $message .= "<li>{$classLocale['tech'][$shipID]}: ".pretty_number($shipCount);
79 79
   }
80 80
 
81
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
82
-    foreach($total as $resID => $resCount) {
83
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
81
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
82
+    foreach ($total as $resID => $resCount) {
83
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
84 84
         $intError = MARKET_NO_RESOURCES;
85 85
         classSupernova::$debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
86 86
         break;
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 
91 91
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
92 92
 
93
-  if($intError == MARKET_DEAL) {
94
-    $message .= '</ul>' . classLocale::$lang["eco_mrk_{$submode}_res"] . '<ul>';
95
-    foreach($total as $resID => $resCount) {
96
-      if(!$resCount) {
93
+  if ($intError == MARKET_DEAL) {
94
+    $message .= '</ul>'.classLocale::$lang["eco_mrk_{$submode}_res"].'<ul>';
95
+    foreach ($total as $resID => $resCount) {
96
+      if (!$resCount) {
97 97
         continue;
98 98
       }
99 99
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
       // $newrow[$resID] = $planetrow[$resID] + $resCount * (-$multiplier);
102 102
       $qry[] = "`{$resource_name}` = `{$resource_name}` + ({$resCount})";
103 103
 
104
-      $message .= "<li>" . classLocale::$lang['sys_' . $resource_name] . ": " . pretty_number(abs($resCount));
104
+      $message .= "<li>".classLocale::$lang['sys_'.$resource_name].": ".pretty_number(abs($resCount));
105 105
     }
106 106
     $message .= "</ul>";
107 107
 
@@ -127,38 +127,38 @@  discard block
 block discarded – undo
127 127
       'MESSAGE' => classLocale::$lang['eco_mrk_errors'][$intError],
128 128
     ));
129 129
 
130
-    foreach($shipList as $shipID => $shipCount) {
130
+    foreach ($shipList as $shipID => $shipCount) {
131 131
       $data['ships'][$shipID] = max(0, intval($shipCount));
132 132
     }
133 133
   }
134 134
 }
135 135
 $message = '';
136 136
 
137
-if(!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
138
-  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, Fleet::$snGroupFleet)));
137
+if (!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
138
+  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, Fleet::$snGroupFleet)));
139 139
 }
140 140
 
141 141
 tpl_set_resource_info($template, $planetrow, array());
142 142
 
143
-if(!$array) {
143
+if (!$array) {
144 144
   $array = array();
145 145
 }
146 146
 
147 147
 $group_fleet = Fleet::$snGroupFleet;
148
-foreach($array as $key => $value) {
149
-  if($mode == MARKET_SCRAPPER) {
148
+foreach ($array as $key => $value) {
149
+  if ($mode == MARKET_SCRAPPER) {
150 150
     $shipID = $value;
151 151
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
152
-  } elseif($mode == MARKET_STOCKMAN) {
152
+  } elseif ($mode == MARKET_STOCKMAN) {
153 153
     $shipID = $key;
154 154
     $amount = $value;
155 155
   }
156 156
 
157
-  if(!in_array($shipID, $group_fleet)) {
157
+  if (!in_array($shipID, $group_fleet)) {
158 158
     continue;
159 159
   }
160 160
 
161
-  if($amount > 0) {
161
+  if ($amount > 0) {
162 162
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
163 163
     $template->assign_block_vars('ships', array(
164 164
       'ID'        => $shipID,
Please login to merge, or discard this patch.