Passed
Push — trunk ( 338765...433e05 )
by SuperNova.WS
04:23
created
fleet.php 2 patches
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');
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true);
60 60
 //$FlyingFleets = $FlyingFleets['Number'];
61 61
 $FlyingFleets = fleet_count_flying($user['id']);
62
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
62
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
63 63
   messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
64 64
 }
65 65
 
66 66
 $MaxExpeditions = get_player_max_expeditons($user);
67
-if($MaxExpeditions) {
67
+if ($MaxExpeditions) {
68 68
 //  $FlyingExpeditions  = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
69 69
 //  $FlyingExpeditions  = $FlyingExpeditions['expedi'];
70
-  $FlyingExpeditions  = fleet_count_flying($user['id'], MT_EXPLORE);
70
+  $FlyingExpeditions = fleet_count_flying($user['id'], MT_EXPLORE);
71 71
 } else {
72 72
   $FlyingExpeditions = 0;
73 73
 }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
     $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
81 81
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
82 82
 
83
-    foreach($fleetarray as $ship_id => &$ship_amount) {
84
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
83
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
84
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
85 85
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
86 86
         die();
87 87
       }
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
           $target_mission = MT_COLONIZE;
113 113
           $planet_type = PT_PLANET;
114 114
         } else {
115
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
115
+          messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
116 116
         }
117 117
       } else {
118 118
         $recyclers = 0;
119
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
119
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
120 120
           $recyclers += $fleetarray[$recycler_id];
121 121
         }
122 122
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
143 143
 
144
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
144
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
145 145
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
146 146
                 }
147 147
               }
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 );
202 202
 
203 203
 $is_transport_missions = false;
