Passed
Push — trunk ( e5589f...062c60 )
by SuperNova.WS
06:16
created
classes/Common/Pimple/Container.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
 
240 240
         $factory = $this->values[$id];
241 241
 
242
-        $extended = function ($c) use ($callable, $factory) {
242
+        $extended = function($c) use ($callable, $factory) {
243 243
             return $callable($factory($c), $c);
244 244
         };
245 245
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @author  Fabien Potencier
33 33
  */
34
-class Container implements \ArrayAccess
35
-{
34
+class Container implements \ArrayAccess {
36 35
     private $values = array();
37 36
     private $factories;
38 37
     private $protected;
@@ -47,8 +46,7 @@  discard block
 block discarded – undo
47 46
      *
48 47
      * @param array $values The parameters or objects.
49 48
      */
50
-    public function __construct(array $values = array())
51
-    {
49
+    public function __construct(array $values = array()) {
52 50
         $this->factories = new \SplObjectStorage();
53 51
         $this->protected = new \SplObjectStorage();
54 52
 
@@ -71,8 +69,7 @@  discard block
 block discarded – undo
71 69
      *
72 70
      * @throws \RuntimeException Prevent override of a frozen service
73 71
      */
74
-    public function offsetSet($id, $value)
75
-    {
72
+    public function offsetSet($id, $value) {
76 73
         if (isset($this->frozen[$id])) {
77 74
             throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
78 75
         }
@@ -90,8 +87,7 @@  discard block
 block discarded – undo
90 87
      *
91 88
      * @throws \InvalidArgumentException if the identifier is not defined
92 89
      */
93
-    public function offsetGet($id)
94
-    {
90
+    public function offsetGet($id) {
95 91
         if (!isset($this->keys[$id])) {
96 92
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
97 93
         }
@@ -125,8 +121,7 @@  discard block
 block discarded – undo
125 121
      *
126 122
      * @return bool
127 123
      */
128
-    public function offsetExists($id)
129
-    {
124
+    public function offsetExists($id) {
130 125
         return isset($this->keys[$id]);
131 126
     }
132 127
 
@@ -135,8 +130,7 @@  discard block
 block discarded – undo
135 130
      *
136 131
      * @param string $id The unique identifier for the parameter or object
137 132
      */
138
-    public function offsetUnset($id)
139
-    {
133
+    public function offsetUnset($id) {
140 134
         if (isset($this->keys[$id])) {
141 135
             if (is_object($this->values[$id])) {
142 136
                 unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
@@ -155,8 +149,7 @@  discard block
 block discarded – undo
155 149
      *
156 150
      * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
157 151
      */
158
-    public function factory($callable)
159
-    {
152
+    public function factory($callable) {
160 153
         if (!method_exists($callable, '__invoke')) {
161 154
             throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
162 155
         }
@@ -177,8 +170,7 @@  discard block
 block discarded – undo
177 170
      *
178 171
      * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
179 172
      */
180
-    public function protect($callable)
181
-    {
173
+    public function protect($callable) {
182 174
         if (!method_exists($callable, '__invoke')) {
183 175
             throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
184 176
         }
@@ -197,8 +189,7 @@  discard block
 block discarded – undo
197 189
      *
198 190
      * @throws \InvalidArgumentException if the identifier is not defined
199 191
      */
200
-    public function raw($id)
201
-    {
192
+    public function raw($id) {
202 193
         if (!isset($this->keys[$id])) {
203 194
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
204 195
         }
@@ -223,8 +214,7 @@  discard block
 block discarded – undo
223 214
      *
224 215
      * @throws \InvalidArgumentException if the identifier is not defined or not a service definition
225 216
      */
226
-    public function extend($id, $callable)
227
-    {
217
+    public function extend($id, $callable) {
228 218
         if (!isset($this->keys[$id])) {
229 219
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
230 220
         }
@@ -256,8 +246,7 @@  discard block
 block discarded – undo
256 246
      *
257 247
      * @return array An array of value names
258 248
      */
259
-    public function keys()
260
-    {
249
+    public function keys() {
261 250
         return array_keys($this->values);
262 251
     }
263 252
 
@@ -269,8 +258,7 @@  discard block
 block discarded – undo
269 258
      *
270 259
      * @return static
271 260
      */
272
-    public function register(ServiceProviderInterface $provider, array $values = array())
273
-    {
261
+    public function register(ServiceProviderInterface $provider, array $values = array()) {
274 262
         $provider->register($this);
275 263
 
276 264
         foreach ($values as $key => $value) {
Please login to merge, or discard this patch.
fleet.php 2 patches
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.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 $planet = sys_get_param_int('planet', $planetrow['planet']);
45 45
 
46 46
 $target_mission = sys_get_param_int('target_mission');
47
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
47
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
48 48
   $planet_type = PT_PLANET;
49
-} elseif($target_mission == MT_RECYCLE) {
49
+} elseif ($target_mission == MT_RECYCLE) {
50 50
   $planet_type = PT_DEBRIS;
51
-} elseif($target_mission == MT_DESTROY) {
51
+} elseif ($target_mission == MT_DESTROY) {
52 52
   $planet_type = PT_MOON;
53 53
 } else {
54 54
   $planet_type = sys_get_param_int('planet_type');
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true);
65 65
 //$FlyingFleets = $FlyingFleets['Number'];
66 66
 $FlyingFleets = DbFleetStatic::fleet_count_flying($user['id']);
67
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
67
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
68 68
   messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
69 69
 }
70 70
 
71 71
 $MaxExpeditions = get_player_max_expeditons($user);
72
-if($MaxExpeditions) {
72
+if ($MaxExpeditions) {
73 73
 //  $FlyingExpeditions  = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
74 74
 //  $FlyingExpeditions  = $FlyingExpeditions['expedi'];
75
-  $FlyingExpeditions  = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE);
75
+  $FlyingExpeditions = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE);
76 76
 } else {
77 77
   $FlyingExpeditions = 0;
78 78
 }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
     $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
86 86
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
87 87
 
88
-    foreach($fleetarray as $ship_id => &$ship_amount) {
89
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
88
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
89
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
90 90
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
91 91
         die();
92 92
       }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
           $target_mission = MT_COLONIZE;
118 118
           $planet_type = PT_PLANET;
119 119
         } else {
120
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
120
+          messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
121 121
         }
122 122
       } else {
123 123
         $recyclers = 0;
124
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
124
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
125 125
           $recyclers += $fleetarray[$recycler_id];
126 126
         }
127 127
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
148 148
 
149
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
149
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
150 150
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
151 151
                 }
152 152
               }
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 );
207 207
 
208 208
 $is_transport_missions = false;
209
-if($missiontype) {
209
+if ($missiontype) {
210 210
   $sn_group_missions = sn_get_groups('missions');
211
-  foreach($missiontype as $mission_data_id => $mission_data) {
211
+  foreach ($missiontype as $mission_data_id => $mission_data) {
212 212
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
213 213
   }
214 214
 }
215 215
 
216
-switch($fleet_page) {
216
+switch ($fleet_page) {
217 217
   case 1:
218 218
     require('includes/includes/flt_page1.inc');
219 219
   break;
Please login to merge, or discard this patch.
classes/template_compile.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
   }
56 56
 
57 57
   /**
58
-  * Load template source from file
59
-  * @access private
60
-  */
58
+   * Load template source from file
59
+   * @access private
60
+   */
61 61
   function _tpl_load_file($handle, $store_in_db = false)
62 62
   {
63 63
     // Try and open template for read
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
   }
101 101
 
102 102
   /**
103
-  * Remove any PHP tags that do not belong, these regular expressions are derived from
104
-  * the ones that exist in zend_language_scanner.l
105
-  * @access private
106
-  */
103
+   * Remove any PHP tags that do not belong, these regular expressions are derived from
104
+   * the ones that exist in zend_language_scanner.l
105
+   * @access private
106
+   */
107 107
   function remove_php_tags(&$code)
108 108
   {
109 109
     // This matches the information gathered from the internal PHP lexer
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
   }
118 118
 
119 119
   /**
120
-  * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
-  * @access private
122
-  */
120
+   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
+   * @access private
122
+   */
123 123
   function compile($code, $no_echo = false, $echo_var = '')
124 124
   {
125 125
     if ($echo_var)
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
   }
289 289
 
290 290
   /**
291
-  * Compile variables
292
-  * @access private
293
-  */
291
+   * Compile variables
292
+   * @access private
293
+   */
294 294
   function compile_var_tags(&$text_blocks)
295 295
   {
296 296
     // including $lang variable
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
   }
364 364
 
365 365
   /**
366
-  * Compile blocks
367
-  * @access private
368
-  */
366
+   * Compile blocks
367
+   * @access private
368
+   */
369 369
   function compile_tag_block($tag_args)
370 370
   {
371 371
     $no_nesting = false;
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
452 452
 
453 453
     /**
454
-    * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
455
-    * <code>
456
-    * if (!$offset)
457
-    * {
458
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
459
-    * }
460
-    * </code>
461
-    */
454
+     * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
455
+     * <code>
456
+     * if (!$offset)
457
+     * {
458
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
459
+     * }
460
+     * </code>
461
+     */
462 462
 
463 463
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
464 464
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
   }
470 470
 
471 471
   /**
472
-  * Compile IF tags - much of this is from Smarty with
473
-  * some adaptions for our block level methods
474
-  * @access private
475
-  */
472
+   * Compile IF tags - much of this is from Smarty with
473
+   * some adaptions for our block level methods
474
+   * @access private
475
+   */
476 476
   function compile_tag_if($tag_args, $elseif)
477 477
   {
478 478
     // Tokenize args for 'if' tag.
@@ -627,9 +627,9 @@  discard block
 block discarded – undo
627 627
   }
628 628
 
629 629
   /**
630
-  * Compile DEFINE tags
631
-  * @access private
632
-  */
630
+   * Compile DEFINE tags
631
+   * @access private
632
+   */
633 633
   function compile_tag_define($tag_args, $op)
634 634
   {
635 635
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
   }
681 681
 
682 682
   /**
683
-  * Compile INCLUDE tag
684
-  * @access private
685
-  */
683
+   * Compile INCLUDE tag
684
+   * @access private
685
+   */
686 686
   function compile_tag_include($tag_args)
687 687
   {
688 688
     // Process dynamic includes
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
   }
696 696
 
697 697
   /**
698
-  * Compile INCLUDE_PHP tag
699
-  * @access private
700
-  */
698
+   * Compile INCLUDE_PHP tag
699
+   * @access private
700
+   */
701 701
   function compile_tag_include_php($tag_args)
702 702
   {
703 703
     return "\$this->_php_include('$tag_args');";
704 704
   }
705 705
 
706 706
   /**
707
-  * parse expression
708
-  * This is from Smarty
709
-  * @access private
710
-  */
707
+   * parse expression
708
+   * This is from Smarty
709
+   * @access private
710
+   */
711 711
   function _parse_is_expr($is_arg, $tokens)
712 712
   {
713 713
     $expr_end = 0;
@@ -800,14 +800,14 @@  discard block
 block discarded – undo
800 800
   }
801 801
 
802 802
   /**
803
-  * Generates a reference to the array of data values for the given
804
-  * (possibly nested) block namespace. This is a string of the form:
805
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
806
-  *
807
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
808
-  * NOTE: does not expect a trailing "." on the blockname.
809
-  * @access private
810
-  */
803
+   * Generates a reference to the array of data values for the given
804
+   * (possibly nested) block namespace. This is a string of the form:
805
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
806
+   *
807
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
808
+   * NOTE: does not expect a trailing "." on the blockname.
809
+   * @access private
810
+   */
811 811
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
812 812
   {
813 813
     // Get an array of the blocks involved.
@@ -843,9 +843,9 @@  discard block
 block discarded – undo
843 843
   }
844 844
 
845 845
   /**
846
-  * Write compiled file to cache directory
847
-  * @access private
848
-  */
846
+   * Write compiled file to cache directory
847
+   * @access private
848
+   */
849 849
   function compile_write($handle, $data)
850 850
   {
851 851
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -868,9 +868,9 @@  discard block
 block discarded – undo
868 868
 
869 869
   // Gorlum's minifier BOF
870 870
   /**
871
-  * Minifies template w/i PHP code by removing extra spaces
872
-  * @access private
873
-  */
871
+   * Minifies template w/i PHP code by removing extra spaces
872
+   * @access private
873
+   */
874 874
   function minify($html)
875 875
   {
876 876
     if(!SN::$config->tpl_minifier)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 
142 142
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
143 143
     $include_blocks = $matches[1];
144
-    if($include_blocks)
144
+    if ($include_blocks)
145 145
     {
146
-      foreach($include_blocks as &$included_file)
146
+      foreach ($include_blocks as &$included_file)
147 147
       {
148 148
         $included_file .= '.tpl.html';
149 149
       }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
       $varname = $var_val[3];
309 309
       $new = $this->generate_block_varref($namespace, $varname, $var_val[2]);
310 310
 
311
-      if(!empty($var_val[4])) {
311
+      if (!empty($var_val[4])) {
312 312
         $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template);
313 313
       }
314 314
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 
463 463
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
464 464
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
465
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
466
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
465
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
466
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
467 467
 
468 468
     return $tag_template_php;
469 469
   }
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
         break;
568 568
 
569 569
         case 'is':
570
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
570
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
571 571
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
572 572
 
573
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
573
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
574 574
 
575 575
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
576 576
 
@@ -834,11 +834,11 @@  discard block
 block discarded – undo
834 834
     }
835 835
     else if ($include_last_iterator)
836 836
     {
837
-      return '$_'. $blocks[$blockcount] . '_val';
837
+      return '$_' . $blocks[$blockcount] . '_val';
838 838
     }
839 839
     else
840 840
     {
841
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
841
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
842 842
     }
843 843
   }
844 844
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     if ($fp = @fopen($filename, 'wb'))
856 856
     {
857 857
       @flock($fp, LOCK_EX);
858
-      @fwrite ($fp, $data);
858
+      @fwrite($fp, $data);
859 859
       @flock($fp, LOCK_UN);
860 860
       @fclose($fp);
861 861
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
   */
874 874
   function minify($html)
875 875
   {
876
-    if(!SN::$config->tpl_minifier)
876
+    if (!SN::$config->tpl_minifier)
877 877
     {
878 878
       return $html;
879 879
     }
@@ -885,14 +885,14 @@  discard block
 block discarded – undo
885 885
     //$html = preg_replace('/[\r\n\t]+/', ' ', $html);
886 886
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
887 887
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
888
-    if(!empty($pre[0]))
888
+    if (!empty($pre[0]))
889 889
     {
890
-      foreach($pre[0] as $tag)
890
+      foreach ($pre[0] as $tag)
891 891
       {
892 892
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
893 893
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
894 894
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
895
-        $html = preg_replace('/#pre#/', $tag, $html,1);
895
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
896 896
       }
897 897
     }
898 898
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
 *
38 38
 * @package phpBB3
39 39
 */
40
-class template_compile
41
-{
40
+class template_compile {
42 41
   var $template;
43 42
 
44 43
   // Various storage arrays
@@ -58,8 +57,7 @@  discard block
 block discarded – undo
58 57
   * Load template source from file
59 58
   * @access private
60 59
   */
61
-  function _tpl_load_file($handle, $store_in_db = false)
62
-  {
60
+  function _tpl_load_file($handle, $store_in_db = false) {
63 61
     // Try and open template for read
64 62
     if (!file_exists($this->template->files[$handle]))
65 63
     {
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
       {
68 66
         return;
69 67
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
70
-      }
71
-      else
68
+      } else
72 69
       {
73 70
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
74 71
       }
@@ -104,8 +101,7 @@  discard block
 block discarded – undo
104 101
   * the ones that exist in zend_language_scanner.l
105 102
   * @access private
106 103
   */
107
-  function remove_php_tags(&$code)
108
-  {
104
+  function remove_php_tags(&$code) {
109 105
     // This matches the information gathered from the internal PHP lexer
110 106
     $match = array(
111 107
       '#<([\?%])=?.*?\1>#s',
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121 117
   * @access private
122 118
   */
123
-  function compile($code, $no_echo = false, $echo_var = '')
124
-  {
119
+  function compile($code, $no_echo = false, $echo_var = '') {
125 120
     if ($echo_var)
126 121
     {
127 122
       global $$echo_var;
@@ -224,15 +219,13 @@  discard block
 block discarded – undo
224 219
               $var = substr($temp, 2, -1);
225 220
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
226 221
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
227
-            }
228
-            else
222
+            } else
229 223
             {
230 224
               $var = substr($temp, 1, -1);
231 225
               //$file = $this->template->_rootref[$var];
232 226
               $temp = "\$this->_rootref['$var']";
233 227
             }
234
-          }
235
-          else
228
+          } else
236 229
           {
237 230
             $file = $temp;
238 231
           }
@@ -291,8 +284,7 @@  discard block
 block discarded – undo
291 284
   * Compile variables
292 285
   * @access private
293 286
   */
294
-  function compile_var_tags(&$text_blocks)
295
-  {
287
+  function compile_var_tags(&$text_blocks) {
296 288
     // including $lang variable
297 289
     // global $lang, $config; // NOT NEDEED - $lang now is global!
298 290
 
@@ -366,8 +358,7 @@  discard block
 block discarded – undo
366 358
   * Compile blocks
367 359
   * @access private
368 360
   */
369
-  function compile_tag_block($tag_args)
370
-  {
361
+  function compile_tag_block($tag_args) {
371 362
     $no_nesting = false;
372 363
 
373 364
     // Is the designer wanting to call another loop in a loop?
@@ -390,8 +381,7 @@  discard block
 block discarded – undo
390 381
       if ($match[2] < 0)
391 382
       {
392 383
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
393
-      }
394
-      else
384
+      } else
395 385
       {
396 386
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
397 387
       }
@@ -399,17 +389,14 @@  discard block
 block discarded – undo
399 389
       if (strlen($match[3]) < 1 || $match[3] == -1)
400 390
       {
401 391
         $loop_end = '$_' . $tag_args . '_count';
402
-      }
403
-      else if ($match[3] >= 0)
392
+      } else if ($match[3] >= 0)
404 393
       {
405 394
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
406
-      }
407
-      else //if ($match[3] < -1)
395
+      } else //if ($match[3] < -1)
408 396
       {
409 397
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
410 398
       }
411
-    }
412
-    else
399
+    } else
413 400
     {
414 401
       $loop_start = 0;
415 402
       $loop_end = '$_' . $tag_args . '_count';
@@ -422,8 +409,7 @@  discard block
 block discarded – undo
422 409
     {
423 410
       // We need to implode $no_nesting times from the end...
424 411
       $block = array_slice($this->block_names, -$no_nesting);
425
-    }
426
-    else
412
+    } else
427 413
     {
428 414
       $block = $this->block_names;
429 415
     }
@@ -433,8 +419,7 @@  discard block
 block discarded – undo
433 419
       // Block is not nested.
434 420
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
435 421
       $varref = "\$this->_tpldata['$tag_args']";
436
-    }
437
-    else
422
+    } else
438 423
     {
439 424
       // This block is nested.
440 425
       // Generate a namespace string for this block.
@@ -473,8 +458,7 @@  discard block
 block discarded – undo
473 458
   * some adaptions for our block level methods
474 459
   * @access private
475 460
   */
476
-  function compile_tag_if($tag_args, $elseif)
477
-  {
461
+  function compile_tag_if($tag_args, $elseif) {
478 462
     // Tokenize args for 'if' tag.
479 463
     preg_match_all('/(?:
480 464
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -582,8 +566,7 @@  discard block
 block discarded – undo
582 566
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
583 567
           {
584 568
             $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
585
-          }
586
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
569
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
587 570
           {
588 571
             // Allow checking if loops are set with .loopname
589 572
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -599,8 +582,7 @@  discard block
 block discarded – undo
599 582
 
600 583
               // Add the block reference for the last child.
601 584
               $varref .= "['" . $block . "']";
602
-            }
603
-            else
585
+            } else
604 586
             {
605 587
               $varref = '$this->_tpldata';
606 588
 
@@ -608,8 +590,7 @@  discard block
 block discarded – undo
608 590
               $varref .= "['" . $blocks[0] . "']";
609 591
             }
610 592
             $token = "sizeof($varref)";
611
-          }
612
-          else if (!empty($token))
593
+          } else if (!empty($token))
613 594
           {
614 595
             $token = '(' . $token . ')';
615 596
           }
@@ -630,8 +611,7 @@  discard block
 block discarded – undo
630 611
   * Compile DEFINE tags
631 612
   * @access private
632 613
   */
633
-  function compile_tag_define($tag_args, $op)
634
-  {
614
+  function compile_tag_define($tag_args, $op) {
635 615
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
636 616
 
637 617
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -654,8 +634,7 @@  discard block
 block discarded – undo
654 634
 
655 635
       // Now replace the php code
656 636
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
657
-    }
658
-    else
637
+    } else
659 638
     {
660 639
       preg_match('#true|false|\.#i', $match[4], $type);
661 640
 
@@ -683,8 +662,7 @@  discard block
 block discarded – undo
683 662
   * Compile INCLUDE tag
684 663
   * @access private
685 664
   */
686
-  function compile_tag_include($tag_args)
687
-  {
665
+  function compile_tag_include($tag_args) {
688 666
     // Process dynamic includes
689 667
     if ($tag_args[0] == '$')
690 668
     {
@@ -698,8 +676,7 @@  discard block
 block discarded – undo
698 676
   * Compile INCLUDE_PHP tag
699 677
   * @access private
700 678
   */
701
-  function compile_tag_include_php($tag_args)
702
-  {
679
+  function compile_tag_include_php($tag_args) {
703 680
     return "\$this->_php_include('$tag_args');";
704 681
   }
705 682
 
@@ -708,8 +685,7 @@  discard block
 block discarded – undo
708 685
   * This is from Smarty
709 686
   * @access private
710 687
   */
711
-  function _parse_is_expr($is_arg, $tokens)
712
-  {
688
+  function _parse_is_expr($is_arg, $tokens) {
713 689
     $expr_end = 0;
714 690
     $negate_expr = false;
715 691
 
@@ -717,8 +693,7 @@  discard block
 block discarded – undo
717 693
     {
718 694
       $negate_expr = true;
719 695
       $expr_type = array_shift($tokens);
720
-    }
721
-    else
696
+    } else
722 697
     {
723 698
       $expr_type = $first_token;
724 699
     }
@@ -731,8 +706,7 @@  discard block
 block discarded – undo
731 706
           $expr_end++;
732 707
           $expr_arg = $tokens[$expr_end++];
733 708
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
734
-        }
735
-        else
709
+        } else
736 710
         {
737 711
           $expr = "!($is_arg & 1)";
738 712
         }
@@ -744,8 +718,7 @@  discard block
 block discarded – undo
744 718
           $expr_end++;
745 719
           $expr_arg = $tokens[$expr_end++];
746 720
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
747
-        }
748
-        else
721
+        } else
749 722
         {
750 723
           $expr = "($is_arg & 1)";
751 724
         }
@@ -784,8 +757,7 @@  discard block
 block discarded – undo
784 757
    *
785 758
    * @return string
786 759
    */
787
-  private function generate_block_varref($namespace, $varname, $defop = false)
788
-  {
760
+  private function generate_block_varref($namespace, $varname, $defop = false) {
789 761
     // Strip the trailing period.
790 762
     $namespace = substr($namespace, 0, -1);
791 763
 
@@ -808,8 +780,7 @@  discard block
 block discarded – undo
808 780
   * NOTE: does not expect a trailing "." on the blockname.
809 781
   * @access private
810 782
   */
811
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
812
-  {
783
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
813 784
     // Get an array of the blocks involved.
814 785
     $blocks = explode('.', $blockname);
815 786
     $blockcount = sizeof($blocks) - 1;
@@ -831,12 +802,10 @@  discard block
 block discarded – undo
831 802
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
832 803
       }
833 804
       return $varref;
834
-    }
835
-    else if ($include_last_iterator)
805
+    } else if ($include_last_iterator)
836 806
     {
837 807
       return '$_'. $blocks[$blockcount] . '_val';
838
-    }
839
-    else
808
+    } else
840 809
     {
841 810
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
842 811
     }
@@ -846,8 +815,7 @@  discard block
 block discarded – undo
846 815
   * Write compiled file to cache directory
847 816
   * @access private
848 817
   */
849
-  function compile_write($handle, $data)
850
-  {
818
+  function compile_write($handle, $data) {
851 819
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
852 820
 
853 821
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -871,8 +839,7 @@  discard block
 block discarded – undo
871 839
   * Minifies template w/i PHP code by removing extra spaces
872 840
   * @access private
873 841
   */
874
-  function minify($html)
875
-  {
842
+  function minify($html) {
876 843
     if(!SN::$config->tpl_minifier)
877 844
     {
878 845
       return $html;
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminMining.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
         'ID'        => self::PAGE_SORT_BY_RANK,
30 30
         'HTML_ID'   => 'byTotalRank',
31 31
         'HTML_NAME' => '{ byTotalRank }',
32
-        'SQL_SORT'  => ['u.total_rank',],
32
+        'SQL_SORT'  => ['u.total_rank', ],
33 33
       ],
34 34
       self::PAGE_SORT_BY_ID => [
35 35
         'ID'        => self::PAGE_SORT_BY_ID,
36 36
         'HTML_ID'   => 'byId',
37 37
         'HTML_NAME' => '{ byId }',
38
-        'SQL_SORT'  => ['u.id',],
38
+        'SQL_SORT'  => ['u.id', ],
39 39
       ],
40 40
       self::PAGE_SORT_BY_NAME => [
41 41
         'ID'        => self::PAGE_SORT_BY_NAME,
42 42
         'HTML_ID'   => 'byName',
43 43
         'HTML_NAME' => '{ byName }',
44
-        'SQL_SORT'  => ['u.username',],
44
+        'SQL_SORT'  => ['u.username', ],
45 45
       ],
46 46
 
47 47
       self::PAGE_SORT_BY_POINTS => [
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminModules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
   const SORT_BY_ACTIVITY = 1;
14 14
 
15 15
   private static $sorting = [
16
-    self::SORT_BY_PACKAGE  => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED',],
17
-    self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME',],
16
+    self::SORT_BY_PACKAGE  => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED', ],
17
+    self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME', ],
18 18
   ];
19 19
 
20 20
   private static $sortFields = [];
Please login to merge, or discard this patch.
classes/Fleet/FleetStatic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
    * @return DbMysqliResultIterator|EmptyCountableIterator
19 19
    */
20 20
   public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) {
21
-    if(empty($planetIds) || !is_array($planetIds)) {
21
+    if (empty($planetIds) || !is_array($planetIds)) {
22 22
       return new EmptyCountableIterator();
23 23
     }
24 24
 
Please login to merge, or discard this patch.
admin/admin_locale.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-define('INSIDE'  , true);
11
-define('INSTALL' , false);
12
-define('IN_ADMIN'  , true);
10
+define('INSIDE', true);
11
+define('INSTALL', false);
12
+define('IN_ADMIN', true);
13 13
 
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 function adm_lng_assign_string($lang_id, $locale_string_name, $value) {
21 21
   global $locale_string_template, $languages_info, $languages, $domain;
22 22
 
23
-  if(is_array($value)) {
24
-    foreach($value as $sub_key => $sub_value) {
23
+  if (is_array($value)) {
24
+    foreach ($value as $sub_key => $sub_value) {
25 25
       adm_lng_assign_string($lang_id, "{$locale_string_name}[{$sub_key}]", $sub_value);
26 26
     }
27
-  } elseif($value) {
28
-    if(!isset($locale_string_template[$locale_string_name])) {
27
+  } elseif ($value) {
28
+    if (!isset($locale_string_template[$locale_string_name])) {
29 29
       $locale_string_template[$locale_string_name] = array();
30 30
     }
31 31
     $locale_string_template[$locale_string_name] = array_merge($locale_string_template[$locale_string_name], array("[{$lang_id}]" => htmlentities($value, ENT_COMPAT, 'utf-8')));
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
   global $domain, $lang_id;
47 47
 
48 48
   $return = "{$ident}'{$string_name}' => ";
49
-  if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
49
+  if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
50 50
     $return .= "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',";
51 51
   } else {
52 52
     $return .= "array(\r\n";
53
-    foreach($string_value as $arr_name => $arr_data) {
53
+    foreach ($string_value as $arr_name => $arr_data) {
54 54
       $return .= adm_lng_parse_string($arr_name, $arr_data, $ident . '  ');
55 55
     }
56 56
     $return .= "{$ident}),\r\n";
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 
104 104
   $string_name_new = false;
105 105
 
106
-  if(isset($honor_constants[$domain][$string_name_prefix])) {
106
+  if (isset($honor_constants[$domain][$string_name_prefix])) {
107 107
     $found_constants = array_keys($constants, $string_name);
108
-    foreach($found_constants as $constant_name) {
108
+    foreach ($found_constants as $constant_name) {
109 109
       $honor_prefix_list = is_array($honor_constants[$domain][$string_name_prefix]) ? $honor_constants[$domain][$string_name_prefix] : array($honor_constants[$domain][$string_name_prefix]);
110
-      foreach($honor_prefix_list as $honor_prefix) {
111
-        if(strpos($constant_name, $honor_prefix) === 0) {
110
+      foreach ($honor_prefix_list as $honor_prefix) {
111
+        if (strpos($constant_name, $honor_prefix) === 0) {
112 112
           $string_name_new = $constant_name;
113 113
           break;
114 114
         }
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 
119 119
   $string_name_new = $string_name_new ? $string_name_new : "'{$string_name}'";
120 120
   fwrite($file_handler, "{$ident}{$string_name_new} => ");
121
-  if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
121
+  if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
122 122
     fwrite($file_handler, "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',");
123 123
 //    fwrite($file_handler, "'" . addslashes($string_value[$lang_id]) . "',");
124 124
   } else {
125 125
     $string_name_prefix = $string_name_prefix . "[{$string_name}]";
126 126
     fwrite($file_handler, "array(\r\n");
127
-    foreach($string_value as $arr_name => $arr_data) {
127
+    foreach ($string_value as $arr_name => $arr_data) {
128 128
       adm_lng_write_string($arr_name, $arr_data, $ident . '  ', $string_name_prefix);
129 129
     }
130 130
     fwrite($file_handler, "{$ident}),\r\n");
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 $languages_info = lng_get_list();
145 145
 $domain = sys_get_param_str('domain');
146 146
 
147
-if($domain) {
147
+if ($domain) {
148 148
   $lang_new = sys_get_param('lang_new');
149
-  if(!empty($lang_new) && is_array($lang_new)) {
149
+  if (!empty($lang_new) && is_array($lang_new)) {
150 150
     $constants = get_defined_constants(true);
151 151
     $constants = $constants['user'];
152 152
     ksort($constants);
153
-    foreach($languages_info as $lang_id => $land_data) {
153
+    foreach ($languages_info as $lang_id => $land_data) {
154 154
       $file_handler = fopen(SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php.new", 'w');
155 155
       fwrite($file_handler, "<?php\r\n\r\n/*\r\n#############################################################################
156 156
 #  Filename: {$domain}.mo.php
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 #  Website: http://www.supernova.ws
159 159
 #  Description: Massive Multiplayer Online Browser Space Strategy Game\r\n#\r\n");
160 160
 
161
-      foreach($land_data['LANG_COPYRIGHT'] as $lang_copyright) {
161
+      foreach ($land_data['LANG_COPYRIGHT'] as $lang_copyright) {
162 162
         $lang_copyright = str_replace(array('&copy;', '&quot;', '&lt;', '&gt;'), array('©', '"', '<', '>'), $lang_copyright);
163 163
         fwrite($file_handler, "#  {$lang_copyright}\r\n");
164 164
       }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 /**\r\n*\r\n* @package language\r\n* @system [{$land_data['LANG_NAME_ENGLISH']}]\r\n* @version " . SN_VERSION . "\r\n*\r\n*/\r\n
167 167
 /**\r\n* DO NOT CHANGE\r\n*/\r\n\r\nif (!defined('INSIDE')) die();\r\n
168 168
 \$a_lang_array = array(\r\n");
169
-      foreach($lang_new as $string_name => $string_value) {
169
+      foreach ($lang_new as $string_name => $string_value) {
170 170
         adm_lng_write_string($string_name, $string_value);
171 171
       }
172 172
       fwrite($file_handler, ");\r\n");
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
     sys_redirect("admin_locale.php?domain={$domain}");
177 177
   }
178 178
 
179
-  foreach($languages_info as $lang_id => $lang_data) {
179
+  foreach ($languages_info as $lang_id => $lang_data) {
180 180
     $template->assign_block_vars('language', $lang_data);
181 181
     $full_filename = SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php";
182 182
     $languages[$lang_id] = adm_lng_load($full_filename . (file_exists($full_filename . '.new') ? '.new' : ''));
183
-    foreach($languages[$lang_id] as $locale_string_name => $cork) {
183
+    foreach ($languages[$lang_id] as $locale_string_name => $cork) {
184 184
       adm_lng_assign_string($lang_id, "[{$locale_string_name}]", $languages[$lang_id][$locale_string_name]);
185 185
     }
186 186
   }
187 187
 
188
-  foreach($locale_string_template as $locale_string_name => $locale_string_list) {
188
+  foreach ($locale_string_template as $locale_string_name => $locale_string_list) {
189 189
     $template->assign_block_vars('string', array(
190 190
       'NAME' => $locale_string_name,
191 191
     ));
192 192
 
193
-    foreach($languages_info as $lang_id => $cork2) {
193
+    foreach ($languages_info as $lang_id => $cork2) {
194 194
       $template->assign_block_vars('string.locale', array(
195 195
         'LANG' => $lang_id,
196 196
         'VALUE' => $locale_string_list["[{$lang_id}]"],
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
   $dir = dir($path);
207 207
   while (false !== ($lang_id = $dir->read())) {
208 208
     $full_path = $path . $lang_id;
209
-    if($lang_id[0] != "." && is_dir($full_path)) {
209
+    if ($lang_id[0] != "." && is_dir($full_path)) {
210 210
       $lang_file_list = dir($full_path);
211 211
       while (false !== ($filename = $lang_file_list->read())) {
212 212
         $lang_domain = strtolower(substr($filename, 0, strpos($filename, '.')));
213
-        if(!$lang_domain) {
213
+        if (!$lang_domain) {
214 214
           continue;
215 215
         }
216 216
 
217 217
         $file_ext = strtolower(substr($filename, strpos($filename, '.')));
218
-        if($lang_domain != 'language') {
219
-          if($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) {
218
+        if ($lang_domain != 'language') {
219
+          if ($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) {
220 220
             $language_domains[$lang_domain] = $lang_domain;
221 221
             $languages[$lang_id][$lang_domain] = $lang_domain;
222 222
           }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
   }
227 227
   $dir->close();
228 228
 
229
-  foreach($language_domains as $lang_domain) {
229
+  foreach ($language_domains as $lang_domain) {
230 230
     $template->assign_block_vars('domain', array(
231 231
       'NAME' => $lang_domain,
232 232
     ));
Please login to merge, or discard this patch.
includes/vars.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1175,12 +1175,12 @@
 block discarded – undo
1175 1175
     ],
1176 1176
     // Defensive building list
1177 1177
     'defense'            => [UNIT_DEF_TURRET_MISSILE   => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1178
-                             UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1179
-                             UNIT_DEF_TURRET_ION       => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1178
+                              UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1179
+                              UNIT_DEF_TURRET_ION       => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1180 1180
 
1181
-                             UNIT_DEF_SHIELD_SMALL => UNIT_DEF_SHIELD_SMALL, UNIT_DEF_SHIELD_BIG => UNIT_DEF_SHIELD_BIG, UNIT_DEF_SHIELD_PLANET => UNIT_DEF_SHIELD_PLANET,
1181
+                              UNIT_DEF_SHIELD_SMALL => UNIT_DEF_SHIELD_SMALL, UNIT_DEF_SHIELD_BIG => UNIT_DEF_SHIELD_BIG, UNIT_DEF_SHIELD_PLANET => UNIT_DEF_SHIELD_PLANET,
1182 1182
 
1183
-                             UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,
1183
+                              UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,
1184 1184
     ],
1185 1185
 
1186 1186
     // Missiles list
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -595,29 +595,29 @@  discard block
 block discarded – undo
595 595
         P_MISSION_EXPEDITION_OUTCOME           => FLT_EXPEDITION_OUTCOME_FOUND_FLEET,
596 596
         P_MISSION_EXPEDITION_OUTCOME_TYPE      => FLT_EXPEDITION_OUTCOME_TYPE_GOOD,
597 597
         P_CHANCE                               => 200,
598
-        'percent'                              => [0 => 0.1, 1 => 0.02, 2 => 0.01,],
598
+        'percent'                              => [0 => 0.1, 1 => 0.02, 2 => 0.01, ],
599 599
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
600
-          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2,],
601
-          [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1,],
602
-          [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0,],
600
+          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2, ],
601
+          [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1, ],
602
+          [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0, ],
603 603
         ],
604 604
       ],
605 605
       FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES => [
606 606
         P_MISSION_EXPEDITION_OUTCOME           => FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES,
607 607
         P_MISSION_EXPEDITION_OUTCOME_TYPE      => FLT_EXPEDITION_OUTCOME_TYPE_GOOD,
608 608
         P_CHANCE                               => 300,
609
-        'percent'                              => [0 => 0.1, 1 => 0.050, 2 => 0.025,],
609
+        'percent'                              => [0 => 0.1, 1 => 0.050, 2 => 0.025, ],
610 610
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
611
-          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2,],
612
-          [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1,],
613
-          [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0,],
611
+          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2, ],
612
+          [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1, ],
613
+          [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0, ],
614 614
         ],
615 615
       ],
616 616
       FLT_EXPEDITION_OUTCOME_FOUND_DM        => [
617 617
         P_MISSION_EXPEDITION_OUTCOME           => FLT_EXPEDITION_OUTCOME_FOUND_DM,
618 618
         P_MISSION_EXPEDITION_OUTCOME_TYPE      => FLT_EXPEDITION_OUTCOME_TYPE_GOOD,
619 619
         P_CHANCE                               => 100,
620
-        'percent'                              => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010,],
620
+        'percent'                              => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010, ],
621 621
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
622 622
           [P_CHANCE => 90, P_MULTIPLIER => 0.0010, /*P_MESSAGE_ID => 2,*/],
623 623
           [P_CHANCE => 9, P_MULTIPLIER => 0.0040, /*P_MESSAGE_ID => 1,*/],
@@ -652,14 +652,14 @@  discard block
 block discarded – undo
652 652
     ],
653 653
 
654 654
     'planet_generator' => [
655
-      0  => [ // HomeWorld
655
+      0  => [// HomeWorld
656 656
         't_max_min'     => 40, // Tmax 40
657 657
         't_max_max'     => 40,
658 658
         't_delta_min'   => 40, // Tmin 0
659 659
         't_delta_max'   => 40,
660 660
         'size_min'      => $config->initial_fields,
661 661
         'size_max'      => $config->initial_fields,
662
-        'core_types'    => [PLANET_DENSITY_STANDARD,],
662
+        'core_types'    => [PLANET_DENSITY_STANDARD, ],
663 663
         'planet_images' => ['normaltemp'],
664 664
       ],
665 665
       1  => [
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
         ],
890 890
         'planet_images' => ['eis'],
891 891
       ],
892
-      16 => [ // Random planet - stranger; -35 avg
892
+      16 => [// Random planet - stranger; -35 avg
893 893
         't_max_min'     => -90,
894 894
         't_max_max'     => +40,
895 895
         't_delta_min'   => 2,
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
           PLANET_DENSITY_METAL_PERIDOT,
910 910
           PLANET_DENSITY_METAL_RAW,
911 911
         ],
912
-        'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis',],
912
+        'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis', ],
913 913
       ],
914 914
     ],
915 915
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_HYDROGEN,
933 933
         UNIT_PLANET_DENSITY_RARITY        => 30, // 1, // 40.00, // * 1/121 0,82645
934 934
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
935
-        UNIT_RESOURCES                    => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,],
935
+        UNIT_RESOURCES                    => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ],
936 936
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
937 937
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
938 938
       ],
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_METHANE,
942 942
         UNIT_PLANET_DENSITY_RARITY        => 130, // 6, // 6.67, // * 6,0	4,95868
943 943
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
944
-        UNIT_RESOURCES                    => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,],
944
+        UNIT_RESOURCES                    => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ],
945 945
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
946 946
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
947 947
       ],
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_WATER,
951 951
         UNIT_PLANET_DENSITY_RARITY        => 450, //20, // 2.00, // * 20,0	16,52893
952 952
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
953
-        UNIT_RESOURCES                    => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,],
953
+        UNIT_RESOURCES                    => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ],
954 954
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
955 955
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
956 956
       ],
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_RAW,
961 961
         UNIT_PLANET_DENSITY_RARITY        => 20, // 1, // 40.00, // *1,0	0,82645
962 962
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
963
-        UNIT_RESOURCES                    => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,],
963
+        UNIT_RESOURCES                    => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ],
964 964
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
965 965
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
966 966
       ],
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_SILICATE,
970 970
         UNIT_PLANET_DENSITY_RARITY        => 140, // 5.71, // * 7,0	5,78512
971 971
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
972
-        UNIT_RESOURCES                    => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,],
972
+        UNIT_RESOURCES                    => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ],
973 973
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
974 974
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
975 975
       ],
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_STONE,
979 979
         UNIT_PLANET_DENSITY_RARITY        => 500, // 1.90, // * 21,0	17,35537
980 980
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
981
-        UNIT_RESOURCES                    => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,],
981
+        UNIT_RESOURCES                    => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ],
982 982
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
983 983
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
984 984
       ],
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_STANDARD,
989 989
         UNIT_PLANET_DENSITY_RARITY        => 1000, // 1.0, // * 40,0	33,05785
990 990
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_NORMAL,
991
-        UNIT_RESOURCES                    => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,],
991
+        UNIT_RESOURCES                    => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ],
992 992
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
993 993
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
994 994
       ],
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_ORE,
999 999
         UNIT_PLANET_DENSITY_RARITY        => 550, // 2.11, // * 19,0	15,70248
1000 1000
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
1001
-        UNIT_RESOURCES                    => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,],
1001
+        UNIT_RESOURCES                    => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ],
1002 1002
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
1003 1003
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
1004 1004
       ],
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_PERIDOT,
1008 1008
         UNIT_PLANET_DENSITY_RARITY        => 120, // 8.00, // * 5,0	4,13223
1009 1009
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
1010
-        UNIT_RESOURCES                    => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,],
1010
+        UNIT_RESOURCES                    => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ],
1011 1011
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
1012 1012
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
1013 1013
       ],
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_RAW,
1017 1017
         UNIT_PLANET_DENSITY_RARITY        => 25, // 40.00, // * 1,0	0,82645
1018 1018
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
1019
-        UNIT_RESOURCES                    => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,],
1019
+        UNIT_RESOURCES                    => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ],
1020 1020
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
1021 1021
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
1022 1022
       ],
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
     ],
1194 1194
 
1195 1195
     // Missiles list
1196
-    'missile'            => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,],
1196
+    'missile'            => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ],
1197 1197
 
1198 1198
     // Combat units list
1199 1199
     'combat'             => [
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
     // Resource list
1243 1243
     'resources'          => [0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'],
1244 1244
     // Resources all
1245
-    'resources_all'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,],
1245
+    'resources_all'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ],
1246 1246
     // Resources can be produced on planet
1247 1247
     'resources_planet'   => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY],
1248 1248
     // Resources can be looted from planet
@@ -1261,13 +1261,13 @@  discard block
 block discarded – undo
1261 1261
     ],
1262 1262
 
1263 1263
     // Resources that can be tradeable in market trader AND be a quest_rewards
1264
-    'quest_rewards'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,],
1264
+    'quest_rewards'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ],
1265 1265
 
1266 1266
 //      // Ques list
1267 1267
 //      'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH),
1268 1268
 
1269
-    'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,],
1270
-    'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,],
1269
+    'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ],
1270
+    'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ],
1271 1271
 
1272 1272
     GROUP_GROUP_ID_TO_NAMES => [
1273 1273
       UNIT_STRUCTURES   => 'structures',
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
       UNIT_PLANS        => 'plans',
1282 1282
     ],
1283 1283
 
1284
-    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet',],
1284
+    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet', ],
1285 1285
 
1286 1286
     GROUP_UNIT_COMBAT_SORT_ORDER => [
1287 1287
       SHIP_SPY,
Please login to merge, or discard this patch.
includes/pages/imperator.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 //    $same_user = false;
48 48
 //  }
49 49
 
50
-  if(!$user_data) {
50
+  if (!$user_data) {
51 51
     messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10);
52 52
     die();
53 53
   }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
   $stat_array = array();
59 59
   $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;");
60 60
   $stat_count = SN::$db->db_affected_rows();
61
-  while($row = db_fetch($query)) {
62
-    foreach($stat_fields as $field_db_name => $field_template_name) {
61
+  while ($row = db_fetch($query)) {
62
+    foreach ($stat_fields as $field_db_name => $field_template_name) {
63 63
       // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS
64 64
       $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name];
65 65
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
   $stat_array_date = $stat_array['STAT_DATE'];
69 69
   empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false;
70
-  foreach($stat_array_date['DATA'] as $key => $value) {
70
+  foreach ($stat_array_date['DATA'] as $key => $value) {
71 71
     $template->assign_block_vars('stat_date', array(
72 72
       'ID' => $key,
73 73
       'VALUE' => $value,
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 
78 78
   unset($stat_array['STAT_DATE']);
79 79
   $template_data = array();
80
-  foreach($stat_array as $stat_type => &$stat_type_data) {
80
+  foreach ($stat_array as $stat_type => &$stat_type_data) {
81 81
     $reverse_min_max = strpos($stat_type, '_RANK') !== false;
82 82
     $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']);
83 83
     $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']);
84 84
     $stat_type_data['AVG'] = avg($stat_type_data['DATA']);
85
-    foreach($stat_type_data['DATA'] as $key => $value) {
85
+    foreach ($stat_type_data['DATA'] as $key => $value) {
86 86
       $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100;
87 87
       $template_data[$stat_type][$key]['ID'] = $key;
88 88
       $template_data[$stat_type][$key]['VALUE'] = $value;
89
-      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN']  - $value : $value - $stat_type_data['MAX']);
89
+      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']);
90 90
       $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key];
91 91
     }
92 92
   }
93 93
 
94
-  foreach($template_data as $stat_type => $stat_type_data) {
94
+  foreach ($template_data as $stat_type => $stat_type_data) {
95 95
     $template->assign_block_vars('stat', array(
96 96
       'TYPE' => $stat_type,
97 97
       'TEXT' => $lang['imp_stat_types'][$stat_type],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
       'MAX' => $stat_array[$stat_type]['MAX'],
100 100
       'AVG' => $stat_array[$stat_type]['AVG'],
101 101
     ));
102
-    foreach($stat_type_data as $stat_entry) {
102
+    foreach ($stat_type_data as $stat_entry) {
103 103
       $template->assign_block_vars('stat.entry', $stat_entry);
104 104
     }
105 105
   }
106 106
 
107 107
 
108
-  if($same_user) {
108
+  if ($same_user) {
109 109
     rpg_level_up($user, RPG_STRUCTURE);
110 110
     rpg_level_up($user, RPG_RAID);
111 111
     rpg_level_up($user, RPG_TECH);
@@ -142,29 +142,29 @@  discard block
 block discarded – undo
142 142
     'builder_xp'           => HelperString::numberFloorAndFormat($user_data['xpminier']),
143 143
     'builder_lvl'          => HelperString::numberFloorAndFormat($user_data['lvl_minier']),
144 144
     'builder_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])),
145
-    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)),
145
+    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)),
146 146
     'raid_xp'              => HelperString::numberFloorAndFormat($user_data['xpraid']),
147 147
     'raid_lvl'             => HelperString::numberFloorAndFormat($user_data['lvl_raid']),
148
-    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)),
148
+    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)),
149 149
     'raids'                => HelperString::numberFloorAndFormat($user_data['raids']),
150 150
     'raidswin'             => HelperString::numberFloorAndFormat($user_data['raidswin']),
151 151
     'raidsloose'           => HelperString::numberFloorAndFormat($user_data['raidsloose']),
152 152
     'tech_xp'              => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']),
153 153
     'tech_lvl'             => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']),
154 154
     'tech_lvl_st'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])),
155
-    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)),
155
+    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)),
156 156
 
157 157
     'explore_xp'           => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']),
158 158
     'explore_lvl'          => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']),
159 159
     'explore_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])),
160
-    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)),
161
-
162
-    'build_points'         => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ),
163
-    'tech_points'          => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ),
164
-    'fleet_points'         => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ),
165
-    'defs_points'          => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ),
166
-    'res_points'           => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ),
167
-    'total_points'         => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ),
160
+    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)),
161
+
162
+    'build_points'         => HelperString::numberFloorAndFormat($StatRecord['build_points']),
163
+    'tech_points'          => HelperString::numberFloorAndFormat($StatRecord['tech_points']),
164
+    'fleet_points'         => HelperString::numberFloorAndFormat($StatRecord['fleet_points']),
165
+    'defs_points'          => HelperString::numberFloorAndFormat($StatRecord['defs_points']),
166
+    'res_points'           => HelperString::numberFloorAndFormat($StatRecord['res_points']),
167
+    'total_points'         => HelperString::numberFloorAndFormat($StatRecord['total_points']),
168 168
     'user_rank'            => $StatRecord['total_rank'],
169 169
     'RANK_DIFF'            => $StatRecord['total_old_rank'] - $StatRecord['total_rank'],
170 170
 
Please login to merge, or discard this patch.