Test Failed
Push — master ( 247090...f61425 )
by SuperNova.WS
18:56 queued 11:23
created
classes/Core/SnBootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 class SnBootstrap {
12 12
 
13 13
   public static function install_benchmark() {
14
-    register_shutdown_function(function () {
14
+    register_shutdown_function(function() {
15 15
       if (defined('IN_AJAX')) {
16 16
         return;
17 17
       }
Please login to merge, or discard this patch.
resources.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 // $BuildEnergyTech             = $user['energy_tech'];
113 113
 for ($Option = 10; $Option >= 0; $Option--)
114 114
 {
115
- $template->assign_block_vars('option', array(
116
-   'VALUE' => $Option * 10,
117
- ));
115
+  $template->assign_block_vars('option', array(
116
+    'VALUE' => $Option * 10,
117
+  ));
118 118
 }
119 119
 
120 120
 $capsObj = new ResourceCalculations();
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 int_calc_storage_bar(RES_DEUTERIUM, $capsObj);
181 181
 
182 182
 $template->assign_vars(array(
183
- 'PLANET_NAME'          => $planetrow['name'],
184
- 'PLANET_TYPE'          => $planetrow['planet_type'],
183
+  'PLANET_NAME'          => $planetrow['name'],
184
+  'PLANET_TYPE'          => $planetrow['planet_type'],
185 185
 
186
- 'PRODUCTION_LEVEL'     => floor($capsObj->efficiency * 100),
186
+  'PRODUCTION_LEVEL'     => floor($capsObj->efficiency * 100),
187 187
 
188
- 'PAGE_HINT'            => $lang['res_hint'],
188
+  'PAGE_HINT'            => $lang['res_hint'],
189 189
 ));
190 190
 
191 191
 SnTemplate::display($template, $lang['res_planet_production']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
   ]);
53 53
 };
54 54
 
55
-$ValidList['percent'] = array (  0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100 );
55
+$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
56 56
 $template = SnTemplate::gettemplate('resources', true);
57 57
 
58 58
 /** @noinspection PhpUnhandledExceptionInspection */
59 59
 $planet = SN::$gc->repoV2->getPlanet($planetrow['id']);
60
-if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) {
60
+if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) {
61 61
   $template->assign_block_vars('result', $transmutation_result);
62 62
   $planet->dbLoadRecord($planetrow['id']);
63 63
 }
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
   'ENERGY_TYPE'    => $capsObj->productionCurrentMatrix[RES_ENERGY][0],
130 130
 ));
131 131
 
132
-foreach($sn_group_factories as $unit_id)
132
+foreach ($sn_group_factories as $unit_id)
133 133
 {
134
-  if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id))
134
+  if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id))
135 135
   {
136 136
     $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true);