204
-if($missiontype) {
204
+if ($missiontype) {
205 205
   $sn_group_missions = sn_get_groups('missions');
206
-  foreach($missiontype as $mission_data_id => $mission_data) {
206
+  foreach ($missiontype as $mission_data_id => $mission_data) {
207 207
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
208 208
   }
209 209
 }
210 210
 
211
-switch($fleet_page) {
211
+switch ($fleet_page) {
212 212
   case 1:
213 213
     require('includes/includes/flt_page1.inc');
214 214
   break;
Please login to merge, or discard this patch.
Switch Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -77,121 +77,121 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 switch ($fleet_page) {
80
-  case 3:
80
+    case 3:
81 81
 
82
-  case 2:
83
-    $fleet_group_mr = sys_get_param_id('fleet_group');
84
-    $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
85
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
82
+    case 2:
83
+      $fleet_group_mr = sys_get_param_id('fleet_group');
84
+      $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
85
+      $fleetarray = is_array($fleetarray) ? $fleetarray : array();
86 86
 
87
-    foreach($fleetarray as $ship_id => &$ship_amount) {
88
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
89
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
90
-        die();
91
-      }
92
-      $ship_amount = floatval($ship_amount);
93
-    }
94
-
95
-    $UsedPlanet = false;
96
-    $YourPlanet = false;
97
-    $missiontype = array();
98
-    if ($planet > SN::$config->game_maxPlanet) {
99
-      $target_mission = MT_EXPLORE;
100
-      $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
101
-    } elseif ($galaxy && $system && $planet) {
102
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
103
-
104
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
105
-
106
-      if ($TargetPlanet['id_owner']) {
107
-        $UsedPlanet = true;
108
-        if ($TargetPlanet['id_owner'] == $user['id']) {
109
-          $YourPlanet = true;
87
+      foreach($fleetarray as $ship_id => &$ship_amount) {
88
+        if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
89
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
90
+          die();
110 91
         }
92
+        $ship_amount = floatval($ship_amount);
111 93
       }
112 94
 
113
-      if (!$UsedPlanet) {
114
-        if ($fleetarray[SHIP_COLONIZER]) {
115
-          $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
116
-          $target_mission = MT_COLONIZE;
117
-          $planet_type = PT_PLANET;
118
-        } else {
119
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
120
-        }
121
-      } else {
122
-        $recyclers = 0;
123
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
124
-          $recyclers += $fleetarray[$recycler_id];
95
+      $UsedPlanet = false;
96
+      $YourPlanet = false;
97
+      $missiontype = array();
98
+      if ($planet > SN::$config->game_maxPlanet) {
99
+        $target_mission = MT_EXPLORE;
100
+        $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
101
+      } elseif ($galaxy && $system && $planet) {
102
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
103
+
104
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
105
+
106
+        if ($TargetPlanet['id_owner']) {
107
+          $UsedPlanet = true;
108
+          if ($TargetPlanet['id_owner'] == $user['id']) {
109
+            $YourPlanet = true;
110
+          }
125 111
         }
126
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
127
-          $target_mission = MT_RECYCLE;
128
-          $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
129
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
130
-          if ($YourPlanet) {
131
-            $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
132
-            $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
112
+
113
+        if (!$UsedPlanet) {
114
+          if ($fleetarray[SHIP_COLONIZER]) {
115
+            $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
116
+            $target_mission = MT_COLONIZE;
117
+            $planet_type = PT_PLANET;
133 118
           } else {
134
-            // Not Your Planet
135
-            if ($fleetarray[SHIP_SPY]) {
136
-              // Only spy missions if any spy
137
-              $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
119
+            messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
120
+          }
121
+        } else {
122
+          $recyclers = 0;
123
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
124
+            $recyclers += $fleetarray[$recycler_id];
125
+          }
126
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
127
+            $target_mission = MT_RECYCLE;
128
+            $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
129
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
130
+            if ($YourPlanet) {
131
+              $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
132
+              $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
138 133
             } else {
139
-              // If no spies...
140
-              if ($fleet_group_mr) {
141
-                $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
134
+              // Not Your Planet
135
+              if ($fleetarray[SHIP_SPY]) {
136
+                // Only spy missions if any spy
137
+                $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
142 138
               } else {
143
-                $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
144
-                $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
145
-
146
-                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
147
-
148
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
149
-                  $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
139
+                // If no spies...
140
+                if ($fleet_group_mr) {
141
+                  $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
142
+                } else {
143
+                  $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
144
+                  $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
145
+
146
+                  $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
147
+
148
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
149
+                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
150
+                  }
150 151
                 }
151 152
               }
152 153
             }
153 154
           }
154 155
         }
155 156
       }
156
-    }
157
-
158
-    if (!$target_mission && is_array($missiontype)) {
159
-      $target_mission = MT_ATTACK;
160
-    }
161
-
162
-//    $sn_group_missions = sn_get_groups('missions');
163
-//    foreach($sn_group_missions as $mission_id => $cork) {
164
-//      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
165
-//    }
166
-//
167
-//
168
-    ksort($missiontype);
169
-
170
-    $speed_percent = sys_get_param_int('speed', 10);
171
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
172
-
173
-//    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
174
-    $fleet_speed   = $travel_data['fleet_speed'];
175
-    $distance      = $travel_data['distance'];
176
-    $duration      = $travel_data['duration'];
177
-    $consumption   = $travel_data['consumption'];
178
-  // No Break
179
-
180
-  case 1:
181
-    if ($galaxy && $system && $planet) {
182
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
183
-
184
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
185
-    }
186
-
187
-  case 0:
188
-    $template_result += array(
189
-      'thisgalaxy'      => $planetrow['galaxy'],
190
-      'thissystem'      => $planetrow['system'],
191
-      'thisplanet'      => $planetrow['planet'],
192
-      'thisplanet_type' => $planetrow['planet_type'],
193
-    );
194
-  // no break
157
+
158
+      if (!$target_mission && is_array($missiontype)) {
159
+        $target_mission = MT_ATTACK;
160
+      }
161
+
162
+  //    $sn_group_missions = sn_get_groups('missions');
163
+  //    foreach($sn_group_missions as $mission_id => $cork) {
164
+  //      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
165
+  //    }
166
+  //
167
+  //
168
+      ksort($missiontype);
169
+
170
+      $speed_percent = sys_get_param_int('speed', 10);
171
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
172
+
173
+  //    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
174
+      $fleet_speed   = $travel_data['fleet_speed'];
175
+      $distance      = $travel_data['distance'];
176
+      $duration      = $travel_data['duration'];
177
+      $consumption   = $travel_data['consumption'];
178
+    // No Break
179
+
180
+    case 1:
181
+      if ($galaxy && $system && $planet) {
182
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
183
+
184
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
185
+      }
186
+
187
+    case 0:
188
+      $template_result += array(
189
+        'thisgalaxy'      => $planetrow['galaxy'],
190
+        'thissystem'      => $planetrow['system'],
191
+        'thisplanet'      => $planetrow['planet'],
192
+        'thisplanet_type' => $planetrow['planet_type'],
193
+      );
194
+    // no break
195 195
 
196 196
 }
197 197
 
@@ -213,35 +213,35 @@  discard block
 block discarded – undo
213 213
 }
214 214
 
215 215
 switch($fleet_page) {
216
-  case 1:
217
-    require('includes/includes/flt_page1.inc');
218
-  break;
219
-
220
-  case 2:
221
-    require_once('includes/includes/flt_page2.inc');
222
-    sn_fleet_page2();
223
-  break;
224
-
225
-  case 3:
226
-    require_once('includes/includes/flt_page3.inc');
227
-    sn_fleet_page3();
228
-  break;
229
-
230
-  case 4:
231
-    require('includes/includes/flt_page4.inc');
232
-  break;
233
-
234
-  case 5:
235
-    $template = gettemplate('fleet5', true);
236
-    $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering();
237
-    $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
238
-    // Building list of own planets & moons
239
-    $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
240
-  break;
241
-
242
-  default:
243
-    define('SN_RENDER_NAVBAR_PLANET', true);
244
-
245
-    require('includes/includes/flt_page0.inc');
246
-  break;
216
+    case 1:
217
+      require('includes/includes/flt_page1.inc');
218
+    break;
219
+
220
+    case 2:
221
+      require_once('includes/includes/flt_page2.inc');
222
+      sn_fleet_page2();
223
+    break;
224
+
225
+    case 3:
226
+      require_once('includes/includes/flt_page3.inc');
227
+      sn_fleet_page3();
228
+    break;
229
+
230
+    case 4:
231
+      require('includes/includes/flt_page4.inc');
232
+    break;
233
+
234
+    case 5:
235
+      $template = gettemplate('fleet5', true);
236
+      $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering();
237
+      $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
238
+      // Building list of own planets & moons
239
+      $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
240
+    break;
241
+
242
+    default:
243
+      define('SN_RENDER_NAVBAR_PLANET', true);
244
+
245
+      require('includes/includes/flt_page0.inc');
246
+    break;
247 247
 }
Please login to merge, or discard this patch.
classes/Meta/Economic/EconomicHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@
 block discarded – undo
75 75
    * @return float[] - [int resourceId] -> [float ratesNormalizedToResourceCost]
76 76
    */
77 77
   public function getResourceExchangeIn($resourceId) {
78
-    if(empty($this->resourceExchangeRates[$resourceId])) {
78
+    if (empty($this->resourceExchangeRates[$resourceId])) {
79 79
       $defaultRates = $this->getResourcesExchange();
80 80
 
81 81
       $this->resourceExchangeRates[$resourceId] = [];
82
-      foreach($defaultRates as $defaultResourceId => $defaultRate) {
82
+      foreach ($defaultRates as $defaultResourceId => $defaultRate) {
83 83
         $this->resourceExchangeRates[$resourceId][$defaultResourceId] = $defaultRate / $defaultRates[$resourceId];
84 84
       }
85 85
     }
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));}
3
+function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); }
4 4
 function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
5 5
 {
6 6
   global $lang;
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   return $mode;
20 20
 }
21 21
 
22
-function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));}
22
+function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); }
23 23
 /**
24 24
  * @param template $template
25 25
  * @param $edit_planet_row
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
   global $lang;
31 31
 
32 32
   $unit_list = sn_get_groups($mode);
33
-  if(empty($unit_list))
33
+  if (empty($unit_list))
34 34
   {
35 35
     return;
36 36
   }
37 37
   $name_list = $lang['tech'];
38 38
 
39
-  foreach($unit_list as $unit_id)
39
+  foreach ($unit_list as $unit_id)
40 40
   {
41 41
     $template->assign_block_vars('unit', array(
42 42
       'ID'    => $unit_id,
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
   }
48 48
 }
49 49
 
50
-function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));}
50
+function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); }
51 51
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode)
52 52
 {
53
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode)))
53
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode)))
54 54
   {
55 55
     $unit_amount = round($unit_amount);
56 56
     $unit_name = get_unit_param($unit_id, P_NAME);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));}
4
-function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
5
-{
4
+function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {
6 5
   global $lang;
7 6
 
8 7
   $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array(
@@ -25,8 +24,7 @@  discard block
 block discarded – undo
25 24
  * @param $edit_planet_row
26 25
  * @param $mode
27 26
  */
