Test Failed
Push — master ( 0d5d14...c17ef6 )
by SuperNova.WS
06:37
created
includes/includes/market_fleeter.inc 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use DBAL\OldDbChangeSet;
4 4
 use Planet\DBStaticPlanet;
5 5
 
6
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
6
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
7 7
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
8 8
 }
9 9
 
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
   'rpg_cost' => $rpg_cost,
16 16
 ));
17 17
 
18
-if(is_array($shipList)) {
19
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
18
+if (is_array($shipList)) {
19
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
20 20
     $intError = MARKET_NO_DM;
21 21
   }
22 22
 
@@ -33,30 +33,30 @@  discard block
 block discarded – undo
33 33
   $qry = array();
34 34
   $total = array();
35 35
   $db_changeset = array();
36
-  foreach($shipList as $shipID => &$shipCount) {
36
+  foreach ($shipList as $shipID => &$shipCount) {
37 37
     $shipCount = ceil(floatval($shipCount));
38
-    if(!$shipCount) {
38
+    if (!$shipCount) {
39 39
       continue;
40 40
     }
41 41
 
42
-    if($shipCount < 0) {
42
+    if ($shipCount < 0) {
43 43
       $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
44 44
       $intError = MARKET_NEGATIVE_SHIPS;
45 45
       break;
46 46
     }
47 47
 
48
-    if($mode == MARKET_SCRAPPER) {
48
+    if ($mode == MARKET_SCRAPPER) {
49 49
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
50
-    } elseif($mode == MARKET_STOCKMAN) {
50
+    } elseif ($mode == MARKET_STOCKMAN) {
51 51
       $amount = $stock[$shipID];
52 52
     }
53 53
 
54
-    if($amount < $shipCount) {
54
+    if ($amount < $shipCount) {
55 55
       $intError = $error_no_stock;
56 56
       break;
57 57
     }
58 58
 
59
-    if(!in_array($shipID, sn_get_groups('fleet'))) {
59
+    if (!in_array($shipID, sn_get_groups('fleet'))) {
60 60
       $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
61 61
       $intError = MARKET_NOT_A_SHIP;
62 62
       break;
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
73 73
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
74 74
 
75
-    foreach($resTemp as $resID => $resCount) {
75
+    foreach ($resTemp as $resID => $resCount) {
76 76
       $total[$resID] += $resCount;
77 77
     }
78 78
 
79 79
     $message .= "<li>{$lang['tech'][$shipID]}: " . HelperString::numberFloorAndFormat($shipCount);
80 80
   }
81 81
 
82
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
-    foreach($total as $resID => $resCount) {
84
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
+    foreach ($total as $resID => $resCount) {
84
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
85 85
         $intError = MARKET_NO_RESOURCES;
86 86
         $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
87 87
         break;
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 
92 92
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
93 93
 
94
-  if($intError == MARKET_DEAL) {
94
+  if ($intError == MARKET_DEAL) {
95 95
     $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>';
96
-    foreach($total as $resID => $resCount) {
97
-      if(!$resCount) {
96
+    foreach ($total as $resID => $resCount) {
97
+      if (!$resCount) {
98 98
         continue;
99 99
       }
100 100
 
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
       'MESSAGE' => $lang['eco_mrk_errors'][$intError],
129 129
     ));
130 130
 
131
-    foreach($shipList as $shipID => $shipCount) {
131
+    foreach ($shipList as $shipID => $shipCount) {
132 132
       $data['ships'][$shipID] = max(0, intval($shipCount));
133 133
     }
134 134
   }
135 135
 }
136 136
 $message = '';
137 137
 
138
-if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
139
-  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet'))));
138
+if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
139
+  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet'))));
140 140
 }
141 141
 
142 142
 tpl_set_resource_info($template, $planetrow, array());
143 143
 
144
-if(!$array) {
144
+if (!$array) {
145 145
   $array = array();
146 146
 }
147 147
 
148 148
 $group_fleet = sn_get_groups('fleet');
149
-foreach($array as $key => $value) {
150
-  if($mode == MARKET_SCRAPPER) {
149
+foreach ($array as $key => $value) {
150
+  if ($mode == MARKET_SCRAPPER) {
151 151
     $shipID = $value;
152 152
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
153
-  } elseif($mode == MARKET_STOCKMAN) {
153
+  } elseif ($mode == MARKET_STOCKMAN) {
154 154
     $shipID = $key;
155 155
     $amount = $value;
156 156
   }
157 157
 
158
-  if(!in_array($shipID, $group_fleet)) {
158
+  if (!in_array($shipID, $group_fleet)) {
159 159
     continue;
160 160
   }
161 161
 
162
-  if($amount > 0) {
162
+  if ($amount > 0) {
163 163
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
164 164
     $template->assign_block_vars('ships', array(
165 165
       'ID'        => $shipID,
Please login to merge, or discard this patch.
admin/settings.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 
11 11
 use Unit\DBStaticUnit;
12 12
 
13
-define('INSIDE'  , true);
14
-define('INSTALL' , false);
13
+define('INSIDE', true);
14
+define('INSTALL', false);
15 15
 define('IN_ADMIN', true);
16 16
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
17 17
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 $template = gettemplate('admin/settings', true);
23 23
 
24
-if(sys_get_param('save')) {
24
+if (sys_get_param('save')) {
25 25
   SN::$config->game_name               = sys_get_param_str_unsafe('game_name');
26 26
   SN::$config->game_mode               = sys_get_param_int('game_mode');
27 27
   SN::$config->game_speed              = sys_get_param_float('game_speed', 1);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
   SN::$config->url_faq                 = sys_get_param_str_unsafe('url_faq');
32 32
   SN::$config->url_forum               = sys_get_param_str_unsafe('url_forum');
33 33
   SN::$config->url_rules               = sys_get_param_str_unsafe('url_rules');
34
-  SN::$config->url_purchase_metamatter         = sys_get_param_str_unsafe('url_purchase_metamatter');
34
+  SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter');
35 35
   SN::$config->game_disable            = sys_get_param_int('game_disable');
36 36
   SN::$config->game_disable_reason     = sys_get_param_str_unsafe('game_disable_reason');
37 37
   SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto');
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
   SN::$config->stats_schedule          = sys_get_param_str('stats_schedule');
102 102
 
103 103
   SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period');
104
-  if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
105
-    if(SN::$config->empire_mercenary_temporary) {
104
+  if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
105
+    if (SN::$config->empire_mercenary_temporary) {
106 106
       DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished();
107 107
     } else {
108 108
       DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 tpl_assign_select($template, 'ver_response', SN::$lang['adm_opt_ver_response'], 'ID', 'NAME');
153 153
 
154 154
 $lang_list = lng_get_list();
155
-foreach($lang_list as $lang_id => $lang_data) {
155
+foreach ($lang_list as $lang_id => $lang_data) {
156 156
   $template->assign_block_vars('game_languages', array(
157 157
     'ID'   => $lang_id,
158 158
     'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})",
Please login to merge, or discard this patch.
classes/General/Helpers/PagingRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
       $this->addFirstLast();
115 115
     }
116 116
 
117
-    if(!empty($this->result)) {
117
+    if (!empty($this->result)) {
118 118
       $template = gettemplate('_paging');
119 119
       $template->assign_recursive([
120 120
         'PAGING_ROOT' => $this->rootUrl,
Please login to merge, or discard this patch.
classes/General/Helpers/URLHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
       }
20 20
     }
21 21
 
22
-    if(!empty($paramList)) {
22
+    if (!empty($paramList)) {
23 23
       $strParams = implode('&', $paramList);
24 24
     }
25 25
 
Please login to merge, or discard this patch.
classes/Common/Pimple/ServiceProviderInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@
 block discarded – undo
32 32
  * @author  Fabien Potencier
33 33
  * @author  Dominik Zogg
34 34
  */
35
-interface ServiceProviderInterface
36
-{
35
+interface ServiceProviderInterface {
37 36
     /**
38 37
      * Registers services on the given container.
39 38
      *
Please login to merge, or discard this patch.
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.