Completed
Push — work-fleets ( 77ad6e...489db6 )
by SuperNova.WS
06:17
created
includes/classes/oldArrayAccessNd.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     !is_array($offset) ? $offset = array($offset) : false;
39 39
 
40 40
     $current_leaf = $this->__get(reset($offset));
41
-    while(($leaf_index = next($offset)) !== false) {
42
-      if(!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
41
+    while (($leaf_index = next($offset)) !== false) {
42
+      if (!isset($current_leaf) || !is_array($current_leaf) || !isset($current_leaf[$leaf_index])) {
43 43
         unset($current_leaf);
44 44
         break;
45 45
       }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
     !is_array($offset) ? $offset = array($offset) : false;
66 66
 
67
-    if($this->offsetExists($offset)) {
67
+    if ($this->offsetExists($offset)) {
68 68
       $result = $this->__get(reset($offset));
69
-      while(($leaf_index = next($offset)) !== false) {
69
+      while (($leaf_index = next($offset)) !== false) {
70 70
         $result = $result[$leaf_index];
71 71
       }
72 72
     }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
    */
92 92
   public function offsetSet($offset, $value = null) {
93 93
     // Если нет никакого индекса - значит нечего записывать
94
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
94
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
95 95
       return;
96 96
     }
97 97
 
98 98
     // Если в массиве индекса только один элемент - значит это просто индекс
99
-    if(is_array($offset) && count($offset) == 1) {
99
+    if (is_array($offset) && count($offset) == 1) {
100 100
       // Разворачиваем его в индекс
101 101
       $offset = array(reset($offset) => $value);
102 102
       unset($value);
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     // Адресация многомерного массива через массив индексов в $option
107
-    if(is_array($offset) && isset($value)) {
107
+    if (is_array($offset) && isset($value)) {
108 108
       // TODO - а не переделать ли это всё на __isset() ??
109 109
 //pdump($offset, '$offset');
110 110
 //pdump($value, '$value');
111 111
       // Вытаскиваем корневой элемент
112 112
       $root = $this->__get(reset($offset));
113 113
       $current_leaf = &$root;
114
-      while(($leaf_index = next($offset)) !== false) {
114
+      while (($leaf_index = next($offset)) !== false) {
115 115
         !is_array($current_leaf[$leaf_index]) ? $current_leaf[$leaf_index] = array() : false;
116 116
         $current_leaf = &$current_leaf[$leaf_index];
117 117
       }
118 118
 //pdump($current_leaf, '$current_leaf');
119 119
 //pdump($value, '$value');
120
-      if($current_leaf != $value) {
120
+      if ($current_leaf != $value) {
121 121
         $current_leaf = $value;
122 122
 //pdump(reset($offset), 'reset($offset)');
123 123
 //pdump($root, '$root');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       // Пакетная запись из массива ключ -> значение
129 129
       !is_array($offset) ? $offset = array($offset => $value) : false;
130 130
 
131
-      foreach($offset as $key => $value) {
131
+      foreach ($offset as $key => $value) {
132 132
         $this->__get($key) !== $value ? $this->__set($key, $value) : false;
133 133
       }
134 134
     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
    */
150 150
   public function offsetUnset($offset) {
151 151
     // Если нет никакого индекса - значит нечего записывать
152
-    if(!isset($offset) || (is_array($offset) && empty($offset))) {
152
+    if (!isset($offset) || (is_array($offset) && empty($offset))) {
153 153
       return;
154 154
     }
155 155
 
156 156
     !is_array($offset) ? $offset = array($offset) : false;
157 157
 
158
-    if($this->offsetExists($offset)) {
158
+    if ($this->offsetExists($offset)) {
159 159
 //pdump($offset);
160 160
       // Перематываем массив в конец
161 161
       $key_to_delete = end($offset);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 //pdump($key_to_delete, '$key_to_delete');
164 164
       $parent_offset = $offset;
165 165
       array_pop($parent_offset);
166
-      if(!count($parent_offset)) {
166
+      if (!count($parent_offset)) {
167 167
         // В массиве был один элемент - мы удаляем в корне. Просто удаляем элемент
168 168
         $this->__unset($key_to_delete);
169 169
       } else {
Please login to merge, or discard this patch.
includes/classes/classCache.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
       default:
99 99
         switch (self::$mode) {
100 100
           case CACHER_NO_CACHE:
101
-            self::$data[$this->prefix . $name] = $value;
101
+            self::$data[$this->prefix.$name] = $value;
102 102
           break;
103 103
 
104 104
           case CACHER_XCACHE:
105
-            xcache_set($this->prefix . $name, $value);
105
+            xcache_set($this->prefix.$name, $value);
106 106
           break;
107 107
         }
108 108
       break;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
       default:
123 123
         switch (self::$mode) {
124 124
           case CACHER_NO_CACHE:
125
-            return self::$data[$this->prefix . $name];
125
+            return self::$data[$this->prefix.$name];
126 126
           break;
127 127
 
128 128
           case CACHER_XCACHE:
129
-            return xcache_get($this->prefix . $name);
129
+            return xcache_get($this->prefix.$name);
130 130
           break;
131 131
 
132 132
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
   public function __isset($name) {
140 140
     switch (self::$mode) {
141 141
       case CACHER_NO_CACHE:
142
-        return isset(self::$data[$this->prefix . $name]);
142
+        return isset(self::$data[$this->prefix.$name]);
143 143
       break;
144 144
 
145 145
       case CACHER_XCACHE:
146
-        return xcache_isset($this->prefix . $name) && ($this->__get($name) !== null);
146
+        return xcache_isset($this->prefix.$name) && ($this->__get($name) !== null);
147 147
       break;
148 148
     }
149 149
 
@@ -153,25 +153,25 @@  discard block
 block discarded – undo
153 153
   public function __unset($name) {
154 154
     switch (self::$mode) {
155 155
       case CACHER_NO_CACHE:
156
-        unset(self::$data[$this->prefix . $name]);
156
+        unset(self::$data[$this->prefix.$name]);
157 157
       break;
158 158
 
159 159
       case CACHER_XCACHE:
160
-        xcache_unset($this->prefix . $name);
160
+        xcache_unset($this->prefix.$name);
161 161
       break;
162 162
     }
163 163
   }
164 164
 
165 165
   public function unset_by_prefix($prefix_unset = '') {
166 166
     static $array_clear;
167
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
167
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
168 168
       strpos($k, $p) === 0 ? $v = null : false;
169 169
     } : false;
170 170
 
171 171
     switch (self::$mode) {
172 172
       case CACHER_NO_CACHE:
173 173
 //        array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset);
174
-        array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset);
174
+        array_walk(self::$data, $array_clear, $this->prefix.$prefix_unset);
175 175
 
176 176
         return true;
177 177
       break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
           return false;
182 182
         }
183 183
 
184
-        return xcache_unset_by_prefix($this->prefix . $prefix_unset);
184
+        return xcache_unset_by_prefix($this->prefix.$prefix_unset);
185 185
       break;
186 186
     }
187 187
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     if ($this->$name[0] === null) {
220 220
       for ($i = count($name) - 1; $i > 0; $i--) {
221 221
         $cName = "{$name[$i]}_COUNT";
222
-        $cName1 = "{$name[$i-1]}_COUNT";
222
+        $cName1 = "{$name[$i - 1]}_COUNT";
223 223
         if ($this->$cName1 == null || $i == 1) {
224 224
           $this->$cName++;
225 225
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
     for ($i = 1; $i < count($name); $i++) {
266 266
       $cName = "{$name[$i]}_COUNT";
267
-      $cName1 = "{$name[$i-1]}_COUNT";
267
+      $cName1 = "{$name[$i - 1]}_COUNT";
268 268
 
269 269
       if ($i == 1 || $this->$cName1 === null) {
270 270
         $this->$cName--;
Please login to merge, or discard this patch.
includes/classes/classConfig.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
191 191
 
192 192
     // Alliance bonus calculations
193
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
193
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
194 194
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
195
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
195
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
196 196
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
197 197
     'ali_bonus_members'            => 10, // Minumum alliace size to start using bonus
198 198
 
@@ -223,25 +223,25 @@  discard block
 block discarded – undo
223 223
     'deuterium_basic_income'       => 0,
224 224
     'eco_scale_storage'            => 1,
225 225
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
226
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
226
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
227 227
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
228 228
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
229 229
     'energy_basic_income'          => 0,
230 230
 
231 231
     // Bashing protection settings
232
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
233
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
234
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
235
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
236
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
232
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
233
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
234
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
235
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
236
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
237 237
 
238 238
     'Fleet_Cdr'   => 30,
239 239
     'fleet_speed' => 1,
240 240
 
241 241
     'fleet_update_interval' => 4,
242 242
 
243
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
244
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
243
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
244
+    'game_counter'          => 0, // Does built-in page hit counter is on?
245 245
     // Defaults
246 246
     'game_default_language' => 'ru',
247 247
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
     'game_maxSystem'      => 199,
256 256
     'game_maxPlanet'      => 15,
257 257
     // Game global settings
258
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
258
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
259 259
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
260 260
 
261 261
     'game_news_actual'   => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days
262
-    'game_news_overview' => 3,    // How much last news to show in Overview page
262
+    'game_news_overview' => 3, // How much last news to show in Overview page
263 263
     // Noob protection
264
-    'game_noob_factor'   => 5,    // Multiplier to divide "stronger" and "weaker" users
264
+    'game_noob_factor'   => 5, // Multiplier to divide "stronger" and "weaker" users
265 265
     'game_noob_points'   => 5000, // Below this point user threated as noob. 0 to disable
266 266
 
267 267
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
     'payment_currency_exchange_wmu' => 30,
312 312
     'payment_currency_exchange_wmz' => 1,
313 313
 
314
-    'payment_lot_price' => 1,     // Lot price in default currency
315
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
314
+    'payment_lot_price' => 1, // Lot price in default currency
315
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
316 316
 
317 317
     'planet_teleport_cost'    => 50000, //
318 318
     'planet_teleport_timeout' => 86400, //
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     'resource_multiplier'     => 1,
331 331
 
332 332
     //Roleplay system
333
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
333
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
334 334
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
335 335
 
336 336
     // Black Market - General
Please login to merge, or discard this patch.
includes/classes/template_compile.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         'template_data'     => trim(@file_get_contents($this->template->files[$handle])),
92 92
       );
93 93
 
94
-      $sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
94
+      $sql = 'INSERT INTO '.STYLES_TEMPLATE_DATA_TABLE.' '.$db->sql_build_array('INSERT', $sql_ary);
95 95
       $db->sql_query($sql);
96 96
     }
97 97
   }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
140 140
     $include_blocks = $matches[1];
141
-    if($include_blocks)
141
+    if ($include_blocks)
142 142
     {
143
-      foreach($include_blocks as &$included_file)
143
+      foreach ($include_blocks as &$included_file)
144 144
       {
145 145
         $included_file .= '.tpl.html';
146 146
       }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
       {
170 170
         case 'BEGIN':
171 171
           $this->block_else_level[] = false;
172
-          $compile_blocks[] = '<?php ' . $this->compile_tag_block($block_val[2]) . ' ?>';
172
+          $compile_blocks[] = '<?php '.$this->compile_tag_block($block_val[2]).' ?>';
173 173
         break;
174 174
 
175 175
         case 'BEGINELSE':
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
         case 'END':
181 181
           array_pop($this->block_names);
182
-          $compile_blocks[] = '<?php ' . ((array_pop($this->block_else_level)) ? '}' : '}}') . ' ?>';
182
+          $compile_blocks[] = '<?php '.((array_pop($this->block_else_level)) ? '}' : '}}').' ?>';
183 183
         break;
184 184
 
185 185
         case 'IF':
186
-          $compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], false) . ' ?>';
186
+          $compile_blocks[] = '<?php '.$this->compile_tag_if($block_val[2], false).' ?>';
187 187
         break;
188 188
 
189 189
         case 'ELSE':
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         break;
192 192
 
193 193
         case 'ELSEIF':
194
-          $compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], true) . ' ?>';
194
+          $compile_blocks[] = '<?php '.$this->compile_tag_if($block_val[2], true).' ?>';
195 195
         break;
196 196
 
197 197
         case 'ENDIF':
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
         break;
200 200
 
201 201
         case 'DEFINE':
202
-          $compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], true) . ' ?>';
202
+          $compile_blocks[] = '<?php '.$this->compile_tag_define($block_val[2], true).' ?>';
203 203
         break;
204 204
 
205 205
         case 'UNDEFINE':
206
-          $compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], false) . ' ?>';
206
+          $compile_blocks[] = '<?php '.$this->compile_tag_define($block_val[2], false).' ?>';
207 207
         break;
208 208
 
209 209
         case 'INCLUDE':
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             $file = $temp;
235 235
           }
236 236
 
237
-          $compile_blocks[] = '<?php ' . $this->compile_tag_include($temp) . ' ?>';
237
+          $compile_blocks[] = '<?php '.$this->compile_tag_include($temp).' ?>';
238 238
 
239 239
           // No point in checking variable includes
240 240
           if ($file)
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
         break;
245 245
 
246 246
         case 'INCLUDEPHP':
247
-          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php ' . $this->compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>' : '';
247
+          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php '.$this->compile_tag_include_php(array_shift($includephp_blocks)).' ?>' : '';
248 248
         break;
249 249
 
250 250
         case 'PHP':
251
-          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php ' . array_shift($php_blocks) . ' ?>' : '';
251
+          $compile_blocks[] = (classSupernova::$config->tpl_allow_php) ? '<?php '.array_shift($php_blocks).' ?>' : '';
252 252
         break;
253 253
 
254 254
         default:
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++)
264 264
     {
265 265
       $trim_check_text = trim($text_blocks[$i]);
266
-      $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
266
+      $template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '').((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '').((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
267 267
     }
268 268
 
269 269
     // Remove unused opening/closing tags
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     // we'll strip out such occurences, minimising such switching
279 279
     if ($no_echo)
280 280
     {
281
-      return "\$$echo_var .= '" . $template_php . "'";
281
+      return "\$$echo_var .= '".$template_php."'";
282 282
     }
283 283
 
284 284
     return $template_php;
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
 
374 374
       if ($match[2] < 0)
375 375
       {
376
-        $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
376
+        $loop_start = '($_'.$tag_args.'_count '.$match[2].' < 0 ? 0 : $_'.$tag_args.'_count '.$match[2].')';
377 377
       }
378 378
       else
379 379
       {
380
-        $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
380
+        $loop_start = '($_'.$tag_args.'_count < '.$match[2].' ? $_'.$tag_args.'_count : '.$match[2].')';
381 381
       }
382 382
 
383 383
       if (strlen($match[3]) < 1 || $match[3] == -1)
384 384
       {
385
-        $loop_end = '$_' . $tag_args . '_count';
385
+        $loop_end = '$_'.$tag_args.'_count';
386 386
       }
387 387
       else if ($match[3] >= 0)
388 388
       {
389
-        $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
389
+        $loop_end = '('.($match[3] + 1).' > $_'.$tag_args.'_count ? $_'.$tag_args.'_count : '.($match[3] + 1).')';
390 390
       }
391 391
       else //if ($match[3] < -1)
392 392
       {
393
-        $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
393
+        $loop_end = '$_'.$tag_args.'_count'.($match[3] + 1);
394 394
       }
395 395
     }
396 396
     else
397 397
     {
398 398
       $loop_start = 0;
399
-      $loop_end = '$_' . $tag_args . '_count';
399
+      $loop_end = '$_'.$tag_args.'_count';
400 400
     }
401 401
 
402 402
     $tag_template_php = '';
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     if (sizeof($block) < 2)
416 416
     {
417 417
       // Block is not nested.
418
-      $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
418
+      $tag_template_php = '$_'.$tag_args."_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
419 419
       $varref = "\$this->_tpldata['$tag_args']";
420 420
     }
421 421
     else
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
       $varref = $this->generate_block_data_ref($namespace, false);
430 430
 
431 431
       // Create the for loop code to iterate over this block.
432
-      $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
432
+      $tag_template_php = '$_'.$tag_args.'_count = (isset('.$varref.')) ? sizeof('.$varref.') : 0;';
433 433
     }
434 434
 
435
-    $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
435
+    $tag_template_php .= 'if ($_'.$tag_args.'_count) {';
436 436
 
437 437
     /**
438 438
     * 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
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
     * </code>
445 445
     */
446 446
 
447
-    $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
447
+    $tag_template_php .= 'for ($_'.$tag_args.'_i = '.$loop_start.'; $_'.$tag_args.'_i < '.$loop_end.'; ++$_'.$tag_args.'_i){';
448 448
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
449
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
450
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
449
+    $tag_template_php .= '$_'.$tag_args.'_val = &'.$varref.'[$_'.$tag_args.'_i];';
450
+    $tag_template_php .= '$this->_block_value["'.$tag_args.'"] = &'.$varref.'[$_'.$tag_args.'_i];';
451 451
 
452 452
     return $tag_template_php;
453 453
   }
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
         break;
552 552
 
553 553
         case 'is':
554
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
554
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
555 555
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
556 556
 
557
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
557
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
558 558
 
559 559
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
560 560
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         default:
566 566
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
567 567
           {
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] . '\']');
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].'\']');
569 569
           }
570 570
           else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571 571
           {
@@ -582,20 +582,20 @@  discard block
 block discarded – undo
582 582
               $varref = $this->generate_block_data_ref($namespace, true);
583 583
 
584 584
               // Add the block reference for the last child.
585
-              $varref .= "['" . $block . "']";
585
+              $varref .= "['".$block."']";
586 586
             }
587 587
             else
588 588
             {
589 589
               $varref = '$this->_tpldata';
590 590
 
591 591
               // Add the block reference for the last child.
592
-              $varref .= "['" . $blocks[0] . "']";
592
+              $varref .= "['".$blocks[0]."']";
593 593
             }
594 594
             $token = "sizeof($varref)";
595 595
           }
596 596
           else if (!empty($token))
597 597
           {
598
-            $token = '(' . $token . ')';
598
+            $token = '('.$token.')';
599 599
           }
600 600
 
601 601
         break;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
     {
608 608
       $tokens = array('false');
609 609
     }
610
-    return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
610
+    return (($elseif) ? '} else if (' : 'if (').(implode(' ', $tokens).') { ');
611 611
   }
612 612
 
613 613
   /**
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
     if (!$op)
627 627
     {
628
-      return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
628
+      return 'unset('.(($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true).'[\''.$match[2].'\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\''.$match[2].'\']').');';
629 629
     }
630 630
 
631 631
     // Are we a string?
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
       $match[4] = $this->compile($match[4]);
638 638
 
639 639
       // Now replace the php code
640
-      $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
640
+      $match[4] = "'".str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4])."'";
641 641
     }
642 642
     else
643 643
     {
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
       }
661 661
     }
662 662
 
663
-    return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
663
+    return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true).'[\''.$match[2].'\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\''.$match[2].'\']').' = '.$match[4].';';
664 664
   }
665 665
 
666 666
   /**
@@ -801,24 +801,24 @@  discard block
 block discarded – undo
801 801
       // Build up the string with everything but the last child.
802 802
       for ($i = 0; $i < $blockcount; $i++)
803 803
       {
804
-        $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
804
+        $varref .= "['".$blocks[$i]."'][\$_".$blocks[$i].'_i]';
805 805
       }
806 806
       // Add the block reference for the last child.
807
-      $varref .= "['" . $blocks[$blockcount] . "']";
807
+      $varref .= "['".$blocks[$blockcount]."']";
808 808
       // Add the iterator for the last child if requried.
809 809
       if ($include_last_iterator)
810 810
       {
811
-        $varref .= '[$_' . $blocks[$blockcount] . '_i]';
811
+        $varref .= '[$_'.$blocks[$blockcount].'_i]';
812 812
       }
813 813
       return $varref;
814 814
     }
815 815
     else if ($include_last_iterator)
816 816
     {
817
-      return '$_'. $blocks[$blockcount] . '_val';
817
+      return '$_'.$blocks[$blockcount].'_val';
818 818
     }
819 819
     else
820 820
     {
821
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
821
+      return '$_'.$blocks[$blockcount - 1].'_val[\''.$blocks[$blockcount].'\']';
822 822
     }
823 823
   }
824 824
 
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
   */
829 829
   function compile_write($handle, $data)
830 830
   {
831
-    $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
831
+    $filename = $this->template->cachepath.str_replace('/', '.', $this->template->filename[$handle]).DOT_PHP_EX;
832 832
 
833
-    $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
833
+    $data = "<?php if (!defined('INSIDE')) exit;".((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>'.$data);
834 834
 
835 835
     if ($fp = @fopen($filename, 'wb'))
836 836
     {
837 837
       @flock($fp, LOCK_EX);
838
-      @fwrite ($fp, $data);
838
+      @fwrite($fp, $data);
839 839
       @flock($fp, LOCK_UN);
840 840
       @fclose($fp);
841 841
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
   */
853 853
   private function minify($html)
854 854
   {
855
-    if(!classSupernova::$config->tpl_minifier)
855
+    if (!classSupernova::$config->tpl_minifier)
856 856
     {
857 857
       return $html;
858 858
     }
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
     $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html);
863 863
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
864 864
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
865
-    if(!empty($pre[0]))
865
+    if (!empty($pre[0]))
866 866
     {
867
-      foreach($pre[0] as $tag)
867
+      foreach ($pre[0] as $tag)
868 868
       {
869 869
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
870 870
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
871 871
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
872
-        $html = preg_replace('/#pre#/', $tag, $html,1);
872
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
873 873
       }
874 874
     }
875 875
 
Please login to merge, or discard this patch.
includes/includes/upd_helpers.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
   // classSupernova::$db->sn_db_connect();
16 16
   if (!(strpos($query, '{{') === false)) {
17 17
     foreach ($update_tables as $tableName => $cork) {
18
-      $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query);
18
+      $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix.$tableName, $query);
19 19
     }
20 20
   }
21
-  !($result = classSupernova::$db->db_sql_query($query)) ? die('Query error for ' . $query . ': ' . classSupernova::$db->db_error()) : false;
21
+  !($result = classSupernova::$db->db_sql_query($query)) ? die('Query error for '.$query.': '.classSupernova::$db->db_error()) : false;
22 22
 
23 23
   return $result;
24 24
 }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
   global $update_tables, $update_indexes, $update_indexes_full, $update_foreigns;
86 86
 
87 87
   $tableName = $prefixed ? str_replace(classSupernova::$config->db_prefix, '', $prefix_table_name) : $prefix_table_name;
88
-  $prefix_table_name = $prefixed ? $prefix_table_name : classSupernova::$config->db_prefix . $prefix_table_name;
88
+  $prefix_table_name = $prefixed ? $prefix_table_name : classSupernova::$config->db_prefix.$prefix_table_name;
89 89
 
90 90
   upd_unset_table_info($tableName);
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1;
101 101
   }
102 102
 
103
-  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
+  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '".db_escape(classSupernova::$db_name)."' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
104 104
   while ($r1 = db_fetch($q1)) {
105 105
     $table_referenced = str_replace(classSupernova::$config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']);
106 106
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$db_prefix}{$table_name}` {$declaration}");
161 161
     $error = classSupernova::$db->db_error();
162 162
     if ($error) {
163
-      die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration));
163
+      die("Creating error for table `{$table_name}`: {$error}<br />".dump($declaration));
164 164
     }
165 165
     upd_do_query('set foreign_key_checks = 1;', true);
166 166
     upd_load_table_info($table_name, false);
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
     "SELECT {$fields}
176 176
     FROM {{unit}}
177 177
     WHERE
178
-      `unit_location_type` = {$location_type} AND `unit_location_id` = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions() .
179
-    ($user_id = intval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') .
180
-    ($unit_snid = intval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '') .
181
-    " LIMIT 1" .
178
+      `unit_location_type` = {$location_type} AND `unit_location_id` = {$location_id} AND ".DBStaticUnit::db_unit_time_restrictions().
179
+    ($user_id = intval($user_id) ? " AND `unit_player_id` = {$user_id}" : '').
180
+    ($unit_snid = intval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '').
181
+    " LIMIT 1".
182 182
     ($for_update ? ' FOR UPDATE' : '')
183 183
   ));
184 184
 }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     foreach ($table_data as $record_id => $conditions) {
260 260
       $where = '';
261 261
       if (!empty($conditions['where'])) {
262
-        $where = 'WHERE ' . implode(' AND ', $conditions['where']);
262
+        $where = 'WHERE '.implode(' AND ', $conditions['where']);
263 263
       }
264 264
 
265 265
       $fields = array();
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
           $condition = "`{$field_name}` = ";
269 269
           $value = '';
270 270
           if ($field_data['delta']) {
271
-            $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
271
+            $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta'];
272 272
           } elseif ($field_data['set']) {
273 273
             $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
274 274
           }
275 275
           if ($value) {
276
-            $fields[] = $condition . $value;
276
+            $fields[] = $condition.$value;
277 277
           }
278 278
         }
279 279
       }
Please login to merge, or discard this patch.
includes/classes/FleetValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     'checkSpeedPercentOld'       => FLIGHT_FLEET_SPEED_WRONG,
15 15
     'checkTargetInUniverse'      => FLIGHT_VECTOR_BEYOND_UNIVERSE,
16 16
     'checkTargetNotSource'       => FLIGHT_VECTOR_SAME_SOURCE,
17
-    'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN,  // tODO
17
+    'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN, // tODO
18 18
     'checkTargetNoVacation'      => FLIGHT_PLAYER_VACATION,
19 19
     'checkFleetNotEmpty'         => FLIGHT_SHIPS_NO_SHIPS,
20 20
     // 'checkUnitsPositive'         => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
       $checkResult = call_user_func(array($this, $condition));
135 135
       defined('DEBUG_FLEET_MISSION_VALIDATE_DUMP_STEPS')
136
-        ? pdump($action, $condition . ' ' . ($checkResult ? 'TRUE' : 'FALSE')) : false;
136
+        ? pdump($action, $condition.' '.($checkResult ? 'TRUE' : 'FALSE')) : false;
137 137
 
138 138
       // If check failed and there no alternative actions - throw exception
139 139
       // Shortcut ACTION => FAIL_STATUS instead of ACTION => array(false => FAIL_STATUS)
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $this->checkMissionRestrictions($action);
157 157
       } else {
158 158
         // No - then just performing action
159
-        if($exception) {
159
+        if ($exception) {
160 160
           throw new ExceptionFleetInvalid($action, $action);
161 161
         } else {
162 162
           return $action;
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
   protected function checkMissionPrefix($name, $prefix) {
599 599
     $result = false;
600 600
     if (strpos($name, $prefix) === 0) {
601
-      $mission = 'MT_' . strtoupper(substr($name, strlen($prefix)));
601
+      $mission = 'MT_'.strtoupper(substr($name, strlen($prefix)));
602 602
       if (!defined($mission)) {
603 603
         // TODO - Ну, как-то получше это обделать
604
-        throw new Exception('Mission type "' . $mission . '" is not defined', FLIGHT_MISSION_UNKNOWN);
604
+        throw new Exception('Mission type "'.$mission.'" is not defined', FLIGHT_MISSION_UNKNOWN);
605 605
       }
606 606
 
607 607
       $result = constant($mission);
Please login to merge, or discard this patch.
includes/classes/Mission/MissionFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
    * @throws ExceptionFleetInvalid
35 35
    */
36 36
   public static function build($missionType, $fleet) {
37
-    if (!empty(self::$missions[$missionType]) && class_exists($className = __NAMESPACE__ . '\\' . self::$missions[$missionType])) {
37
+    if (!empty(self::$missions[$missionType]) && class_exists($className = __NAMESPACE__.'\\'.self::$missions[$missionType])) {
38 38
       $result = new $className($fleet);
39 39
     } else {
40 40
       throw new ExceptionFleetInvalid("Mission type {$missionType} unknown", FLIGHT_MISSION_UNKNOWN);
Please login to merge, or discard this patch.
includes/classes/Fleet.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -414,31 +414,31 @@  discard block
 block discarded – undo
414 414
 
415 415
     return doquery(
416 416
     // Блокировка самого флота
417
-      "SELECT 1 FROM {{fleets}} AS f " .
417
+      "SELECT 1 FROM {{fleets}} AS f ".
418 418
 
419 419
       // Блокировка всех юнитов, принадлежащих этому флоту
420
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
420
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
421 421
 
422 422
       // Блокировка всех прилетающих и улетающих флотов, если нужно
423 423
       // TODO - lock fleets by COORDINATES
424
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
424
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
425 425
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
426
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
426
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
427 427
 
428
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
428
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
429 429
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
430
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
430
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
431 431
       // Блокировка планеты-цели
432
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
432
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
433 433
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
434 434
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
435 435
 
436 436
 
437
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
437
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
438 438
       // Блокировка всех юнитов, принадлежащих владельцу флота
439
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
439
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
440 440
       // Блокировка планеты отправления
441
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
441
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
442 442
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
443 443
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
444 444
 
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
   public function dbGetLockById($dbId) {
456 456
     doquery(
457 457
     // Блокировка самого флота
458
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
458
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
459 459
       // Lock fleet owner
460
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
460
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
461 461
       // Блокировка всех юнитов, принадлежащих этому флоту
462
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
462
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
463 463
 
464 464
       // Без предварительной выборки неизвестно - куда летит этот флот.
465 465
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -475,9 +475,9 @@  discard block
 block discarded – undo
475 475
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
476 476
       " .
477 477
       // Блокировка всех юнитов, принадлежащих этим флотам
478
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
478
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
479 479
       // Lock fleet owner
480
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
480
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
481 481
 
482 482
       "LEFT JOIN {{fleets}} AS FLEET2 ON
483 483
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
       " .
488 488
       // Блокировка всех юнитов, принадлежащих этим флотам
489 489
       "LEFT JOIN {{unit}} as UNIT2 ON
490
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
490
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
491 491
         UNIT2.unit_location_id = FLEET2.fleet_id
492 492
       " .
493 493
       // Lock fleet owner
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
       " .
505 505
       // Блокировка всех юнитов, принадлежащих этим флотам
506 506
       "LEFT JOIN {{unit}} as UNIT3 ON
507
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
507
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
508 508
         UNIT3.unit_location_id = FLEET3.fleet_id
509 509
       " .
510 510
       // Lock fleet owner
511
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
511
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
512 512
 
513 513
       "LEFT JOIN {{fleets}} AS FLEET4 ON
514 514
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
       " .
519 519
       // Блокировка всех юнитов, принадлежащих этим флотам
520 520
       "LEFT JOIN {{unit}} as UNIT4 ON
521
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
521
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
522 522
         UNIT4.unit_location_id = FLEET4.fleet_id
523 523
       " .
524 524
       // Lock fleet owner
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
       " .
541 541
       // Блокировка всех юнитов, принадлежащих этой планете
542 542
       "LEFT JOIN {{unit}} as UNIT5 ON
543
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
543
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
544 544
         UNIT5.unit_location_id = PLANETS5.id
545 545
       " .
546 546
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
       " .
559 559
       // Блокировка всех юнитов, принадлежащих этой планете
560 560
       "LEFT JOIN {{unit}} as UNIT6 ON
561
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
561
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
562 562
         UNIT6.unit_location_id = PLANETS6.id
563 563
       " .
564 564
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
       } elseif ($this->isResource($unit_id)) {
678 678
         $this->resource_list[$unit_id] = $unit_count;
679 679
       } else {
680
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
680
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), FLIGHT_SHIPS_UNIT_WRONG);
681 681
       }
682 682
     }
683 683
   }
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
    * @param int $unit_count
812 812
    */
813 813
   public function shipSetCount($unit_id, $unit_count = 0) {
814
-    pdump(__CLASS__ . '->' . __FUNCTION__);
814
+    pdump(__CLASS__.'->'.__FUNCTION__);
815 815
     $this->shipAdjustCount($unit_id, $unit_count, true);
816 816
   }
817 817
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
    */
1020 1020
   public function resourcesSet($resource_list) {
1021 1021
     if (!empty($this->propertiesAdjusted['resource_list'])) {
1022
-      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
1022
+      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
1023 1023
     }
1024 1024
     $this->resourcesAdjust($resource_list, true);
1025 1025
   }
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
       // Check for negative unit value
1054 1054
       if ($this->resource_list[$resource_id] < 0) {
1055 1055
         // TODO
1056
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1056
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1057 1057
       }
1058 1058
     }
1059 1059
   }
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 
1235 1235
   protected function printErrorIfNoShips() {
1236 1236
     if ($this->unitList->unitsCount() <= 0) {
1237
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
1237
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
1238 1238
     }
1239 1239
   }
1240 1240
 
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
       if (FLIGHT_ALLOWED == $validateResult[$missionType]) {
1623 1623
         $this->allowed_missions[$missionType] = $mission;
1624 1624
       } else {
1625
-        if($missionType == $this->mission_type) {
1625
+        if ($missionType == $this->mission_type) {
1626 1626
         }
1627 1627
         unset($this->allowed_missions[$missionType]);
1628 1628
       }
@@ -1630,8 +1630,8 @@  discard block
 block discarded – undo
1630 1630
 //    print('asd');
1631 1631
 //var_dump($this->allowed_missions);
1632 1632
 //    print('выф');
1633
-    if(empty($this->allowed_missions)) {
1634
-      if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1633
+    if (empty($this->allowed_missions)) {
1634
+      if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) {
1635 1635
         throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]);
1636 1636
       } else {
1637 1637
         throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE);
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 
1845 1845
 
1846 1846
     if (!empty($this->captain['unit_id'])) {
1847
-      DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}");
1847
+      DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}");
1848 1848
     }
1849 1849
 
1850 1850
 //    return $this->fleet->acs['ankunft'] - $this->fleet->time_launch >= $this->fleet->travelData['duration'];
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
     $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob);
1857 1857
 
1858 1858
     $template_result += array(
1859
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1859
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1860 1860
       'dist'            => pretty_number($this->travelData['distance']),
1861 1861
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1862 1862
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.
includes/classes/sn_module.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
   }
73 73
 
74 74
   function loadModuleRootConfig() {
75
-    require SN_ROOT_PHYSICAL . 'config.php';
75
+    require SN_ROOT_PHYSICAL.'config.php';
76 76
 
77
-    $module_config_array = get_class($this) . '_config';
78
-    if(!empty($$module_config_array) && is_array($$module_config_array)) {
77
+    $module_config_array = get_class($this).'_config';
78
+    if (!empty($$module_config_array) && is_array($$module_config_array)) {
79 79
       $this->config = $$module_config_array;
80 80
 
81 81
       return true;
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 
94 94
     // TODO: Load configuration from DB. Manifest setting
95 95
     // Trying to load configuration from file
96
-    if(!$config_exists = $this->loadModuleRootConfig()) {
96
+    if (!$config_exists = $this->loadModuleRootConfig()) {
97 97
       // Конфигурация может лежать в config_path в манифеста или в корне модуля
98
-      if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) {
98
+      if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'].'/config.php')) {
99 99
         $config_exists = true;
100
-      } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) {
100
+      } elseif (file_exists($config_filename = dirname($filename).'/config.php')) {
101 101
         $config_exists = true;
102 102
       }
103 103
 
104
-      if($config_exists) {
104
+      if ($config_exists) {
105 105
         include($config_filename);
106
-        $module_config_array = $class_module_name . '_config';
106
+        $module_config_array = $class_module_name.'_config';
107 107
         $this->config = $$module_config_array;
108 108
       }
109 109
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     // Checking module status - is it installed and active
120 120
     $this->check_status();
121
-    if(!$this->manifest['active']) {
121
+    if (!$this->manifest['active']) {
122 122
       return;
123 123
     }
124 124
 
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 
139 139
   protected function setSystemConstants() {
140 140
     // Setting constants - if any
141
-    if(empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
141
+    if (empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) {
142 142
       return;
143 143
     }
144 144
 
145
-    foreach($this->manifest['constants'] as $constant_name => $constant_value) {
145
+    foreach ($this->manifest['constants'] as $constant_name => $constant_value) {
146 146
       !defined($constant_name) ? define($constant_name, $constant_value) : false;
147 147
     }
148 148
   }
@@ -154,48 +154,48 @@  discard block
 block discarded – undo
154 154
     // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays)
155 155
     // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]'
156 156
     $this->manifest['vars'] = $this->__assign_vars();
157
-    if(empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
157
+    if (empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) {
158 158
       return;
159 159
     }
160 160
 
161 161
     $vars_assigned = array();
162
-    foreach($this->manifest['vars'] as $var_name => $var_value) {
162
+    foreach ($this->manifest['vars'] as $var_name => $var_value) {
163 163
       $sub_vars = explode('[', str_replace(']', '', $var_name));
164 164
       $var_name = $sub_vars[0];
165 165
 
166
-      if(!isset($vars_assigned[$var_name])) {
166
+      if (!isset($vars_assigned[$var_name])) {
167 167
         $vars_assigned[$var_name] = true;
168 168
         global $$var_name;
169 169
       }
170 170
 
171 171
       $pointer = &$$var_name;
172
-      if(($n = count($sub_vars)) > 1) {
173
-        for($i = 1; $i < $n; $i++) {
174
-          if(defined($sub_vars[$i])) {
172
+      if (($n = count($sub_vars)) > 1) {
173
+        for ($i = 1; $i < $n; $i++) {
174
+          if (defined($sub_vars[$i])) {
175 175
             $sub_vars[$i] = constant($sub_vars[$i]);
176 176
           }
177 177
 
178
-          if(!isset($pointer[$sub_vars[$i]]) && $i != $n) {
178
+          if (!isset($pointer[$sub_vars[$i]]) && $i != $n) {
179 179
             $pointer[$sub_vars[$i]] = array();
180 180
           }
181 181
           $pointer = &$pointer[$sub_vars[$i]];
182 182
         }
183 183
       }
184 184
 
185
-      if(!isset($pointer) || !is_array($pointer)) {
185
+      if (!isset($pointer) || !is_array($pointer)) {
186 186
         $pointer = $var_value;
187
-      } elseif(is_array($$var_name)) {
187
+      } elseif (is_array($$var_name)) {
188 188
         $pointer = array_merge_recursive_numeric($pointer, $var_value);
189 189
       }
190 190
     }
191 191
   }
192 192
 
193 193
   protected function mergeMenu(&$sn_menu_extra, &$menu_patch) {
194
-    if(!is_array($menu_patch)) {
194
+    if (!is_array($menu_patch)) {
195 195
       return;
196 196
     }
197 197
 
198
-    foreach($menu_patch as $menu_item_name => $menu_item_data) {
198
+    foreach ($menu_patch as $menu_item_name => $menu_item_data) {
199 199
       $sn_menu_extra[$menu_item_name] = $menu_item_data;
200 200
     }
201 201
   }
@@ -204,34 +204,34 @@  discard block
 block discarded – undo
204 204
     // Overriding function if any
205 205
     sn_sys_handler_add(classSupernova::$functions, $this->manifest['functions'], $this);
206 206
 
207
-    foreach(classSupernova::$sn_mvc as $handler_type => &$handler_data) {
207
+    foreach (classSupernova::$sn_mvc as $handler_type => &$handler_data) {
208 208
       sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type);
209 209
     }
210 210
   }
211 211
 
212 212
   protected function mergeNavbarButton() {
213
-    if(empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
213
+    if (empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) {
214 214
       return;
215 215
     }
216 216
 
217
-    foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
217
+    foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) {
218 218
       classSupernova::$sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative;
219 219
     }
220 220
   }
221 221
 
222 222
   protected function mergeI18N() {
223 223
     $arrayName = 'i18n';
224
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
224
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
225 225
       return;
226 226
     }
227 227
 
228
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
229
-      foreach($contentList as &$i18n_file_data) {
230
-        if(is_array($i18n_file_data) && !$i18n_file_data['path']) {
228
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
229
+      foreach ($contentList as &$i18n_file_data) {
230
+        if (is_array($i18n_file_data) && !$i18n_file_data['path']) {
231 231
           $i18n_file_data['path'] = $this->manifest['root_relative'];
232 232
         }
233 233
       }
234
-      if(!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) {
234
+      if (!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) {
235 235
         classSupernova::$sn_mvc[$arrayName][$pageName] = array();
236 236
       }
237 237
       classSupernova::$sn_mvc[$arrayName][$pageName] += $contentList;
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
   }
240 240
 
241 241
   protected function mergeArraySpecial($arrayName) {
242
-    if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
242
+    if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) {
243 243
       return;
244 244
     }
245 245
 
246
-    foreach($this->manifest[$arrayName] as $pageName => &$contentList) {
246
+    foreach ($this->manifest[$arrayName] as $pageName => &$contentList) {
247 247
       !isset(classSupernova::$sn_mvc[$arrayName][$pageName]) ? classSupernova::$sn_mvc[$arrayName][$pageName] = array() : false;
248
-      foreach($contentList as $contentName => &$content) {
248
+      foreach ($contentList as $contentName => &$content) {
249 249
         classSupernova::$sn_mvc[$arrayName][$pageName][$contentName] = $content;
250 250
       }
251 251
     }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
           $load_order[$loaded_module_name] = $level;
300 300
         }
301 301
       }
302
-    } while($prev_order != $load_order);
302
+    } while ($prev_order != $load_order);
303 303
 
304 304
     asort($load_order);
305 305
 
Please login to merge, or discard this patch.