28
-function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode)
29
-{
27
+function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) {
30 28
   global $lang;
31 29
 
32 30
   $unit_list = sn_get_groups($mode);
@@ -48,15 +46,13 @@  discard block
 block discarded – undo
48 46
 }
49 47
 
50 48
 function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));}
51
-function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode)
52
-{
49
+function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {
53 50
   if($unit_amount && in_array($unit_id, sn_get_groups($mode)))
54 51
   {
55 52
     $unit_amount = round($unit_amount);
56 53
     $unit_name = get_unit_param($unit_id, P_NAME);
57 54
     $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))";
58
-  }
59
-  else
55
+  } else
60 56
   {
61 57
     $result = '';
62 58
   }
Please login to merge, or discard this patch.
classes/DBAL/DbFieldDescription.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     $this->Field = isset($mySqlDescription['Field']) ? $mySqlDescription['Field'] : null;
30 30
     $this->Type = isset($mySqlDescription['Type']) ? $mySqlDescription['Type'] : null;
31 31
     $this->Collation = isset($mySqlDescription['Collation']) ? $mySqlDescription['Collation'] : null;
32
-    $this->Null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null;
32
+    $this->null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null;
33 33
     $this->Key = isset($mySqlDescription['Key']) ? $mySqlDescription['Key'] : null;