137 137
     $template->assign_block_vars('production', array(
Please login to merge, or discard this patch.
classes/General/Helpers/PagingRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
       $this->addFirstLast();
116 116
     }
117 117
 
118
-    if(!empty($this->result)) {
118
+    if (!empty($this->result)) {
119 119
       $template = SnTemplate::gettemplate('_paging');
120 120
       $template->assign_recursive([
121 121
         'PAGING_ROOT' => $this->rootUrl,
Please login to merge, or discard this patch.
classes/template_compile.php 1 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
     {
@@ -69,8 +67,7 @@  discard block
 block discarded – undo
69 67
 
70 68
         return;
71 69
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
72
-      }
73
-      else
70
+      } else
74 71
       {
75 72
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
76 73
       }
@@ -106,8 +103,7 @@  discard block
 block discarded – undo
106 103
   * the ones that exist in zend_language_scanner.l
107 104
   * @access private
108 105
   */
109
-  function remove_php_tags(&$code)
110
-  {
106
+  function remove_php_tags(&$code) {
111 107
     // This matches the information gathered from the internal PHP lexer
112 108
     $match = array(
113 109
       '#<([\?%])=?.*?\1>#s',
@@ -122,8 +118,7 @@  discard block
 block discarded – undo
122 118
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
123 119
   * @access private
124 120
   */
125
-  function compile($code, $no_echo = false, $echo_var = '')
126
-  {
121
+  function compile($code, $no_echo = false, $echo_var = '') {
127 122
     if ($echo_var)
128 123
     {
129 124
       global $$echo_var;
@@ -226,15 +221,13 @@  discard block
 block discarded – undo
226 221
               $var = substr($temp, 2, -1);
227 222
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
228 223
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
229
-            }
230
-            else
224
+            } else
231 225
             {
232 226
               $var = substr($temp, 1, -1);
233 227
               //$file = $this->template->_rootref[$var];
234 228
               $temp = "\$this->_rootref['$var']";
235 229
             }
236
-          }
237
-          else
230
+          } else
238 231
           {
239 232
             $file = $temp;
240 233
           }
@@ -293,8 +286,7 @@  discard block
 block discarded – undo
293 286
   * Compile variables
294 287
   * @access private
295 288
   */
296
-  function compile_var_tags(&$text_blocks)
297
-  {
289
+  function compile_var_tags(&$text_blocks) {
298 290
     // including $lang variable
299 291
     // global $lang, $config; // NOT NEDEED - $lang now is global!
300 292
 
@@ -368,8 +360,7 @@  discard block
 block discarded – undo
368 360
   * Compile blocks
369 361
   * @access private
370 362
   */
371
-  function compile_tag_block($tag_args)
372
-  {
363
+  function compile_tag_block($tag_args) {
373 364
     $no_nesting = false;
374 365
 
375 366
     // Is the designer wanting to call another loop in a loop?
@@ -392,8 +383,7 @@  discard block
 block discarded – undo
392 383
       if ($match[2] < 0)
393 384
       {
394 385
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
395
-      }
396
-      else
386
+      } else
397 387
       {
398 388
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
399 389
       }
@@ -401,17 +391,14 @@  discard block
 block discarded – undo
401 391
       if (strlen($match[3]) < 1 || $match[3] == -1)
402 392
       {
403 393
         $loop_end = '$_' . $tag_args . '_count';
404
-      }
405
-      else if ($match[3] >= 0)
394
+      } else if ($match[3] >= 0)
406 395
       {
407 396
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
408
-      }
409
-      else //if ($match[3] < -1)
397
+      } else //if ($match[3] < -1)
410 398
       {
411 399
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
412 400
       }
413
-    }
414
-    else
401
+    } else
415 402
     {
416 403
       $loop_start = 0;
417 404
       $loop_end = '$_' . $tag_args . '_count';
@@ -424,8 +411,7 @@  discard block
 block discarded – undo
424 411
     {
425 412
       // We need to implode $no_nesting times from the end...
426 413
       $block = array_slice($this->block_names, -$no_nesting);
427
-    }
428
-    else
414
+    } else
429 415
     {
430 416
       $block = $this->block_names;
431 417
     }
@@ -435,8 +421,7 @@  discard block
 block discarded – undo
435 421
       // Block is not nested.
436 422
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
437 423
       $varref = "\$this->_tpldata['$tag_args']";
438
-    }
439
-    else
424
+    } else
440 425
     {
441 426
       // This block is nested.
442 427
       // Generate a namespace string for this block.
@@ -475,8 +460,7 @@  discard block
 block discarded – undo
475 460
   * some adaptions for our block level methods
476 461
   * @access private
477 462
   */
478
-  function compile_tag_if($tag_args, $elseif)
479
-  {
463
+  function compile_tag_if($tag_args, $elseif) {
480 464
     // Tokenize args for 'if' tag.
481 465
     preg_match_all('/(?:
482 466
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -584,8 +568,7 @@  discard block
 block discarded – undo
584 568
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
585 569
           {
586 570
             $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] . '\']');
587
-          }
588
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
589 572
           {
590 573
             // Allow checking if loops are set with .loopname
591 574
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -601,8 +584,7 @@  discard block
 block discarded – undo
601 584
 
602 585
               // Add the block reference for the last child.
603 586
               $varref .= "['" . $block . "']";
604
-            }
605
-            else
587
+            } else
606 588
             {
607 589
               $varref = '$this->_tpldata';
608 590
 
@@ -610,8 +592,7 @@  discard block
 block discarded – undo
610 592
               $varref .= "['" . $blocks[0] . "']";
611 593
             }
612 594
             $token = "sizeof($varref)";
613
-          }
614
-          else if (!empty($token))
595
+          } else if (!empty($token))
615 596
           {
616 597
             $token = '(' . $token . ')';
617 598
           }
@@ -632,8 +613,7 @@  discard block
 block discarded – undo
632 613
   * Compile DEFINE tags
633 614
   * @access private
634 615
   */
635
-  function compile_tag_define($tag_args, $op)
636
-  {
616
+  function compile_tag_define($tag_args, $op) {
637 617
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
638 618
 
639 619
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -656,8 +636,7 @@  discard block
 block discarded – undo
656 636
 
657 637
       // Now replace the php code
658 638
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
659
-    }
660
-    else
639
+    } else
661 640
     {
662 641
       preg_match('#true|false|\.#i', $match[4], $type);
663 642
 
@@ -685,8 +664,7 @@  discard block
 block discarded – undo
685 664
   * Compile INCLUDE tag
686 665
   * @access private
687 666
   */
688
-  function compile_tag_include($tag_args)
689
-  {
667
+  function compile_tag_include($tag_args) {
690 668
     // Process dynamic includes
691 669
     if ($tag_args[0] == '$')
692 670
     {
@@ -700,8 +678,7 @@  discard block
 block discarded – undo
700 678
   * Compile INCLUDE_PHP tag
701 679
   * @access private
702 680
   */
703
-  function compile_tag_include_php($tag_args)
704
-  {
681
+  function compile_tag_include_php($tag_args) {
705 682
     return "\$this->_php_include('$tag_args');";
706 683
   }
707 684
 
@@ -710,8 +687,7 @@  discard block
 block discarded – undo
710 687
   * This is from Smarty
711 688
   * @access private
712 689
   */
713
-  function _parse_is_expr($is_arg, $tokens)
714
-  {
690
+  function _parse_is_expr($is_arg, $tokens) {
715 691
     $expr_end = 0;
716 692
     $negate_expr = false;
717 693
 
@@ -719,8 +695,7 @@  discard block
 block discarded – undo
719 695
     {
720 696
       $negate_expr = true;
721 697
       $expr_type = array_shift($tokens);
722
-    }
723
-    else
698
+    } else
724 699
     {
725 700
       $expr_type = $first_token;
726 701
     }
@@ -733,8 +708,7 @@  discard block
 block discarded – undo
733 708
           $expr_end++;
734 709
           $expr_arg = $tokens[$expr_end++];
735 710
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
736
-        }
737
-        else
711
+        } else
738 712
         {
739 713
           $expr = "!($is_arg & 1)";
740 714
         }
@@ -746,8 +720,7 @@  discard block
 block discarded – undo
746 720
           $expr_end++;
747 721
           $expr_arg = $tokens[$expr_end++];
748 722
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
749
-        }
750
-        else
723
+        } else
751 724
         {
752 725
           $expr = "($is_arg & 1)";
753 726
         }
@@ -786,8 +759,7 @@  discard block
 block discarded – undo
786 759
    *
787 760
    * @return string
788 761
    */
789
-  private function generate_block_varref($namespace, $varname, $defop = false)
790
-  {
762
+  private function generate_block_varref($namespace, $varname, $defop = false) {
791 763
     // Strip the trailing period.
792 764
     $namespace = substr($namespace, 0, -1);
793 765
 
@@ -810,8 +782,7 @@  discard block
 block discarded – undo
810 782
   * NOTE: does not expect a trailing "." on the blockname.
811 783
   * @access private
812 784
   */
813
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
814
-  {
785
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
815 786
     // Get an array of the blocks involved.
816 787
     $blocks = explode('.', $blockname);
817 788
     $blockcount = sizeof($blocks) - 1;
@@ -833,12 +804,10 @@  discard block
 block discarded – undo
833 804
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
834 805
       }
835 806
       return $varref;
836
-    }
837
-    else if ($include_last_iterator)
807
+    } else if ($include_last_iterator)
838 808
     {
839 809
       return '$_'. $blocks[$blockcount] . '_val';
840
-    }
841
-    else
810
+    } else
842 811
     {
843 812
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
844 813
     }
@@ -848,8 +817,7 @@  discard block
 block discarded – undo
848 817
   * Write compiled file to cache directory
849 818
   * @access private
850 819
   */
851
-  function compile_write($handle, $data)
852
-  {
820
+  function compile_write($handle, $data) {
853 821
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
854 822
 
855 823
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -873,8 +841,7 @@  discard block
 block discarded – undo
873 841
   * Minifies template w/i PHP code by removing extra spaces
874 842
   * @access private
875 843
   */
876
-  function minify($html)
877
-  {
844
+  function minify($html) {
878 845
     if(!SN::$config->tpl_minifier)
879 846
     {
880 847
       return $html;
Please login to merge, or discard this patch.
classes/Unit/DBStaticUnit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
   }
41 41
 
42 42
   public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) {
43
-    $query  = doquery(
43
+    $query = doquery(
44 44
       "SELECT unit_snid, sum(unit_level) as `qty`  FROM {{unit}} WHERE `unit_player_id` = {$user_id} " .
45 45
       ($unit_type ? "AND `unit_type` = {$unit_type} " : '') .
46 46
       ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') .
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
    * @return bool
190 190
    */
191 191
   protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) {
192
-    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR,]))) {
192
+    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR, ]))) {
193 193
       return false;
194 194
     }
195 195
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 //        'unit_level'         => $level,
223 223
 //      ]);
224 224
 
225
-      $fields     += [
225
+      $fields += [
226 226
         'unit_type'  => get_unit_param($unitSnId, P_UNIT_TYPE),
227 227
         'unit_level' => $amount,
228 228
       ];
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminUserView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@
 block discarded – undo
281 281
 //    var_dump($pl);
282 282
 //    var_dump(uni_render_planet_full($pl, '', false, true));
283 283
 
284
-    foreach(DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) {
284
+    foreach (DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) {
285 285
       $result['.']['planet'][] = [
286 286
         'ID' => $planetRow['id'],
287 287
         'NAME' => $planetRow['name'],
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageMessage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@
 block discarded – undo
345 345
     $wasIgnored = 0;
346 346
     $template = SnTemplate::gettemplate('msg_message_list', true);
347 347
     foreach ($message_query as $message_row) {
348
-      if(
348
+      if (
349 349
         $message_row['message_type'] == MSG_TYPE_PLAYER
350 350
         &&
351 351
         SN::$gc->ignores->isIgnored(floatval($message_row['message_owner']), floatval($message_row['message_sender']))
Please login to merge, or discard this patch.
classes/HelperArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
    * @return array
241 241
    */
242 242
   public static function parseParamStrings($array, $delimiter = '=') {
243
-    !is_array($array) ? $array = array((string)$array) : false;
243
+    !is_array($array) ? $array = array((string) $array) : false;
244 244
 
245 245
     $result = array();
246 246
     foreach ($array as $param) {
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
    * @return float|null
263 263
    */
264 264
   public static function maxValueByField(&$array, $fieldName) {
265
-    return array_reduce($array, function ($carry, $item) use ($fieldName) {
266
-      if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
265
+    return array_reduce($array, function($carry, $item) use ($fieldName) {
266
+      if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
267 267
         $carry = $item[$fieldName];
268 268
       }
269 269
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
     return
282 282
       array_reduce($array,
283
-        function ($carry, $item) use (&$fieldName, $maxValue) {
284
-          if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
283
+        function($carry, $item) use (&$fieldName, $maxValue) {
284
+          if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
285 285
             $carry[] = $item;
286 286
           }
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
   }
293 293
 
294 294
   public static function intersectByKeys(array &$array1, array &$array2) {
295
-    return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;});
295
+    return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; });
296 296
   }
297 297
 
298 298
   /**
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
@@ -78,121 +78,121 @@  discard block
 block discarded – undo
78 78
 }
79 79
 
80 80
 switch ($fleet_page) {
81
-  case 3:
81
+    case 3:
82 82
 
83
-  case 2:
84
-    $fleet_group_mr = sys_get_param_id('fleet_group');
85
-    $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
86
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
83
+    case 2:
84
+      $fleet_group_mr = sys_get_param_id('fleet_group');
85
+      $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
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) {
90
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
91
-        die();
92
-      }
93
-      $ship_amount = floatval($ship_amount);
94
-    }
95
-
96
-    $UsedPlanet = false;
97
-    $YourPlanet = false;
98
-    $missiontype = array();
99
-    if ($planet > SN::$config->game_maxPlanet) {
100
-      $target_mission = MT_EXPLORE;
101
-      $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
102
-    } elseif ($galaxy && $system && $planet) {
103
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
104
-
105
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
106
-
107
-      if ($TargetPlanet['id_owner']) {
108
-        $UsedPlanet = true;
109
-        if ($TargetPlanet['id_owner'] == $user['id']) {
110
-          $YourPlanet = true;
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
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
91
+          die();
111 92
         }
93
+        $ship_amount = floatval($ship_amount);
112 94
       }
113 95
 
114
-      if (!$UsedPlanet) {
115
-        if ($fleetarray[SHIP_COLONIZER]) {
116
-          $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
117
-          $target_mission = MT_COLONIZE;
118
-          $planet_type = PT_PLANET;
119
-        } else {
120
-          SnTemplate::messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
121
-        }
122
-      } else {
123
-        $recyclers = 0;
124
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
125
-          $recyclers += $fleetarray[$recycler_id];
96
+      $UsedPlanet = false;
97
+      $YourPlanet = false;
98
+      $missiontype = array();
99
+      if ($planet > SN::$config->game_maxPlanet) {
100
+        $target_mission = MT_EXPLORE;
101
+        $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
102
+      } elseif ($galaxy && $system && $planet) {
103
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
104
+
105
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
106
+
107
+        if ($TargetPlanet['id_owner']) {
108
+          $UsedPlanet = true;
109
+          if ($TargetPlanet['id_owner'] == $user['id']) {
110
+            $YourPlanet = true;
111
+          }
126 112
         }
127
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
128
-          $target_mission = MT_RECYCLE;
129
-          $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
130
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
131
-          if ($YourPlanet) {
132
-            $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
133
-            $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
113
+
114
+        if (!$UsedPlanet) {
115
+          if ($fleetarray[SHIP_COLONIZER]) {
116
+            $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
117
+            $target_mission = MT_COLONIZE;
118
+            $planet_type = PT_PLANET;
134 119
           } else {
135
-            // Not Your Planet
136
-            if ($fleetarray[SHIP_SPY]) {
137
-              // Only spy missions if any spy
138
-              $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
120
+            SnTemplate::messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
121
+          }
122
+        } else {
123
+          $recyclers = 0;
124
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
125
+            $recyclers += $fleetarray[$recycler_id];
126
+          }
127
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
128
+            $target_mission = MT_RECYCLE;
129
+            $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
130
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
131
+            if ($YourPlanet) {
132
+              $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
133
+              $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
139 134
             } else {
140
-              // If no spies...
141
-              if ($fleet_group_mr) {
142
-                $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
135
+              // Not Your Planet
136
+              if ($fleetarray[SHIP_SPY]) {
137
+                // Only spy missions if any spy
138
+                $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
143 139
               } else {
144
-                $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
145
-                $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
146
-
147
-                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
148
-
149
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
150
-                  $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
140
+                // If no spies...
141
+                if ($fleet_group_mr) {
142
+                  $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
143
+                } else {
144
+                  $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
145
+                  $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
146
+
147
+                  $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
148
+
149
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
150
+                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
151
+                  }
151 152
                 }
152 153
               }
153 154
             }
154 155
           }
155 156
         }
156 157
       }
157
-    }
158
-
159
-    if (!$target_mission && is_array($missiontype)) {
160
-      $target_mission = MT_ATTACK;
161
-    }
162
-
163
-//    $sn_group_missions = sn_get_groups('missions');
164
-//    foreach($sn_group_missions as $mission_id => $cork) {
165
-//      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
166
-//    }
167
-//
168
-//
169
-    ksort($missiontype);
170
-
171
-    $speed_percent = sys_get_param_int('speed', 10);
172
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
173
-
174
-//    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
175
-    $fleet_speed   = $travel_data['fleet_speed'];
176
-    $distance      = $travel_data['distance'];
177
-    $duration      = $travel_data['duration'];
178
-    $consumption   = $travel_data['consumption'];
179
-  // No Break
180
-
181
-  case 1:
182
-    if ($galaxy && $system && $planet) {
183
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
184
-
185
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
186
-    }
187
-
188
-  case 0:
189
-    $template_result += array(
190
-      'thisgalaxy'      => $planetrow['galaxy'],
191
-      'thissystem'      => $planetrow['system'],
192
-      'thisplanet'      => $planetrow['planet'],
193
-      'thisplanet_type' => $planetrow['planet_type'],
194
-    );
195
-  // no break
158
+
159
+      if (!$target_mission && is_array($missiontype)) {
160
+        $target_mission = MT_ATTACK;
161
+      }
162
+
163
+  //    $sn_group_missions = sn_get_groups('missions');
164
+  //    foreach($sn_group_missions as $mission_id => $cork) {
165
+  //      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
166
+  //    }
167
+  //
168
+  //
169
+      ksort($missiontype);
170
+
171
+      $speed_percent = sys_get_param_int('speed', 10);
172
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
173
+
174
+  //    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
175
+      $fleet_speed   = $travel_data['fleet_speed'];
176
+      $distance      = $travel_data['distance'];
177
+      $duration      = $travel_data['duration'];
178
+      $consumption   = $travel_data['consumption'];
179
+    // No Break
180
+
181
+    case 1:
182
+      if ($galaxy && $system && $planet) {
183
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
184
+
185
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
186
+      }
187
+
188
+    case 0:
189
+      $template_result += array(
190
+        'thisgalaxy'      => $planetrow['galaxy'],
191
+        'thissystem'      => $planetrow['system'],
192
+        'thisplanet'      => $planetrow['planet'],
193
+        'thisplanet_type' => $planetrow['planet_type'],
194
+      );
195
+    // no break
196 196
 
197 197
 }
198 198
 
@@ -214,35 +214,35 @@  discard block
 block discarded – undo
214 214
 }
215 215
 
216 216
 switch($fleet_page) {
217
-  case 1:
218
-    require('includes/includes/flt_page1.inc');
219
-  break;
220
-
221
-  case 2:
222
-    require_once('includes/includes/flt_page2.inc');
223
-    sn_fleet_page2();
224
-  break;
225
-
226
-  case 3:
227
-    require_once('includes/includes/flt_page3.inc');
228
-    sn_fleet_page3();
229
-  break;
230
-
231
-  case 4:
232
-    require('includes/includes/flt_page4.inc');
233
-  break;
234
-
235
-  case 5:
236
-    $template = SnTemplate::gettemplate('fleet5', true);
237
-    $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering();
238
-    $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
239
-    // Building list of own planets & moons
240
-    $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
241
-  break;
242
-
243
-  default:
244
-    define('SN_RENDER_NAVBAR_PLANET', true);
245
-
246
-    require('includes/includes/flt_page0.inc');
247
-  break;
217
+    case 1:
218
+      require('includes/includes/flt_page1.inc');
219
+    break;
220
+
221
+    case 2:
222
+      require_once('includes/includes/flt_page2.inc');
223
+      sn_fleet_page2();
224
+    break;
225
+
226
+    case 3:
227
+      require_once('includes/includes/flt_page3.inc');
228
+      sn_fleet_page3();
229
+    break;
230
+
231
+    case 4:
232
+      require('includes/includes/flt_page4.inc');
233
+    break;
234
+
235
+    case 5:
236
+      $template = SnTemplate::gettemplate('fleet5', true);
237
+      $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering();
238
+      $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
239
+      // Building list of own planets & moons
240
+      $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
241
+    break;
242
+
243
+    default:
244
+      define('SN_RENDER_NAVBAR_PLANET', true);
245
+
246
+      require('includes/includes/flt_page0.inc');
247
+    break;
248 248
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 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
   SnTemplate::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
       }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
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.