Completed
Push — work-fleets ( abbbcf...8b8b7f )
by SuperNova.WS
05:13
created
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->isReturning()) {
88
+foreach ($system_fleet_list->_container as $objFleetSystem) {
89
+  if (!$objFleetSystem->isReturning()) {
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->shipsGetCapacityRecyclers($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.