34 34
     $this->Default = isset($mySqlDescription['Default']) ? $mySqlDescription['Default'] : null;
35 35
     $this->Extra = isset($mySqlDescription['Extra']) ? $mySqlDescription['Extra'] : null;
Please login to merge, or discard this patch.
classes/classCache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
   public function unset_by_prefix($prefix_unset = '') {
152 152
     static $array_clear;
153
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
153
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
154 154
       strpos($k, $p) === 0 ? $v = null : false;
155 155
     } : false;
156 156
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     if ($this->$name[0] === null) {
206 206
       for ($i = count($name) - 1; $i > 0; $i--) {
207 207
         $cName = "{$name[$i]}_COUNT";
208
-        $cName1 = "{$name[$i-1]}_COUNT";
208
+        $cName1 = "{$name[$i - 1]}_COUNT";
209 209
         if ($this->$cName1 == null || $i == 1) {
210 210
           $this->$cName++;
211 211
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     $count = count($name);
252 252
     for ($i = 1; $i < $count; $i++) {
253 253
       $cName = "{$name[$i]}_COUNT";
254
-      $cName1 = "{$name[$i-1]}_COUNT";
254
+      $cName1 = "{$name[$i - 1]}_COUNT";
255 255
 
256 256
       if ($i == 1 || $this->$cName1 === null) {
257 257
         $this->$cName--;
Please login to merge, or discard this patch.
includes/includes/ube_report.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
       `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "',
110 110
       `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]},
111 111
 
112
-      `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
112
+      `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ",
113 113
       `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]},
114 114
 
115 115
       `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]},
116
-      `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] . ",
116
+      `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ",
117 117
 
118
-      `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ",
119
-      `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
118
+      `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ",
119
+      `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ",
120 120
       `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ",
121 121
 
122
-      `ube_report_planet_id`          = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ",
122
+      `ube_report_planet_id`          = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ",
123 123
       `ube_report_planet_name`        = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "',
124
-      `ube_report_planet_size`        = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ",
125
-      `ube_report_planet_galaxy`      = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ",
126
-      `ube_report_planet_system`      = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ",
127
-      `ube_report_planet_planet`      = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ",
128
-      `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ",
124
+      `ube_report_planet_size`        = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ",
125
+      `ube_report_planet_galaxy`      = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ",
126
+      `ube_report_planet_system`      = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ",
127
+      `ube_report_planet_planet`      = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ",
128
+      `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ",
129 129
 
130
-      `ube_report_moon` = " . (int)$outcome[UBE_MOON] . ",
131
-      `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ",
132
-      `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ",
130
+      `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ",
131
+      `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ",
132
+      `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ",
133 133
 
134
-      `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ",
135
-      `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ",
136
-      `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
134
+      `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ",
135
+      `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ",
136
+      `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ",
137 137
 
138
-      `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . "
138
+      `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . "
139 139
   ");
140 140
   $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id();
141 141
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
       $player_id,
147 147
 
148 148
       "'" . db_escape($player_info[UBE_NAME]) . "'",
149
-      (int)$player_info[UBE_ATTACKER],
149
+      (int) $player_info[UBE_ATTACKER],
150 150
 
151
-      (float)$player_info[UBE_BONUSES][UBE_ATTACK],
152
-      (float)$player_info[UBE_BONUSES][UBE_SHIELD],
153
-      (float)$player_info[UBE_BONUSES][UBE_ARMOR],
151
+      (float) $player_info[UBE_BONUSES][UBE_ATTACK],
152
+      (float) $player_info[UBE_BONUSES][UBE_SHIELD],
153
+      (float) $player_info[UBE_BONUSES][UBE_ARMOR],
154 154
     );
