Completed
Branch work-fleets (23812c)
by SuperNova.WS
13:52
created
includes/includes/flt_mission_attack.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,9 +10,8 @@
 block discarded – undo
10 10
 
11 11
 /**
12 12
  * @param Mission $objMission
13
- * @param array   $mission_data
14 13
  *
15
- * @return array|null
14
+ * @return null|boolean
16 15
  */
17 16
 function flt_mission_attack($objMission) {
18 17
   $objFleet = $objMission->fleet;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
 function flt_mission_attack($objMission) {
18 18
   $objFleet = $objMission->fleet;
19 19
 
20
-  if($objFleet->getShipCount() <= 0) {
20
+  if ($objFleet->getShipCount() <= 0) {
21 21
     return null;
22 22
   }
23 23
 
24 24
   $destination_user = $objMission->dst_user;
25 25
   $destination_planet = $objMission->dst_planet;
26 26
 
27
-  if(
27
+  if (
28 28
     // Нет данных о планете назначения или её владельце
29 29
     empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet)
30 30
     ||
Please login to merge, or discard this patch.
includes/includes/flt_mission_explore.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 /**
32 32
  * Fleet mission "Relocate"
33 33
  *
34
- * @param $mission_data Mission
34
+ * @param Mission $mission_data Mission
35 35
  *
36 36
  * @return int
37 37
  *
Please login to merge, or discard this patch.
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  discard block
 block discarded – undo
6 6
 
7 7
   $fleet_left = 1 - mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000;
8 8
   $fleet_lost = array();
9
-  foreach($fleet as $unit_id => &$unit_amount) {
9
+  foreach ($fleet as $unit_id => &$unit_amount) {
10 10
     $ships_left = floor($unit_amount * $fleet_left);
11 11
     $fleet_lost[$unit_id] = $unit_amount - $ships_left;
12 12
     $unit_amount = $ships_left;
13
-    if(!$unit_amount) {
13
+    if (!$unit_amount) {
14 14
       unset($fleet[$unit_id]);
15 15
     }
16 16
   }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
   global $lang, $config;
42 42
   static $ship_data, $rates;
43 43
 
44
-  if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
44
+  if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
45 45
     return CACHE_NONE;
46 46
   }
47 47
 
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
   $outcome_list = &$result['$outcome_list'];
71 71
   $fleet_metal_points = &$result['$fleet_metal_points'];
72 72
 
73
-  if(!$ship_data) {
74
-    foreach(sn_get_groups('fleet') as $unit_id) {
73
+  if (!$ship_data) {
74
+    foreach (sn_get_groups('fleet') as $unit_id) {
75 75
       $unit_info = get_unit_param($unit_id);
76
-      if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
76
+      if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
77 77
         continue;
78 78
       }
79 79
       $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   $fleet_metal_points = 0;
87 87
 
88 88
   $fleet_real_array = $objFleet->get_unit_list();
89
-  foreach($fleet_real_array as $ship_id => $ship_amount) {
89
+  foreach ($fleet_real_array as $ship_id => $ship_amount) {
90 90
     $unit_info = get_unit_param($ship_id);
91 91
     $fleet_capacity += $ship_amount * $unit_info[P_CAPACITY];
92 92
     $fleet_metal_points += $ship_amount * $ship_data[$ship_id][P_COST_METAL];
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
   $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7));
100 100
 
101 101
   $chance_max = 0;
102
-  foreach($outcome_list as $key => &$value) {
103
-    if(!$value['chance']) {
102
+  foreach ($outcome_list as $key => &$value) {
103
+    if (!$value['chance']) {
104 104
       unset($outcome_list[$key]);
105 105
       continue;
106 106
     }
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
   }
109 109
   $outcome_value = mt_rand(0, $chance_max);
110 110
   $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE];
111
-  foreach($outcome_list as $key => &$value) {
112
-    if(!$value['chance']) {
111
+  foreach ($outcome_list as $key => &$value) {
112
+    if (!$value['chance']) {
113 113
       continue;
114 114
     }
115 115
     $mission_outcome = $key;
116 116
     $outcome_description = $value;
117
-    if($outcome_value <= $outcome_description['value']) {
117
+    if ($outcome_value <= $outcome_description['value']) {
118 118
       break;
119 119
     }
120 120
   }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 //  $outcome_mission_sub = -1;
132 132
 
133 133
   $fleet_found = array();
134
-  switch($mission_outcome) {
134
+  switch ($mission_outcome) {
135 135
     case FLT_EXPEDITION_OUTCOME_LOST_FLEET:
136 136
       flt_mission_explore_outcome_lost_fleet($result);
137 137
     break;
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 
153 153
       // Рассчитываем стоимость самого дорого корабля в металле
154 154
       $max_metal_cost = 0;
155
-      foreach($fleet_real_array as $ship_id => $ship_amount) {
155
+      foreach ($fleet_real_array as $ship_id => $ship_amount) {
156 156
         $max_metal_cost = max($max_metal_cost, $ship_data[$ship_id]['metal_cost']);
157 157
       }
158 158
 
159 159
       // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля
160 160
       $can_be_found = array();
161
-      foreach($ship_data as $ship_id => $ship_info) {
162
-        if($ship_info['metal_cost'] < $max_metal_cost) {
161
+      foreach ($ship_data as $ship_id => $ship_info) {
162
+        if ($ship_info['metal_cost'] < $max_metal_cost) {
163 163
           $can_be_found[$ship_id] = $ship_info['metal_cost'];
164 164
         }
165 165
       }
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
       unset($can_be_found[SHIP_COLONIZER]);
168 168
       unset($can_be_found[SHIP_SPY]);
169 169
 
170
-      while(count($can_be_found) && $found_in_metal >= max($can_be_found)) {
170
+      while (count($can_be_found) && $found_in_metal >= max($can_be_found)) {
171 171
         $found_index = mt_rand(1, count($can_be_found)) - 1;
172 172
         $found_ship = array_slice($can_be_found, $found_index, 1, true);
173 173
         $found_ship_cost = reset($found_ship);
174 174
         $found_ship_id = key($found_ship);
175 175
 
176
-        if($found_ship_cost > $found_in_metal) {
176
+        if ($found_ship_cost > $found_in_metal) {
177 177
           unset($can_be_found[$found_ship_id]);
178 178
         } else {
179 179
           $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost));
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         }
183 183
       }
184 184
 
185
-      if(empty($fleet_found)) {
185
+      if (empty($fleet_found)) {
186 186
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
187 187
       } else {
188
-        foreach($fleet_found as $unit_id => $unit_amount) {
188
+        foreach ($fleet_found as $unit_id => $unit_amount) {
189 189
           $fleet_real_array[$unit_id] += $unit_amount;
190 190
         }
191 191
       }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
       $objFleet->update_resources($resources_found);
211 211
 
212
-      if(array_sum($resources_found) == 0) {
212
+      if (array_sum($resources_found) == 0) {
213 213
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
214 214
       }
215 215
     break;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
       // Рассчитываем количество найденной ТМ
221 221
       $found_dark_matter = floor(min($outcome_percent * $fleet_metal_points / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000);
222 222
 
223
-      if(!$found_dark_matter) {
223
+      if (!$found_dark_matter) {
224 224
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
225 225
       }
226 226
     break;
@@ -234,40 +234,39 @@  discard block
 block discarded – undo
234 234
 
235 235
   mission_expedition_result_adjust($result);
236 236
 
237
-  if($found_dark_matter) {
237
+  if ($found_dark_matter) {
238 238
     rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus');
239 239
     $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter);
240 240
   }
241 241
 
242
-  if(!empty($fleet_lost)) {
242
+  if (!empty($fleet_lost)) {
243 243
     $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet'];
244
-    foreach($fleet_lost as $ship_id => $ship_amount) {
244
+    foreach ($fleet_lost as $ship_id => $ship_amount) {
245 245
       $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
246 246
     }
247 247
   }
248 248
 
249
-  if(!empty($fleet_found)) {
249
+  if (!empty($fleet_found)) {
250 250
     $msg_text_addon = $lang['flt_mission_expedition']['found_fleet'];
251
-    foreach($fleet_found as $ship_id => $ship_amount) {
251
+    foreach ($fleet_found as $ship_id => $ship_amount) {
252 252
       $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
253 253
     }
254 254
   }
255 255
 
256
-  if(!empty($resources_found) && array_sum($resources_found) > 0) {
256
+  if (!empty($resources_found) && array_sum($resources_found) > 0) {
257 257
     $msg_text_addon = $lang['flt_mission_expedition']['found_resources'];
258
-    foreach($resources_found as $resource_id => $resource_amount) {
258
+    foreach ($resources_found as $resource_id => $resource_amount) {
259 259
       $msg_text_addon .= $lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n";
260 260
     }
261 261
   }
262 262
 
263
-  if(!$msg_text) {
263
+  if (!$msg_text) {
264 264
     $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages'];
265
-    if($outcome_mission_sub >= 0 && is_array($messages)) {
265
+    if ($outcome_mission_sub >= 0 && is_array($messages)) {
266 266
       $messages = &$messages[$outcome_mission_sub];
267 267
     }
268 268
 
269
-    $msg_text = is_string($messages) ? $messages :
270
-      (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
269
+    $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
271 270
   }
272 271
 
273 272
   $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type();
@@ -279,14 +278,14 @@  discard block
 block discarded – undo
279 278
 
280 279
   db_user_set_by_id($objFleet->playerOwnerId, "`player_rpg_explore_xp` = `player_rpg_explore_xp` + 1");
281 280
 
282
-  if(!empty($fleet_real_array) && $objFleet->getShipCount() >= 1) {
281
+  if (!empty($fleet_real_array) && $objFleet->getShipCount() >= 1) {
283 282
     // ПОКА НЕ НУЖНО - мы уже выше посчитали суммарные ресурсы (те, что были до отправку в экспу плюс найденное) и обновили $fleet_row
284 283
     // НО МОЖЕТ ПРИГОДИТЬСЯ, когда будем работать напрямую с $objFleet
285 284
 //    if(!empty($resources_found) && array_sum($resources_found) > 0) {
286 285
 //      $objFleet->update_resources($resources_found); // TODO - проверить, что бы не терялись ресурсы в трюме
287 286
 //    }
288 287
 
289
-    if(!empty($fleet_lost) || !empty($fleet_found)) {
288
+    if (!empty($fleet_lost) || !empty($fleet_found)) {
290 289
       $objFleet->replace_ships($fleet_real_array);
291 290
     }
292 291
     $objFleet->mark_fleet_as_returned();
Please login to merge, or discard this patch.
includes/template.php 2 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @param string    $title
35 35
  * @param string    $dest
36 36
  * @param int       $time
37
- * @param bool|true $show_header
37
+ * @param boolean $show_header
38 38
  */
39 39
 function message($mes, $title = 'Error', $dest = '', $time = 5, $show_header = true) {
40 40
   $template = gettemplate('message_body', true);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  * @param bool|true       $isDisplayTopNav
196 196
  * @param string          $metatags
197 197
  * @param bool|false      $AdminPage
198
- * @param bool|true       $isDisplayMenu
198
+ * @param boolean       $isDisplayMenu
199 199
  *
200 200
  * @return mixed
201 201
  */
@@ -208,7 +208,6 @@  discard block
 block discarded – undo
208 208
  * @param string          $title
209 209
  * @param bool|true       $isDisplayTopNav
210 210
  * @param string          $metatags
211
- * @param bool|false      $AdminPage
212 211
  * @param bool|true       $isDisplayMenu
213 212
  * @param bool|int|string $exitStatus - Код или сообщение выхода
214 213
  */
@@ -385,10 +384,10 @@  discard block
 block discarded – undo
385 384
 
386 385
 /**
387 386
  * @param       $time
388
- * @param       $event
387
+ * @param       integer $event
389 388
  * @param       $msg
390 389
  * @param       $coordinates
391
- * @param       $is_decrease
390
+ * @param       boolean $is_decrease
392 391
  * @param Fleet $objFleet
393 392
  * @param       $fleet_flying_sorter
394 393
  * @param       $fleet_flying_events
@@ -708,7 +707,7 @@  discard block
 block discarded – undo
708 707
 }
709 708
 
710 709
 /**
711
- * @param array|string  $files
710
+ * @param string  $files
712 711
  * @param template|bool $template
713 712
  * @param string|bool   $template_path
714 713
  *
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 function gettemplatename($u_dpath) {
11 11
   static $template_names = array();
12 12
 
13
-  if(!isset($template_names[$u_dpath])) {
13
+  if (!isset($template_names[$u_dpath])) {
14 14
     $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME;
15 15
   }
16 16
 
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
  * @param $sn_menu_extra
53 53
  */
54 54
 function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) {
55
-  if(empty($sn_menu) || empty($sn_menu_extra)) {
55
+  if (empty($sn_menu) || empty($sn_menu_extra)) {
56 56
     return;
57 57
   }
58 58
 
59
-  foreach($sn_menu_extra as $menu_item_id => $menu_item) {
60
-    if(empty($menu_item['LOCATION'])) {
59
+  foreach ($sn_menu_extra as $menu_item_id => $menu_item) {
60
+    if (empty($menu_item['LOCATION'])) {
61 61
       $sn_menu[$menu_item_id] = $menu_item;
62 62
       continue;
63 63
     }
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     unset($menu_item['LOCATION']);
67 67
 
68 68
     $is_positioned = $item_location[0];
69
-    if($is_positioned == '+' || $is_positioned == '-') {
69
+    if ($is_positioned == '+' || $is_positioned == '-') {
70 70
       $item_location = substr($item_location, 1);
71 71
     } else {
72 72
       $is_positioned = '';
73 73
     }
74 74
 
75
-    if($item_location) {
75
+    if ($item_location) {
76 76
       $menu_keys = array_keys($sn_menu);
77 77
       $insert_position = array_search($item_location, $menu_keys);
78
-      if($insert_position === false) {
78
+      if ($insert_position === false) {
79 79
         $insert_position = count($sn_menu) - 1;
80 80
         $is_positioned = '+';
81 81
         $item_location = '';
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position);
89 89
     $sn_menu[$menu_item_id] = $menu_item;
90 90
 
91
-    if(!$is_positioned && $item_location) {
91
+    if (!$is_positioned && $item_location) {
92 92
       unset($spliced[$item_location]);
93 93
     }
94 94
     $sn_menu = array_merge($sn_menu, $spliced);
@@ -104,24 +104,24 @@  discard block
 block discarded – undo
104 104
 function tpl_menu_assign_to_template(&$sn_menu, &$template) {
105 105
   global $lang;
106 106
 
107
-  if(empty($sn_menu) || !is_array($sn_menu)) {
107
+  if (empty($sn_menu) || !is_array($sn_menu)) {
108 108
     return;
109 109
   }
110 110
 
111
-  foreach($sn_menu as $menu_item_id => $menu_item) {
112
-    if(!$menu_item) {
111
+  foreach ($sn_menu as $menu_item_id => $menu_item) {
112
+    if (!$menu_item) {
113 113
       continue;
114 114
     }
115 115
 
116
-    if(is_string($menu_item_id)) {
116
+    if (is_string($menu_item_id)) {
117 117
       $menu_item['ID'] = $menu_item_id;
118 118
     }
119 119
 
120
-    if($menu_item['TYPE'] == 'lang') {
120
+    if ($menu_item['TYPE'] == 'lang') {
121 121
       $lang_string = &$lang;
122
-      if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
123
-        for($i = 1; $i < count($matches); $i++) {
124
-          if(defined($matches[$i])) {
122
+      if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
123
+        for ($i = 1; $i < count($matches); $i++) {
124
+          if (defined($matches[$i])) {
125 125
             $matches[$i] = constant($matches[$i]);
126 126
           }
127 127
           $lang_string = &$lang_string[$matches[$i]];
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
     $menu_item['ALT'] = htmlentities($menu_item['ALT']);
134 134
     $menu_item['TITLE'] = htmlentities($menu_item['TITLE']);
135 135
 
136
-    if(!empty($menu_item['ICON'])) {
137
-      if(is_string($menu_item['ICON'])) {
136
+    if (!empty($menu_item['ICON'])) {
137
+      if (is_string($menu_item['ICON'])) {
138 138
         $menu_item['ICON_PATH'] = $menu_item['ICON'];
139 139
       } else {
140 140
         $menu_item['ICON'] = $menu_item_id;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     'MENU_START_HIDE'     => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'),
165 165
   ));
166 166
 
167
-  if(isset($template_result['MENU_CUSTOMIZE'])) {
167
+  if (isset($template_result['MENU_CUSTOMIZE'])) {
168 168
     $template->assign_vars(array(
169 169
       'PLAYER_OPTION_MENU_SHOW_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON],
170 170
       'PLAYER_OPTION_MENU_HIDE_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON],
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     ));
179 179
   }
180 180
 
181
-  if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
181
+  if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
182 182
     tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra);
183 183
     tpl_menu_assign_to_template($sn_menu_admin, $template);
184 184
   } else {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
   $in_admin = defined('IN_ADMIN') && IN_ADMIN === true;
219 219
   $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true;
220 220
 
221
-  if(is_object($page)) {
221
+  if (is_object($page)) {
222 222
     isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false;
223 223
     isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false;
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false;
227 227
   }
228 228
 
229
-  if(empty($user['id']) || !is_numeric($user['id'])) {
229
+  if (empty($user['id']) || !is_numeric($user['id'])) {
230 230
     $isDisplayMenu = false;
231 231
     $isDisplayTopNav = false;
232 232
   }
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
   $user_time_measured_unix = intval(isset($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) ? strtotime($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) : 0);
239 239
 
240 240
   $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE];
241
-  if(strpos($font_size, '%') !== false) {
241
+  if (strpos($font_size, '%') !== false) {
242 242
     // Размер шрифта в процентах
243 243
     $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
244
-  } elseif(strpos($font_size, 'px') !== false) {
244
+  } elseif (strpos($font_size, 'px') !== false) {
245 245
     // Размер шрифта в пикселях
246 246
     $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
247 247
   } else {
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 
254 254
   $template = gettemplate('_global_header', true);
255 255
 
256
-  if(!empty($sn_mvc['javascript'])) {
257
-    foreach($sn_mvc['javascript'] as $page_name => $script_list) {
258
-      if(empty($page_name) || $page_name == $sn_page_name) {
259
-        foreach($script_list as $filename => $content) {
256
+  if (!empty($sn_mvc['javascript'])) {
257
+    foreach ($sn_mvc['javascript'] as $page_name => $script_list) {
258
+      if (empty($page_name) || $page_name == $sn_page_name) {
259
+        foreach ($script_list as $filename => $content) {
260 260
           $template_result['.']['javascript'][] = array(
261 261
             'FILE'    => $filename,
262 262
             'CONTENT' => $content,
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   $sn_mvc['css'][''] = array_merge($standard_css, $sn_mvc['css']['']);
291 291
 
292 292
 
293
-  foreach($sn_mvc['css'] as $page_name => $script_list) {
294
-    if(empty($page_name) || $page_name == $sn_page_name) {
295
-      foreach($script_list as $filename => $content) {
293
+  foreach ($sn_mvc['css'] as $page_name => $script_list) {
294
+    if (empty($page_name) || $page_name == $sn_page_name) {
295
+      foreach ($script_list as $filename => $content) {
296 296
         $template_result['.']['css'][] = array(
297 297
           'FILE'    => $filename,
298 298
           'CONTENT' => $content,
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
   $template->assign_recursive($template_result);
340 340
   displayP(parsetemplate($template));
341 341
 
342
-  if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
342
+  if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
343 343
     // $AdminPage = $AdminPage ? $user['authlevel'] : 0;
344 344
     displayP(parsetemplate(tpl_render_menu()));
345 345
   }
346 346
 
347
-  if($isDisplayTopNav && !$in_admin) {
347
+  if ($isDisplayTopNav && !$in_admin) {
348 348
     displayP(parsetemplate(tpl_render_topnav($user, $planetrow)));
349 349
   }
350 350
 
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 
353 353
   !is_array($page) ? $page = array($page) : false;
354 354
   $result_added = false;
355
-  foreach($page as $page_item) {
356
-    if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
355
+  foreach ($page as $page_item) {
356
+    if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
357 357
       $page_item = gettemplate('_result_message', $page_item);
358 358
       $temp = $page_item->files['_result_message'];
359 359
       unset($page_item->files['_result_message']);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
   ));
377 377
   displayP(parsetemplate($template));
378 378
 
379
-  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
379
+  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
380 380
 
381 381
   sn_db_disconnect();
382 382
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
  * @param string         $type
415 415
  */
416 416
 function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') {
417
-  if(empty($FleetList)) {
417
+  if (empty($FleetList)) {
418 418
     return;
419 419
   }
420 420
 
@@ -423,19 +423,19 @@  discard block
 block discarded – undo
423 423
   $fleet_event_count = 0;
424 424
   $fleet_flying_sorter = array();
425 425
   $fleet_flying_events = array();
426
-  foreach($FleetList->_container as $objFleet) {
426
+  foreach ($FleetList->_container as $objFleet) {
427 427
     $will_return = true;
428
-    if($objFleet->is_returning == 0) {
428
+    if ($objFleet->is_returning == 0) {
429 429
       // cut fleets on Hold and Expedition
430
-      if($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
430
+      if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
431 431
         $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false;
432 432
         tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, $lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
433 433
       }
434
-      if($objFleet->time_mission_job_complete) {
434
+      if ($objFleet->time_mission_job_complete) {
435 435
         tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, $lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
436 436
       }
437 437
     }
438
-    if($will_return) {
438
+    if ($will_return) {
439 439
       tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, $lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
440 440
     }
441 441
   }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
   asort($fleet_flying_sorter);
444 444
 
445 445
   $fleet_flying_count = $FleetList->count();
446
-  foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
446
+  foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
447 447
     $fleet_event = &$fleet_flying_events[$fleet_event_id];
448 448
     $template->assign_block_vars("flying_{$type}s", array(
449 449
       'TIME' => max(0, $fleet_time - SN_TIME_NOW),
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 function sn_tpl_render_topnav(&$user, $planetrow) {
472 472
   global $lang, $config, $sn_module_list, $template_result, $sn_mvc;
473 473
 
474
-  if(!is_array($user)) {
474
+  if (!is_array($user)) {
475 475
     return '';
476 476
   }
477 477
 
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
 
493 493
   $ThisUsersPlanets = db_planet_list_sorted($user);
494 494
   // while ($CurPlanet = db_fetch($ThisUsersPlanets))
495
-  foreach($ThisUsersPlanets as $CurPlanet) {
496
-    if($CurPlanet['destruyed']) {
495
+  foreach ($ThisUsersPlanets as $CurPlanet) {
496
+    if ($CurPlanet['destruyed']) {
497 497
       continue;
498 498
     }
499 499
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
    */
518 518
   $fleet_flying_list = array();
519 519
   $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']);
520
-  foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
521
-    if(empty($fleet_flying_list[$objFleet->mission_type])) {
520
+  foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
521
+    if (empty($fleet_flying_list[$objFleet->mission_type])) {
522 522
       $fleet_flying_list[$objFleet->mission_type] = new FleetList();
523 523
     }
524 524
     $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet;
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
   que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]);
531 531
   que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true);
532 532
 
533
-  if(!empty($sn_mvc['navbar_prefix_button']) && is_array($sn_mvc['navbar_prefix_button'])) {
534
-    foreach($sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
533
+  if (!empty($sn_mvc['navbar_prefix_button']) && is_array($sn_mvc['navbar_prefix_button'])) {
534
+    foreach ($sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
535 535
       $template->assign_block_vars('navbar_prefix_button', array(
536 536
         'IMAGE'        => $navbar_button_image,
537 537
         'URL_RELATIVE' => $navbar_button_url,
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
   $time_now_parsed = getdate(SN_TIME_NOW);
546 546
   $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW);
547 547
 
548
-  if($config->game_news_overview) {
548
+  if ($config->game_news_overview) {
549 549
     $user_last_read_safe = intval($user['news_lastread']);
550 550
     nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", $config->game_news_overview);
551 551
   }
552 552
 
553 553
   $notes_query = db_note_list_by_owner($user['id'], true);
554
-  while($note_row = db_fetch($notes_query)) {
554
+  while ($note_row = db_fetch($notes_query)) {
555 555
     note_assign($template, $note_row);
556 556
   }
557 557
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     'QUE_ID'   => QUE_RESEARCH,
563 563
     'QUE_HTML' => 'topnav',
564 564
 
565
-    'RESEARCH_ONGOING' => (boolean)$user['que'],
565
+    'RESEARCH_ONGOING' => (boolean) $user['que'],
566 566
 
567 567
     'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
568 568
       $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     'QUE_STRUCTURES' => QUE_STRUCTURES,
640 640
   ));
641 641
 
642
-  if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
642
+  if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
643 643
     tpl_set_resource_info($template, $planetrow);
644 644
     $template->assign_vars(array(
645 645
       'SN_RENDER_NAVBAR_PLANET' => true,
@@ -654,12 +654,12 @@  discard block
 block discarded – undo
654 654
  * @param template|string $template
655 655
  */
656 656
 function displayP($template) {
657
-  if(is_object($template)) {
658
-    if(empty($template->parsed)) {
657
+  if (is_object($template)) {
658
+    if (empty($template->parsed)) {
659 659
       parsetemplate($template);
660 660
     }
661 661
 
662
-    foreach($template->files as $section => $filename) {
662
+    foreach ($template->files as $section => $filename) {
663 663
       $template->display($section);
664 664
     }
665 665
   } else {
@@ -674,11 +674,11 @@  discard block
 block discarded – undo
674 674
  * @return mixed
675 675
  */
676 676
 function parsetemplate($template, $array = false) {
677
-  if(is_object($template)) {
677
+  if (is_object($template)) {
678 678
     global $user;
679 679
 
680
-    if(!empty($array) && is_array($array)) {
681
-      foreach($array as $key => $data) {
680
+    if (!empty($array) && is_array($array)) {
681
+      foreach ($array as $key => $data) {
682 682
         $template->assign_var($key, $data);
683 683
       }
684 684
     }
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
   $template_ex = '.tpl.html';
721 721
 
722
-  if($template === false) {
722
+  if ($template === false) {
723 723
     return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex);
724 724
   }
725 725
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
   !empty($sn_mvc['i18n']['']) ? lng_load_i18n($sn_mvc['i18n']['']) : false;
740 740
   $sn_page_name ? lng_load_i18n($sn_mvc['i18n'][$sn_page_name]) : false;
741 741
 
742
-  foreach($files as &$filename) {
742
+  foreach ($files as &$filename) {
743 743
     $filename = $filename . $template_ex;
744 744
   }
745 745
 
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
     'LANG'     => $language ? $language : '',
765 765
     'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
766 766
 
767
-    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
767
+    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
768 768
     'FILENAME'       => basename($_SERVER['PHP_SELF']),
769 769
   ));
770 770
 
771
-  foreach(lng_get_list() as $lng_id => $lng_data) {
772
-    if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
773
-      foreach($lng_data['LANG_VARIANTS'] as $lang_variant) {
771
+  foreach (lng_get_list() as $lng_id => $lng_data) {
772
+    if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
773
+      foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
774 774
         $lng_data1 = $lng_data;
775 775
         $lng_data1 = array_merge($lng_data1, $lang_variant);
776 776
         $template->assign_block_vars('language', $lng_data1);
@@ -793,8 +793,8 @@  discard block
 block discarded – undo
793 793
   $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']];
794 794
 
795 795
   $que_length = 0;
796
-  if(!empty($que)) {
797
-    foreach($que as $que_item) {
796
+  if (!empty($que)) {
797
+    foreach ($que as $que_item) {
798 798
       $template->assign_block_vars('que', que_tpl_parse_element($que_item));
799 799
     }
800 800
     $que_length = count($que);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) {
812 812
   global $lang;
813 813
 
814
-  foreach($density_price_chart as $density_price_index => &$density_price_data) {
814
+  foreach ($density_price_chart as $density_price_index => &$density_price_data) {
815 815
     $density_cost = $density_price_data;
816 816
     $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false);
817 817
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 function tpl_assign_select(&$template, $name, $values) {
836 836
   !is_array($values) ? $values = array($values => $values) : false;
837 837
 
838
-  foreach($values as $key => $value) {
838
+  foreach ($values as $key => $value) {
839 839
     $template->assign_block_vars($name, array(
840 840
       'KEY'   => htmlentities($key, ENT_COMPAT, 'UTF-8'),
841 841
       'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'),
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if($config->game_mode == GAME_BLITZ) {
15
+if ($config->game_mode == GAME_BLITZ) {
16 16
   message($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type) {
29
-  switch($type) {
28
+if ($searchtext && $type) {
29
+  switch ($type) {
30 30
     case "planetname":
31 31
       // $search = db_planet_list_search($searchtext);
32 32
     break;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     break;
42 42
   }
43 43
 
44
-  while($row = db_fetch($search)) {
45
-    if($type == 'playername' || $type == 'planetname') {
44
+  while ($row = db_fetch($search)) {
45
+    if ($type == 'playername' || $type == 'planetname') {
46 46
       $template->assign_block_vars('search_result', array(
47 47
         'PLAYER_ID'       => $row['uid'],
48 48
         'PLAYER_NAME'     => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         'ALLY_NAME'       => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
58 58
         'ALLY_TAG'        => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
59 59
       ));
60
-    } elseif($type == 'ally') {
60
+    } elseif ($type == 'ally') {
61 61
       $template->assign_block_vars('search_result', array(
62 62
         'ALLY_NAME'     => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
63 63
         'ALLY_TAG'      => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   'ally'       => 'sys_alliance',
76 76
 );
77 77
 
78
-foreach($search_type as $type_id => $type_lang) {
78
+foreach ($search_type as $type_id => $type_lang) {
79 79
   $template->assign_block_vars('type', array(
80 80
     'ID'       => $type_id,
81 81
     'TEXT'     => $lang[$type_lang],
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,25 +12,25 @@  discard block
 block discarded – undo
12 12
 global $debug, $sn_mvc, $template_result, $user;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php
17 17
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
18 18
 }
19 19
 unset($disable_reason);
20 20
 
21 21
 
22
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
22
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
23 23
   lng_include('admin');
24
-} elseif($sys_user_logged_in) {
24
+} elseif ($sys_user_logged_in) {
25 25
   sys_user_vacation($user);
26 26
 
27 27
   $planet_id = SetSelectedPlanet($user);
28 28
 
29 29
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
30
-  if($user['ally_id']) {
30
+  if ($user['ally_id']) {
31 31
     sn_db_transaction_start();
32 32
     sn_ali_fill_user_ally($user);
33
-    if(!$user['ally']['player']['id']) {
33
+    if (!$user['ally']['player']['id']) {
34 34
       // sn_sys_logout(false, true);
35 35
       // core_auth::logout(false);
36 36
       classSupernova::$auth->logout(false);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   sn_db_transaction_commit();
50 50
 
51 51
   $planetrow = $global_data['planet'];
52
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
53 53
     // sn_sys_logout(false, true);
54 54
     // core_auth::logout(false);
55 55
     classSupernova::$auth->logout(false);
Please login to merge, or discard this patch.
fleet.php 2 patches
Switch Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -69,121 +69,121 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 switch ($fleet_page) {
72
-  case 3:
72
+    case 3:
73 73
 
74
-  case 2:
75
-    $fleet_group_mr = sys_get_param_id('fleet_group');
76
-    $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
74
+    case 2:
75
+      $fleet_group_mr = sys_get_param_id('fleet_group');
76
+      $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77
+      $fleetarray = is_array($fleetarray) ? $fleetarray : array();
78 78
 
79
-    foreach($fleetarray as $ship_id => &$ship_amount) {
80
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82
-        die();
83
-      }
84
-      $ship_amount = floatval($ship_amount);
85
-    }
86
-
87
-    $UsedPlanet = false;
88
-    $YourPlanet = false;
89
-    $missiontype = array();
90
-    if ($planet > $config->game_maxPlanet) {
91
-      $target_mission = MT_EXPLORE;
92
-      $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
93
-    } elseif ($galaxy && $system && $planet) {
94
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
95
-
96
-      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
97
-
98
-      if ($TargetPlanet['id_owner']) {
99
-        $UsedPlanet = true;
100
-        if ($TargetPlanet['id_owner'] == $user['id']) {
101
-          $YourPlanet = true;
79
+      foreach($fleetarray as $ship_id => &$ship_amount) {
80
+        if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82
+          die();
102 83
         }
84
+        $ship_amount = floatval($ship_amount);
103 85
       }
104 86
 
105
-      if (!$UsedPlanet) {
106
-        if ($fleetarray[SHIP_COLONIZER]) {
107
-          $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
108
-          $target_mission = MT_COLONIZE;
109
-          $planet_type = PT_PLANET;
110
-        } else {
111
-          message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
112
-        }
113
-      } else {
114
-        $recyclers = 0;
115
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
116
-          $recyclers += $fleetarray[$recycler_id];
87
+      $UsedPlanet = false;
88
+      $YourPlanet = false;
89
+      $missiontype = array();
90
+      if ($planet > $config->game_maxPlanet) {
91
+        $target_mission = MT_EXPLORE;
92
+        $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
93
+      } elseif ($galaxy && $system && $planet) {
94
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
95
+
96
+        $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
97
+
98
+        if ($TargetPlanet['id_owner']) {
99
+          $UsedPlanet = true;
100
+          if ($TargetPlanet['id_owner'] == $user['id']) {
101
+            $YourPlanet = true;
102
+          }
117 103
         }
118
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
119
-          $target_mission = MT_RECYCLE;
120
-          $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
121
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
122
-          if ($YourPlanet) {
123
-            $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
124
-            $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
104
+
105
+        if (!$UsedPlanet) {
106
+          if ($fleetarray[SHIP_COLONIZER]) {
107
+            $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
108
+            $target_mission = MT_COLONIZE;
109
+            $planet_type = PT_PLANET;
125 110
           } else {
126
-            // Not Your Planet
127
-            if ($fleetarray[SHIP_SPY]) {
128
-              // Only spy missions if any spy
129
-              $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
111
+            message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
112
+          }
113
+        } else {
114
+          $recyclers = 0;
115
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
116
+            $recyclers += $fleetarray[$recycler_id];
117
+          }
118
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
119
+            $target_mission = MT_RECYCLE;
120
+            $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
121
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
122
+            if ($YourPlanet) {
123
+              $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
124
+              $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
130 125
             } else {
131
-              // If no spies...
132
-              if ($fleet_group_mr) {
133
-                $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
126
+              // Not Your Planet
127
+              if ($fleetarray[SHIP_SPY]) {
128
+                // Only spy missions if any spy
129
+                $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
134 130
               } else {
135
-                $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
136
-                $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
137
-
138
-                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
139
-
140
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141
-                  $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
131
+                // If no spies...
132
+                if ($fleet_group_mr) {
133
+                  $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
134
+                } else {
135
+                  $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
136
+                  $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
137
+
138
+                  $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
139
+
140
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141
+                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
142
+                  }
142 143
                 }
143 144
               }
144 145
             }
145 146
           }
146 147
         }
147 148
       }
148
-    }
149
-
150
-    if (!$target_mission && is_array($missiontype)) {
151
-      $target_mission = MT_ATTACK;
152
-    }
153
-
154
-//    $sn_group_missions = sn_get_groups('missions');
155
-//    foreach($sn_group_missions as $mission_id => $cork) {
156
-//      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
157
-//    }
158
-//
159
-//
160
-    ksort($missiontype);
161
-
162
-    $speed_percent = sys_get_param_int('speed', 10);
163
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
164
-
165
-//    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
166
-    $fleet_speed   = $travel_data['fleet_speed'];
167
-    $distance      = $travel_data['distance'];
168
-    $duration      = $travel_data['duration'];
169
-    $consumption   = $travel_data['consumption'];
170
-  // No Break
171
-
172
-  case 1:
173
-    if ($galaxy && $system && $planet) {
174
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
175
-
176
-      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
177
-    }
178
-
179
-  case 0:
180
-    $template_result += array(
181
-      'thisgalaxy'      => $planetrow['galaxy'],
182
-      'thissystem'      => $planetrow['system'],
183
-      'thisplanet'      => $planetrow['planet'],
184
-      'thisplanet_type' => $planetrow['planet_type'],
185
-    );
186
-  // no break
149
+
150
+      if (!$target_mission && is_array($missiontype)) {
151
+        $target_mission = MT_ATTACK;
152
+      }
153
+
154
+  //    $sn_group_missions = sn_get_groups('missions');
155
+  //    foreach($sn_group_missions as $mission_id => $cork) {
156
+  //      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
157
+  //    }
158
+  //
159
+  //
160
+      ksort($missiontype);
161
+
162
+      $speed_percent = sys_get_param_int('speed', 10);
163
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
164
+
165
+  //    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
166
+      $fleet_speed   = $travel_data['fleet_speed'];
167
+      $distance      = $travel_data['distance'];
168
+      $duration      = $travel_data['duration'];
169
+      $consumption   = $travel_data['consumption'];
170
+    // No Break
171
+
172
+    case 1:
173
+      if ($galaxy && $system && $planet) {
174
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
175
+
176
+        $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
177
+      }
178
+
179
+    case 0:
180
+      $template_result += array(
181
+        'thisgalaxy'      => $planetrow['galaxy'],
182
+        'thissystem'      => $planetrow['system'],
183
+        'thisplanet'      => $planetrow['planet'],
184
+        'thisplanet_type' => $planetrow['planet_type'],
185
+      );
186
+    // no break
187 187
 
188 188
 }
189 189
 
@@ -205,31 +205,31 @@  discard block
 block discarded – undo
205 205
 }
206 206
 
207 207
 switch($fleet_page) {
208
-  case 1:
209
-    require('includes/includes/flt_page1.inc');
210
-  break;
208
+    case 1:
209
+      require('includes/includes/flt_page1.inc');
210
+    break;
211 211
 
212
-  case 2:
213
-    require_once('includes/includes/flt_page2.inc');
214
-    sn_fleet_page2();
215
-  break;
212
+    case 2:
213
+      require_once('includes/includes/flt_page2.inc');
214
+      sn_fleet_page2();
215
+    break;
216 216
 
217
-  case 3:
218
-    require_once('includes/includes/flt_page3.inc');
219
-    sn_fleet_page3($duration);
220
-  break;
217
+    case 3:
218
+      require_once('includes/includes/flt_page3.inc');
219
+      sn_fleet_page3($duration);
220
+    break;
221 221
 
222
-  case 4:
223
-    require('includes/includes/flt_page4.inc');
224
-  break;
222
+    case 4:
223
+      require('includes/includes/flt_page4.inc');
224
+    break;
225 225
 
226
-  case 5:
227
-    require('includes/includes/flt_page5.inc');
228
-  break;
226
+    case 5:
227
+      require('includes/includes/flt_page5.inc');
228
+    break;
229 229
 
230
-  default:
231
-    define('SN_RENDER_NAVBAR_PLANET', true);
230
+    default:
231
+      define('SN_RENDER_NAVBAR_PLANET', true);
232 232
 
233
-    require('includes/includes/flt_page0.inc');
234
-  break;
233
+      require('includes/includes/flt_page0.inc');
234
+    break;
235 235
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 $planet = sys_get_param_int('planet', $planetrow['planet']);
40 40
 
41 41
 $target_mission = sys_get_param_int('target_mission');
42
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
42
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
43 43
   $planet_type = PT_PLANET;
44
-} elseif($target_mission == MT_RECYCLE) {
44
+} elseif ($target_mission == MT_RECYCLE) {
45 45
   $planet_type = PT_DEBRIS;
46
-} elseif($target_mission == MT_DESTROY) {
46
+} elseif ($target_mission == MT_DESTROY) {
47 47
   $planet_type = PT_MOON;
48 48
 } else {
49 49
   $planet_type = sys_get_param_int('planet_type');
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 
58 58
 $MaxFleets = GetMaxFleets($user);
59 59
 $FlyingFleets = FleetList::fleet_count_flying($user['id']);
60
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
60
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
61 61
   message($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
62 62
 }
63 63
 
64 64
 $MaxExpeditions = get_player_max_expeditons($user);
65
-if($MaxExpeditions) {
66
-  $FlyingExpeditions  = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
65
+if ($MaxExpeditions) {
66
+  $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
67 67
 } else {
68 68
   $FlyingExpeditions = 0;
69 69
 }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77 77
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
78 78
 
79
-    foreach($fleetarray as $ship_id => &$ship_amount) {
80
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
79
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
80
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81 81
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82 82
         die();
83 83
       }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
           $target_mission = MT_COLONIZE;
109 109
           $planet_type = PT_PLANET;
110 110
         } else {
111
-          message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
111
+          message("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
112 112
         }
113 113
       } else {
114 114
         $recyclers = 0;
115
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
115
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
116 116
           $recyclers += $fleetarray[$recycler_id];
117 117
         }
118 118
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
139 139
 
140
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
140
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141 141
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
142 142
                 }
143 143
               }
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 );
198 198
 
199 199
 $is_transport_missions = false;
200
-if($missiontype) {
200
+if ($missiontype) {
201 201
   $sn_group_missions = sn_get_groups('missions');
202
-  foreach($missiontype as $mission_data_id => $mission_data) {
202
+  foreach ($missiontype as $mission_data_id => $mission_data) {
203 203
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
204 204
   }
205 205
 }
206 206
 
207
-switch($fleet_page) {
207
+switch ($fleet_page) {
208 208
   case 1:
209 209
     require('includes/includes/flt_page1.inc');
210 210
   break;
Please login to merge, or discard this patch.
banned.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
 $query = db_banned_list_select();
22 22
 $i = 0;
23
-while($ban_row = db_fetch($query)) {
23
+while ($ban_row = db_fetch($query)) {
24 24
   $template->assign_block_vars('banlist', array(
25 25
     'USER_NAME'   => $ban_row['ban_user_name'],
26 26
     'REASON'      => $ban_row['ban_reason'],
Please login to merge, or discard this patch.
messages.php 2 patches
Switch Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -48,106 +48,106 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 switch($mode) {
51
-  case 'write':
52
-    $error_list = array();
53
-    $template = gettemplate('msg_message_compose', true);
51
+    case 'write':
52
+      $error_list = array();
53
+      $template = gettemplate('msg_message_compose', true);
54 54
 
55
-    $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
-    if($recipient_name) {
57
-      $recipient_row = db_user_by_username($recipient_name);
58
-    }
55
+      $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
+      if($recipient_name) {
57
+        $recipient_row = db_user_by_username($recipient_name);
58
+      }
59 59
 
60
-    if(!$recipient_row) {
61
-      $recipient_id = sys_get_param_id('id');
62
-      $recipient_row = db_user_by_id($recipient_id);
63 60
       if(!$recipient_row) {
64
-        $recipient_id = 0;
61
+        $recipient_id = sys_get_param_id('id');
62
+        $recipient_row = db_user_by_id($recipient_id);
63
+        if(!$recipient_row) {
64
+          $recipient_id = 0;
65
+        }
65 66
       }
66
-    }
67
-
68
-    if($recipient_row) {
69
-      $recipient_id = $recipient_row['id'];
70
-      $recipient_name = $recipient_row['username'];
71
-    }
72
-
73
-    if($recipient_id == $user['id']) {
74
-      $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
75
-    }
76
-
77
-    $re = 0;
78
-    $subject = sys_get_param_str('subject');
79
-    while(strpos($subject, $lang['msg_answer_prefix']) !== false) {
80
-      $subject = substr($subject, strlen($lang['msg_answer_prefix']));
81
-      $re++;
82
-    }
83
-    $re ? $subject = $lang['msg_answer_prefix'] . $subject : false;
84 67
 
85
-    if(sys_get_param_str('msg_send')) {
86
-      $subject = $subject ? $subject : $lang['msg_subject_default'];
68
+      if($recipient_row) {
69
+        $recipient_id = $recipient_row['id'];
70
+        $recipient_name = $recipient_row['username'];
71
+      }
87 72
 
88
-      if(!$recipient_id) {
89
-        $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
73
+      if($recipient_id == $user['id']) {
74
+        $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
90 75
       }
91 76
 
92
-      $text = sys_get_param_str('text');
93
-      if(!$text) {
94
-        $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
77
+      $re = 0;
78
+      $subject = sys_get_param_str('subject');
79
+      while(strpos($subject, $lang['msg_answer_prefix']) !== false) {
80
+        $subject = substr($subject, strlen($lang['msg_answer_prefix']));
81
+        $re++;
95 82
       }
83
+      $re ? $subject = $lang['msg_answer_prefix'] . $subject : false;
96 84
 
97
-      if(empty($error_list)) {
98
-        $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
85
+      if(sys_get_param_str('msg_send')) {
86
+        $subject = $subject ? $subject : $lang['msg_subject_default'];
99 87
 
100
-        $user_safe_name = db_escape($user['username']);
101
-        $recipient_name = db_escape($recipient_name);
102
-        msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true);
88
+        if(!$recipient_id) {
89
+          $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
90
+        }
103 91
 
104
-        //$recipient_id = 0;
105
-        //$recipient_name = '';
106
-        //$subject = '';
107
-        $text = '';
92
+        $text = sys_get_param_str('text');
93
+        if(!$text) {
94
+          $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
95
+        }
108 96
 
109
-        $msg_sent = true;
110
-      } else {
111
-        $subject = sys_get_param_str_unsafe('subject');
112
-        $text = sys_get_param_str_unsafe('text');
113
-      }
114
-      $recipient_name = sys_get_param_str_unsafe('recipient_name');
115
-    }
97
+        if(empty($error_list)) {
98
+          $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
116 99
 
117
-    $subject = $subject ? $subject : $lang['msg_subject_default'];
100
+          $user_safe_name = db_escape($user['username']);
101
+          $recipient_name = db_escape($recipient_name);
102
+          msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true);
118 103
 
119
-    $template->assign_vars(array(
120
-      'RECIPIENT_ID'   => $recipient_id,
121
-      'RECIPIENT_NAME' => htmlspecialchars($recipient_name),
122
-      'SUBJECT'        => htmlspecialchars($subject),
123
-      'TEXT'           => htmlspecialchars($text),
124
-    ));
104
+          //$recipient_id = 0;
105
+          //$recipient_name = '';
106
+          //$subject = '';
107
+          $text = '';
125 108
 
126
-    foreach($error_list as $error_message) {
127
-      $template->assign_block_vars('result', $error_message);
128
-    }
109
+          $msg_sent = true;
110
+        } else {
111
+          $subject = sys_get_param_str_unsafe('subject');
112
+          $text = sys_get_param_str_unsafe('text');
113
+        }
114
+        $recipient_name = sys_get_param_str_unsafe('recipient_name');
115
+      }
129 116
 
130
-    $message_query = db_message_list_get_last_20($user, $recipient_id);
131
-    while($message_row = db_fetch($message_query)) {
132
-      $template->assign_block_vars('messages', array(
133
-        'ID'   => $message_row['message_id'],
134
-        'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
135
-        'FROM' => htmlspecialchars($message_row['message_from']),
136
-        'SUBJ' => htmlspecialchars($message_row['message_subject']),
137
-        'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
117
+      $subject = $subject ? $subject : $lang['msg_subject_default'];
138 118
 
139
-        'FROM_ID' => $message_row['message_sender'],
119
+      $template->assign_vars(array(
120
+        'RECIPIENT_ID'   => $recipient_id,
121
+        'RECIPIENT_NAME' => htmlspecialchars($recipient_name),
122
+        'SUBJECT'        => htmlspecialchars($subject),
123
+        'TEXT'           => htmlspecialchars($text),
140 124
       ));
141
-    }
142 125
 
143
-  break;
126
+      foreach($error_list as $error_message) {
127
+        $template->assign_block_vars('result', $error_message);
128
+      }
129
+
130
+      $message_query = db_message_list_get_last_20($user, $recipient_id);
131
+      while($message_row = db_fetch($message_query)) {
132
+        $template->assign_block_vars('messages', array(
133
+          'ID'   => $message_row['message_id'],
134
+          'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
135
+          'FROM' => htmlspecialchars($message_row['message_from']),
136
+          'SUBJ' => htmlspecialchars($message_row['message_subject']),
137
+          'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
138
+
139
+          'FROM_ID' => $message_row['message_sender'],
140
+        ));
141
+      }
144 142
 
145
-  case 'delete':
146
-    $query_add = '';
143
+    break;
147 144
 
148
-    $message_range = sys_get_param_str('message_range');
145
+    case 'delete':
146
+      $query_add = '';
149 147
 
150
-    switch($message_range) {
148
+      $message_range = sys_get_param_str('message_range');
149
+
150
+      switch($message_range) {
151 151
       case 'unchecked':
152 152
       case 'checked':
153 153
         $marked_message_list = sys_get_param('mark', array());
@@ -171,65 +171,65 @@  discard block
 block discarded – undo
171 171
       case 'all':
172 172
         $query_add = $query_add ? $query_add : true;
173 173
       break;
174
-    }
174
+      }
175 175
 
176 176
     if($query_add) {
177 177
       $query_add = $query_add === true ? '' : $query_add;
178 178
       db_message_list_delete($user, $query_add);
179 179
     }
180 180
 
181
-  case 'show':
182
-    if($current_class == MSG_TYPE_OUTBOX) {
183
-      $message_query = db_message_list_outbox_by_user_id($user['id']);
184
-    } else {
185
-      if($current_class == MSG_TYPE_NEW) {
186
-        $SubUpdateQry = array();
187
-        foreach($sn_message_class_list as $message_class_id => $message_class) {
188
-          if($message_class_id != MSG_TYPE_OUTBOX) {
189
-            $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190
-            $user[$message_class['name']] = 0;
181
+    case 'show':
182
+      if($current_class == MSG_TYPE_OUTBOX) {
183
+        $message_query = db_message_list_outbox_by_user_id($user['id']);
184
+      } else {
185
+        if($current_class == MSG_TYPE_NEW) {
186
+          $SubUpdateQry = array();
187
+          foreach($sn_message_class_list as $message_class_id => $message_class) {
188
+            if($message_class_id != MSG_TYPE_OUTBOX) {
189
+              $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190
+              $user[$message_class['name']] = 0;
191
+            }
191 192
           }
193
+          $SubUpdateQry = implode(',', $SubUpdateQry);
194
+        } else {
195
+          $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'";
196
+          $SubSelectQry = "AND `message_type` = '{$current_class}'";
197
+
198
+          $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']];
199
+          $user[$sn_message_class_list[$current_class]['name']] = 0;
192 200
         }
193
-        $SubUpdateQry = implode(',', $SubUpdateQry);
194
-      } else {
195
-        $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'";
196
-        $SubSelectQry = "AND `message_type` = '{$current_class}'";
197 201
 
198
-        $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']];
199
-        $user[$sn_message_class_list[$current_class]['name']] = 0;
202
+        db_user_set_by_id($user['id'], $SubUpdateQry);
203
+        $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
200 204
       }
201 205
 
202
-      db_user_set_by_id($user['id'], $SubUpdateQry);
203
-      $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
204
-    }
205
-
206
-    if(sys_get_param_int('return')) {
207
-      header('Location: messages.php');
208
-      die();
209
-    }
206
+      if(sys_get_param_int('return')) {
207
+        header('Location: messages.php');
208
+        die();
209
+      }
210 210
 
211
-    $template = gettemplate('msg_message_list', true);
212
-    while($message_row = db_fetch($message_query)) {
213
-      $template->assign_block_vars('messages', array(
214
-        'ID'   => $message_row['message_id'],
215
-        'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
216
-        'FROM' => htmlspecialchars($message_row['message_from']),
217
-        'SUBJ' => htmlspecialchars($message_row['message_subject']),
218
-        'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
219
-
220
-        'FROM_ID'        => $message_row['message_sender'],
221
-        'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']),
222
-        'STYLE'          => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'],
223
-      ));
224
-    }
211
+      $template = gettemplate('msg_message_list', true);
212
+      while($message_row = db_fetch($message_query)) {
213
+        $template->assign_block_vars('messages', array(
214
+          'ID'   => $message_row['message_id'],
215
+          'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
216
+          'FROM' => htmlspecialchars($message_row['message_from']),
217
+          'SUBJ' => htmlspecialchars($message_row['message_subject']),
218
+          'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
219
+
220
+          'FROM_ID'        => $message_row['message_sender'],
221
+          'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']),
222
+          'STYLE'          => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'],
223
+        ));
224
+      }
225 225
 
226
-    $current_class_text = $lang['msg_class'][$current_class];
226
+      $current_class_text = $lang['msg_class'][$current_class];
227 227
 
228
-    $template->assign_vars(array(
229
-      "MESSAGE_CLASS"      => $current_class,
230
-      "MESSAGE_CLASS_TEXT" => $current_class_text,
231
-    ));
232
-  break;
228
+      $template->assign_vars(array(
229
+        "MESSAGE_CLASS"      => $current_class,
230
+        "MESSAGE_CLASS_TEXT" => $current_class_text,
231
+      ));
232
+    break;
233 233
 }
234 234
 
235 235
 if(!$template) {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -42,59 +42,59 @@  discard block
 block discarded – undo
42 42
 
43 43
 $mode = sys_get_param_str('msg_delete') ? 'delete' : sys_get_param_str('mode');
44 44
 $current_class = sys_get_param_int('message_class');
45
-if(!isset($sn_message_class_list[$current_class])) {
45
+if (!isset($sn_message_class_list[$current_class])) {
46 46
   $current_class = 0;
47 47
   $mode = '';
48 48
 }
49 49
 
50
-switch($mode) {
50
+switch ($mode) {
51 51
   case 'write':
52 52
     $error_list = array();
53 53
     $template = gettemplate('msg_message_compose', true);
54 54
 
55 55
     $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
-    if($recipient_name) {
56
+    if ($recipient_name) {
57 57
       $recipient_row = db_user_by_username($recipient_name);
58 58
     }
59 59
 
60
-    if(!$recipient_row) {
60
+    if (!$recipient_row) {
61 61
       $recipient_id = sys_get_param_id('id');
62 62
       $recipient_row = db_user_by_id($recipient_id);
63
-      if(!$recipient_row) {
63
+      if (!$recipient_row) {
64 64
         $recipient_id = 0;
65 65
       }
66 66
     }
67 67
 
68
-    if($recipient_row) {
68
+    if ($recipient_row) {
69 69
       $recipient_id = $recipient_row['id'];
70 70
       $recipient_name = $recipient_row['username'];
71 71
     }
72 72
 
73
-    if($recipient_id == $user['id']) {
73
+    if ($recipient_id == $user['id']) {
74 74
       $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
75 75
     }
76 76
 
77 77
     $re = 0;
78 78
     $subject = sys_get_param_str('subject');
79
-    while(strpos($subject, $lang['msg_answer_prefix']) !== false) {
79
+    while (strpos($subject, $lang['msg_answer_prefix']) !== false) {
80 80
       $subject = substr($subject, strlen($lang['msg_answer_prefix']));
81 81
       $re++;
82 82
     }
83 83
     $re ? $subject = $lang['msg_answer_prefix'] . $subject : false;
84 84
 
85
-    if(sys_get_param_str('msg_send')) {
85
+    if (sys_get_param_str('msg_send')) {
86 86
       $subject = $subject ? $subject : $lang['msg_subject_default'];
87 87
 
88
-      if(!$recipient_id) {
88
+      if (!$recipient_id) {
89 89
         $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
90 90
       }
91 91
 
92 92
       $text = sys_get_param_str('text');
93
-      if(!$text) {
93
+      if (!$text) {
94 94
         $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
95 95
       }
96 96
 
97
-      if(empty($error_list)) {
97
+      if (empty($error_list)) {
98 98
         $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
99 99
 
100 100
         $user_safe_name = db_escape($user['username']);
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
       'TEXT'           => htmlspecialchars($text),
124 124
     ));
125 125
 
126
-    foreach($error_list as $error_message) {
126
+    foreach ($error_list as $error_message) {
127 127
       $template->assign_block_vars('result', $error_message);
128 128
     }
129 129
 
130 130
     $message_query = db_message_list_get_last_20($user, $recipient_id);
131
-    while($message_row = db_fetch($message_query)) {
131
+    while ($message_row = db_fetch($message_query)) {
132 132
       $template->assign_block_vars('messages', array(
133 133
         'ID'   => $message_row['message_id'],
134 134
         'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
@@ -147,25 +147,25 @@  discard block
 block discarded – undo
147 147
 
148 148
     $message_range = sys_get_param_str('message_range');
149 149
 
150
-    switch($message_range) {
150
+    switch ($message_range) {
151 151
       case 'unchecked':
152 152
       case 'checked':
153 153
         $marked_message_list = sys_get_param('mark', array());
154
-        if($message_range == 'checked' && empty($marked_message_list)) {
154
+        if ($message_range == 'checked' && empty($marked_message_list)) {
155 155
           break;
156 156
         }
157 157
 
158 158
         $query_add = implode(',', $marked_message_list);
159
-        if($query_add) {
159
+        if ($query_add) {
160 160
           $query_add = "IN ({$query_add})";
161
-          if($message_range == 'unchecked') {
161
+          if ($message_range == 'unchecked') {
162 162
             $query_add = "NOT {$query_add}";
163 163
           }
164 164
           $query_add = " AND `message_id` {$query_add}";
165 165
         }
166 166
 
167 167
       case 'class':
168
-        if($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
168
+        if ($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
169 169
           $query_add .= " AND `message_type` = {$current_class}";
170 170
         }
171 171
       case 'all':
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
       break;
174 174
     }
175 175
 
176
-    if($query_add) {
176
+    if ($query_add) {
177 177
       $query_add = $query_add === true ? '' : $query_add;
178 178
       db_message_list_delete($user, $query_add);
179 179
     }
180 180
 
181 181
   case 'show':
182
-    if($current_class == MSG_TYPE_OUTBOX) {
182
+    if ($current_class == MSG_TYPE_OUTBOX) {
183 183
       $message_query = db_message_list_outbox_by_user_id($user['id']);
184 184
     } else {
185
-      if($current_class == MSG_TYPE_NEW) {
185
+      if ($current_class == MSG_TYPE_NEW) {
186 186
         $SubUpdateQry = array();
187
-        foreach($sn_message_class_list as $message_class_id => $message_class) {
188
-          if($message_class_id != MSG_TYPE_OUTBOX) {
187
+        foreach ($sn_message_class_list as $message_class_id => $message_class) {
188
+          if ($message_class_id != MSG_TYPE_OUTBOX) {
189 189
             $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190 190
             $user[$message_class['name']] = 0;
191 191
           }
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
       $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
204 204
     }
205 205
 
206
-    if(sys_get_param_int('return')) {
206
+    if (sys_get_param_int('return')) {
207 207
       header('Location: messages.php');
208 208
       die();
209 209
     }
210 210
 
211 211
     $template = gettemplate('msg_message_list', true);
212
-    while($message_row = db_fetch($message_query)) {
212
+    while ($message_row = db_fetch($message_query)) {
213 213
       $template->assign_block_vars('messages', array(
214 214
         'ID'   => $message_row['message_id'],
215 215
         'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
   break;
233 233
 }
234 234
 
235
-if(!$template) {
235
+if (!$template) {
236 236
   $template = gettemplate('msg_message_class', true);
237 237
 
238 238
   $query = db_message_count_by_owner_and_type($user);
239
-  while($message_row = db_fetch($query)) {
239
+  while ($message_row = db_fetch($query)) {
240 240
     $messages_total[$message_row['message_type']] = $message_row['message_count'];
241 241
     $messages_total[MSG_TYPE_NEW] += $message_row['message_count'];
242 242
   }
243 243
 
244 244
   $messages_total[MSG_TYPE_OUTBOX] = db_message_count_outbox($user);
245 245
 
246
-  foreach($sn_message_class_list as $message_class_id => $message_class) {
246
+  foreach ($sn_message_class_list as $message_class_id => $message_class) {
247 247
     $template->assign_block_vars('message_class', array(
248 248
       'ID'     => $message_class_id,
249 249
       'STYLE'  => $message_class['name'],
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $uni_system = sys_get_param_int('system', $planetrow['system']);
19 19
 $planet = sys_get_param_int('planet', $planetrow['planet']);
20 20
 
21
-if($mode == 'name') {
21
+if ($mode == 'name') {
22 22
   require_once('includes/includes/uni_rename.php');
23 23
 }
24 24
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
41 41
 
42
-if($mode == 1) {
43
-} elseif($mode == 2 || $mode == 3) {
42
+if ($mode == 1) {
43
+} elseif ($mode == 2 || $mode == 3) {
44 44
   $planet = $planetrow['planet'];
45 45
 } else {
46 46
   $uni_galaxy = $planetrow['galaxy'];
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
67 67
 
68 68
 $planet_precache_query = db_planet_list_in_system($uni_galaxy, $uni_system);
69
-if(!empty($planet_precache_query)) {
70
-  foreach($planet_precache_query as $planet_row) {
69
+if (!empty($planet_precache_query)) {
70
+  foreach ($planet_precache_query as $planet_row) {
71 71
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
72 72
   }
73 73
 }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
  * @var Fleet[][][] $fleet_list
86 86
  */
87 87
 $fleet_list = array();
88
-foreach($system_fleet_list->_container as $objFleetSystem) {
89
-  if($objFleetSystem->is_returning == 0) {
88
+foreach ($system_fleet_list->_container as $objFleetSystem) {
89
+  if ($objFleetSystem->is_returning == 0) {
90 90
     $fleet_planet = $objFleetSystem->fleet_end_planet;
91 91
     $fleet_type = $objFleetSystem->fleet_end_type;
92 92
   } else {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 $recycler_info = array();
102 102
 $planet_recyclers_orbiting = 0;
103 103
 $recyclers_fleet = array();
104
-foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
104
+foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
105 105
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
106 106
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
107 107
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 $fleet_id = 1;
112 112
 $fleets = array();
113 113
 $config_game_max_planet = $config->game_maxPlanet + 1;
114
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
114
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
115 115
   unset($uni_galaxyRowPlanet);
116 116
   unset($uni_galaxyRowMoon);
117 117
   unset($uni_galaxyRowUser);
@@ -121,27 +121,27 @@  discard block
 block discarded – undo
121 121
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
122 122
 
123 123
   $planet_fleet_id = 0;
124
-  if($uni_galaxyRowPlanet['destruyed']) {
124
+  if ($uni_galaxyRowPlanet['destruyed']) {
125 125
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
126
-  } elseif($uni_galaxyRowPlanet['id']) {
127
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
126
+  } elseif ($uni_galaxyRowPlanet['id']) {
127
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
128 128
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
129 129
     } else {
130 130
       $uni_galaxyRowUser = db_user_by_id($uni_galaxyRowPlanet['id_owner']);
131 131
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
132 132
     }
133 133
 
134
-    if(!$uni_galaxyRowUser['id']) {
134
+    if (!$uni_galaxyRowUser['id']) {
135 135
       $debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
136 136
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
137 137
       $uni_galaxyRowPlanet['id_owner'] = 0;
138 138
       db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}");
139 139
     }
140 140
 
141
-    if($uni_galaxyRowUser['id']) {
141
+    if ($uni_galaxyRowUser['id']) {
142 142
       $planetcount++;
143
-      if($uni_galaxyRowUser['ally_id']) {
144
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
143
+      if ($uni_galaxyRowUser['ally_id']) {
144
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
145 145
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
146 146
         } else {
147 147
           $allyquery = db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
       }
151 151
 
152 152
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
153
-      if(!empty($fleets_to_planet['own']['count'])) {
153
+      if (!empty($fleets_to_planet['own']['count'])) {
154 154
         $planet_fleet_id = $fleet_id;
155 155
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
156 156
         $fleet_id++;
157 157
       }
158 158
 
159 159
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
160
-      if($uni_galaxyRowMoon['destruyed']) {
160
+      if ($uni_galaxyRowMoon['destruyed']) {
161 161
         CheckAbandonPlanetState($uni_galaxyRowMoon);
162 162
       } else {
163 163
         $moon_fleet_id = 0;
164 164
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
165
-        if(!empty($fleets_to_planet['own']['count'])) {
165
+        if (!empty($fleets_to_planet['own']['count'])) {
166 166
           $moon_fleet_id = $fleet_id;
167 167
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
168 168
           $fleet_id++;
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
   $recyclers_incoming_capacity = 0;
175 175
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
176
-  if($uni_galaxyRowPlanet['debris']) {
177
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
178
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
179
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
176
+  if ($uni_galaxyRowPlanet['debris']) {
177
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
178
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
179
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
180 180
           $recyclers_incoming_capacity += $objFleetToDebris->fleet_recyclers_capacity($recycler_info);
181 181
         }
182 182
       }
@@ -253,21 +253,21 @@  discard block
 block discarded – undo
253 253
 
254 254
 tpl_assign_fleet($template, $fleets);
255 255
 
256
-foreach(sn_get_groups('defense_active') as $unit_id) {
256
+foreach (sn_get_groups('defense_active') as $unit_id) {
257 257
   $template->assign_block_vars('defense_active', array(
258 258
     'ID'   => $unit_id,
259 259
     'NAME' => $lang['tech'][$unit_id],
260 260
   ));
261 261
 }
262 262
 
263
-foreach($cached['users'] as $PlanetUser) {
264
-  if(!$PlanetUser) {
263
+foreach ($cached['users'] as $PlanetUser) {
264
+  if (!$PlanetUser) {
265 265
     continue;
266 266
   }
267 267
 
268 268
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
269
-  if(isset($user_ally)) {
270
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
269
+  if (isset($user_ally)) {
270
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
271 271
       $user_rank_title = $user_ally['ally_owner_range'];
272 272
     } else {
273 273
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
   ));
291 291
 }
292 292
 
293
-foreach($cached['allies'] as $PlanetAlly) {
294
-  if($PlanetAlly) {
293
+foreach ($cached['allies'] as $PlanetAlly) {
294
+  if ($PlanetAlly) {
295 295
     $template->assign_block_vars('alliances', array(
296 296
       'ID'      => $PlanetAlly['id'],
297 297
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.