155 155
   }
156 156
 
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
       $fleet_info[UBE_OWNER],
164 164
       $fleet_id,
165 165
 
166
-      (float)$fleet_info[UBE_PLANET][PLANET_ID],
166
+      (float) $fleet_info[UBE_PLANET][PLANET_ID],
167 167
       "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'",
168
-      (int)$fleet_info[UBE_PLANET][PLANET_GALAXY],
169
-      (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM],
170
-      (int)$fleet_info[UBE_PLANET][PLANET_PLANET],
171
-      (int)$fleet_info[UBE_PLANET][PLANET_TYPE],
172
-
173
-      (float)$fleet_info[UBE_RESOURCES][RES_METAL],
174
-      (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL],
175
-      (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
176
-
177
-      (float)$fleet_info[UBE_BONUSES][UBE_ATTACK],
178
-      (float)$fleet_info[UBE_BONUSES][UBE_SHIELD],
179
-      (float)$fleet_info[UBE_BONUSES][UBE_ARMOR],
168
+      (int) $fleet_info[UBE_PLANET][PLANET_GALAXY],
169
+      (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM],
170
+      (int) $fleet_info[UBE_PLANET][PLANET_PLANET],
171
+      (int) $fleet_info[UBE_PLANET][PLANET_TYPE],
172
+
173
+      (float) $fleet_info[UBE_RESOURCES][RES_METAL],
174
+      (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL],
175
+      (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM],
176
+
177
+      (float) $fleet_info[UBE_BONUSES][UBE_ATTACK],
178
+      (float) $fleet_info[UBE_BONUSES][UBE_SHIELD],
179
+      (float) $fleet_info[UBE_BONUSES][UBE_ARMOR],
180 180
     );
181 181
 
182 182
     // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
       $ube_report_id,
186 186
       $fleet_id,
187 187
 
188
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
189
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
190
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
188
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL],
189
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL],
190
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM],
191 191
 
192
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
193
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
194
-      (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
192
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL],
193
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL],
194
+      (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM],
195 195
 
196
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
197
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
198
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
196
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL],
197
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL],
198
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM],
199 199
 
200
-      (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
200
+      (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL],
201 201
     );
202 202
 
203 203
     // Сохраняем результаты по юнитам - потеряно и восстановлено
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
           $fleet_id,
210 210
 
211 211
           $unit_id,
212
-          (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
213
-          (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
212
+          (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id],
213
+          (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id],
214 214
 
215 215
           $unit_sort_order,
216 216
         );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
           $unit_id,
235 235
           $unit_count,
236
-          (int)$fleet_data[UBE_UNITS_BOOM][$unit_id],
236
+          (int) $fleet_data[UBE_UNITS_BOOM][$unit_id],
237 237
 
238 238
           $fleet_data[UBE_ATTACK][$unit_id],
239 239
           $fleet_data[UBE_SHIELD][$unit_id],
Please login to merge, or discard this patch.
resources.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
  * @param $resource_id
31 31
  * @param ResourceCalculations $capsObj
32 32
  */
33
-function int_calc_storage_bar($resource_id, $capsObj)
34
-{
33
+function int_calc_storage_bar($resource_id, $capsObj) {
35 34
   global $lang, $template, $planetrow, $user;
36 35
 
37 36
   $totalProduction      = $capsObj->getProduction($resource_id);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 // $BuildEnergyTech             = $user['energy_tech'];
113 113
 for ($Option = 10; $Option >= 0; $Option--)
114 114
 {
115
- $template->assign_block_vars('option', array(
116
-   'VALUE' => $Option * 10,
117
- ));
115
+  $template->assign_block_vars('option', array(
116
+    'VALUE' => $Option * 10,
117
+  ));
118 118
 }
119 119
 
120 120
 $capsObj = new ResourceCalculations();
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 int_calc_storage_bar(RES_DEUTERIUM, $capsObj);
181 181
 
182 182
 $template->assign_vars(array(
183
- 'PLANET_NAME'          => $planetrow['name'],
184
- 'PLANET_TYPE'          => $planetrow['planet_type'],
183
+  'PLANET_NAME'          => $planetrow['name'],
184
+  'PLANET_TYPE'          => $planetrow['planet_type'],
185 185
 
186
- 'PRODUCTION_LEVEL'     => floor($capsObj->efficiency * 100),
186
+  'PRODUCTION_LEVEL'     => floor($capsObj->efficiency * 100),
187 187
 
188
- 'PAGE_HINT'            => $lang['res_hint'],
188
+  'PAGE_HINT'            => $lang['res_hint'],
189 189
 ));
190 190
 
191 191
 display($template, $lang['res_planet_production']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
   ]);
53 53
 };
54 54
 
55
-$ValidList['percent'] = array (  0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100 );
55
+$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
56 56
 $template = gettemplate('resources', true);
57 57
 
58 58
 /** @noinspection PhpUnhandledExceptionInspection */
59 59
 $planet = SN::$gc->repoV2->getPlanet($planetrow['id']);
60
-if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) {
60
+if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) {
61 61
   $template->assign_block_vars('result', $transmutation_result);
62 62
   $planet->dbLoadRecord($planetrow['id']);
63 63
 }
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
   'ENERGY_TYPE'    => $capsObj->productionCurrentMatrix[RES_ENERGY][0],
130 130
 ));
131 131
 
132
-foreach($sn_group_factories as $unit_id)
132
+foreach ($sn_group_factories as $unit_id)
133 133
 {
134
-  if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id))
134
+  if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id))
135 135
   {
136 136
     $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true);
137 137
     $template->assign_block_vars('production', array(
Please login to merge, or discard this patch.
classes/Fleet/MissionEspionage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
       $this->target_message = "{$lang['sys_mess_spy_enemy_fleet']} {$this->src_planet['name']} " . uni_render_coordinates_href($this->src_planet, '', 3);
32 32
       $this->target_message .= " {$lang['sys_mess_spy_seen_at']} {$this->dst_planet['name']} " . uni_render_coordinates($this->dst_planet);
33
-      if($this->missionReport->isSpyDetected()) {
33
+      if ($this->missionReport->isSpyDetected()) {
34 34
         $this->target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}";
35 35
       }
36 36
 
Please login to merge, or discard this patch.
classes/Pm/DecodeEspionage.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
       $groups[get_unit_param($unitId, P_UNIT_TYPE)][$unitId] = $unitAmount;
26 26
     }
27 27
 
28
-    foreach(static::ALLOWED_UNITS as $groupId) {
29
-      if(empty($groups[$groupId])) {
28
+    foreach (static::ALLOWED_UNITS as $groupId) {
29
+      if (empty($groups[$groupId])) {
30 30
         continue;
31 31
       }
32 32
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
         'NAME' => $lang['tech'][$groupId],
36 36
       ]);
37 37
 
38
-      foreach($general->getGroupsById($groupId) as $unitId) {
39
-        if((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
38
+      foreach ($general->getGroupsById($groupId) as $unitId) {
39
+        if ((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
40 40
           continue;
41 41
         }
42 42
 
Please login to merge, or discard this patch.