Completed
Push — trunk ( e1d59e...0e0d9a )
by SuperNova.WS
04:35
created
classes/template_compile.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
   }
56 56
 
57 57
   /**
58
-  * Load template source from file
59
-  * @access private
60
-  */
58
+   * Load template source from file
59
+   * @access private
60
+   */
61 61
   function _tpl_load_file($handle, $store_in_db = false)
62 62
   {
63 63
     // Try and open template for read
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
   }
101 101
 
102 102
   /**
103
-  * Remove any PHP tags that do not belong, these regular expressions are derived from
104
-  * the ones that exist in zend_language_scanner.l
105
-  * @access private
106
-  */
103
+   * Remove any PHP tags that do not belong, these regular expressions are derived from
104
+   * the ones that exist in zend_language_scanner.l
105
+   * @access private
106
+   */
107 107
   function remove_php_tags(&$code)
108 108
   {
109 109
     // This matches the information gathered from the internal PHP lexer
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
   }
118 118
 
119 119
   /**
120
-  * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
-  * @access private
122
-  */
120
+   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
+   * @access private
122
+   */
123 123
   function compile($code, $no_echo = false, $echo_var = '')
124 124
   {
125 125
     if ($echo_var)
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
   }
289 289
 
290 290
   /**
291
-  * Compile variables
292
-  * @access private
293
-  */
291
+   * Compile variables
292
+   * @access private
293
+   */
294 294
   function compile_var_tags(&$text_blocks)
295 295
   {
296 296
     // including $lang variable
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
   }
364 364
 
365 365
   /**
366
-  * Compile blocks
367
-  * @access private
368
-  */
366
+   * Compile blocks
367
+   * @access private
368
+   */
369 369
   function compile_tag_block($tag_args)
370 370
   {
371 371
     $no_nesting = false;
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
452 452
 
453 453
     /**
454
-    * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
455
-    * <code>
456
-    * if (!$offset)
457
-    * {
458
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
459
-    * }
460
-    * </code>
461
-    */
454
+     * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
455
+     * <code>
456
+     * if (!$offset)
457
+     * {
458
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
459
+     * }
460
+     * </code>
461
+     */
462 462
 
463 463
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
464 464
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
   }
470 470
 
471 471
   /**
472
-  * Compile IF tags - much of this is from Smarty with
473
-  * some adaptions for our block level methods
474
-  * @access private
475
-  */
472
+   * Compile IF tags - much of this is from Smarty with
473
+   * some adaptions for our block level methods
474
+   * @access private
475
+   */
476 476
   function compile_tag_if($tag_args, $elseif)
477 477
   {
478 478
     // Tokenize args for 'if' tag.
@@ -627,9 +627,9 @@  discard block
 block discarded – undo
627 627
   }
628 628
 
629 629
   /**
630
-  * Compile DEFINE tags
631
-  * @access private
632
-  */
630
+   * Compile DEFINE tags
631
+   * @access private
632
+   */
633 633
   function compile_tag_define($tag_args, $op)
634 634
   {
635 635
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
   }
681 681
 
682 682
   /**
683
-  * Compile INCLUDE tag
684
-  * @access private
685
-  */
683
+   * Compile INCLUDE tag
684
+   * @access private
685
+   */
686 686
   function compile_tag_include($tag_args)
687 687
   {
688 688
     // Process dynamic includes
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
   }
696 696
 
697 697
   /**
698
-  * Compile INCLUDE_PHP tag
699
-  * @access private
700
-  */
698
+   * Compile INCLUDE_PHP tag
699
+   * @access private
700
+   */
701 701
   function compile_tag_include_php($tag_args)
702 702
   {
703 703
     return "\$this->_php_include('$tag_args');";
704 704
   }
705 705
 
706 706
   /**
707
-  * parse expression
708
-  * This is from Smarty
709
-  * @access private
710
-  */
707
+   * parse expression
708
+   * This is from Smarty
709
+   * @access private
710
+   */
711 711
   function _parse_is_expr($is_arg, $tokens)
712 712
   {
713 713
     $expr_end = 0;
@@ -800,14 +800,14 @@  discard block
 block discarded – undo
800 800
   }
801 801
 
802 802
   /**
803
-  * Generates a reference to the array of data values for the given
804
-  * (possibly nested) block namespace. This is a string of the form:
805
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
806
-  *
807
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
808
-  * NOTE: does not expect a trailing "." on the blockname.
809
-  * @access private
810
-  */
803
+   * Generates a reference to the array of data values for the given
804
+   * (possibly nested) block namespace. This is a string of the form:
805
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
806
+   *
807
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
808
+   * NOTE: does not expect a trailing "." on the blockname.
809
+   * @access private
810
+   */
811 811
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
812 812
   {
813 813
     // Get an array of the blocks involved.
@@ -843,9 +843,9 @@  discard block
 block discarded – undo
843 843
   }
844 844
 
845 845
   /**
846
-  * Write compiled file to cache directory
847
-  * @access private
848
-  */
846
+   * Write compiled file to cache directory
847
+   * @access private
848
+   */
849 849
   function compile_write($handle, $data)
850 850
   {
851 851
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -868,9 +868,9 @@  discard block
 block discarded – undo
868 868
 
869 869
   // Gorlum's minifier BOF
870 870
   /**
871
-  * Minifies template w/i PHP code by removing extra spaces
872
-  * @access private
873
-  */
871
+   * Minifies template w/i PHP code by removing extra spaces
872
+   * @access private
873
+   */
874 874
   function minify($html)
875 875
   {
876 876
     if(!SN::$config->tpl_minifier)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 
142 142
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
143 143
     $include_blocks = $matches[1];
144
-    if($include_blocks)
144
+    if ($include_blocks)
145 145
     {
146
-      foreach($include_blocks as &$included_file)
146
+      foreach ($include_blocks as &$included_file)
147 147
       {
148 148
         $included_file .= '.tpl.html';
149 149
       }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
       $varname = $var_val[3];
309 309
       $new = $this->generate_block_varref($namespace, $varname, $var_val[2]);
310 310
 
311
-      if(!empty($var_val[4])) {
311
+      if (!empty($var_val[4])) {
312 312
         $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template);
313 313
       }
314 314
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 
463 463
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
464 464
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
465
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
466
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
465
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
466
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
467 467
 
468 468
     return $tag_template_php;
469 469
   }
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
         break;
568 568
 
569 569
         case 'is':
570
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
570
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
571 571
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
572 572
 
573
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
573
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
574 574
 
575 575
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
576 576
 
@@ -834,11 +834,11 @@  discard block
 block discarded – undo
834 834
     }
835 835
     else if ($include_last_iterator)
836 836
     {
837
-      return '$_'. $blocks[$blockcount] . '_val';
837
+      return '$_' . $blocks[$blockcount] . '_val';
838 838
     }
839 839
     else
840 840
     {
841
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
841
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
842 842
     }
843 843
   }
844 844
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     if ($fp = @fopen($filename, 'wb'))
856 856
     {
857 857
       @flock($fp, LOCK_EX);
858
-      @fwrite ($fp, $data);
858
+      @fwrite($fp, $data);
859 859
       @flock($fp, LOCK_UN);
860 860
       @fclose($fp);
861 861
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
   */
874 874
   function minify($html)
875 875
   {
876
-    if(!SN::$config->tpl_minifier)
876
+    if (!SN::$config->tpl_minifier)
877 877
     {
878 878
       return $html;
879 879
     }
@@ -885,14 +885,14 @@  discard block
 block discarded – undo
885 885
     //$html = preg_replace('/[\r\n\t]+/', ' ', $html);
886 886
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
887 887
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
888
-    if(!empty($pre[0]))
888
+    if (!empty($pre[0]))
889 889
     {
890
-      foreach($pre[0] as $tag)
890
+      foreach ($pre[0] as $tag)
891 891
       {
892 892
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
893 893
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
894 894
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
895
-        $html = preg_replace('/#pre#/', $tag, $html,1);
895
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
896 896
       }
897 897
     }
898 898
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
 *
38 38
 * @package phpBB3
39 39
 */
40
-class template_compile
41
-{
40
+class template_compile {
42 41
   var $template;
43 42
 
44 43
   // Various storage arrays
@@ -58,8 +57,7 @@  discard block
 block discarded – undo
58 57
   * Load template source from file
59 58
   * @access private
60 59
   */
61
-  function _tpl_load_file($handle, $store_in_db = false)
62
-  {
60
+  function _tpl_load_file($handle, $store_in_db = false) {
63 61
     // Try and open template for read
64 62
     if (!file_exists($this->template->files[$handle]))
65 63
     {
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
       {
68 66
         return;
69 67
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
70
-      }
71
-      else
68
+      } else
72 69
       {
73 70
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
74 71
       }
@@ -104,8 +101,7 @@  discard block
 block discarded – undo
104 101
   * the ones that exist in zend_language_scanner.l
105 102
   * @access private
106 103
   */
107
-  function remove_php_tags(&$code)
108
-  {
104
+  function remove_php_tags(&$code) {
109 105
     // This matches the information gathered from the internal PHP lexer
110 106
     $match = array(
111 107
       '#<([\?%])=?.*?\1>#s',
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121 117
   * @access private
122 118
   */
123
-  function compile($code, $no_echo = false, $echo_var = '')
124
-  {
119
+  function compile($code, $no_echo = false, $echo_var = '') {
125 120
     if ($echo_var)
126 121
     {
127 122
       global $$echo_var;
@@ -224,15 +219,13 @@  discard block
 block discarded – undo
224 219
               $var = substr($temp, 2, -1);
225 220
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
226 221
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
227
-            }
228
-            else
222
+            } else
229 223
             {
230 224
               $var = substr($temp, 1, -1);
231 225
               //$file = $this->template->_rootref[$var];
232 226
               $temp = "\$this->_rootref['$var']";
233 227
             }
234
-          }
235
-          else
228
+          } else
236 229
           {
237 230
             $file = $temp;
238 231
           }
@@ -291,8 +284,7 @@  discard block
 block discarded – undo
291 284
   * Compile variables
292 285
   * @access private
293 286
   */
294
-  function compile_var_tags(&$text_blocks)
295
-  {
287
+  function compile_var_tags(&$text_blocks) {
296 288
     // including $lang variable
297 289
     // global $lang, $config; // NOT NEDEED - $lang now is global!
298 290
 
@@ -366,8 +358,7 @@  discard block
 block discarded – undo
366 358
   * Compile blocks
367 359
   * @access private
368 360
   */
369
-  function compile_tag_block($tag_args)
370
-  {
361
+  function compile_tag_block($tag_args) {
371 362
     $no_nesting = false;
372 363
 
373 364
     // Is the designer wanting to call another loop in a loop?
@@ -390,8 +381,7 @@  discard block
 block discarded – undo
390 381
       if ($match[2] < 0)
391 382
       {
392 383
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
393
-      }
394
-      else
384
+      } else
395 385
       {
396 386
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
397 387
       }
@@ -399,17 +389,14 @@  discard block
 block discarded – undo
399 389
       if (strlen($match[3]) < 1 || $match[3] == -1)
400 390
       {
401 391
         $loop_end = '$_' . $tag_args . '_count';
402
-      }
403
-      else if ($match[3] >= 0)
392
+      } else if ($match[3] >= 0)
404 393
       {
405 394
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
406
-      }
407
-      else //if ($match[3] < -1)
395
+      } else //if ($match[3] < -1)
408 396
       {
409 397
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
410 398
       }
411
-    }
412
-    else
399
+    } else
413 400
     {
414 401
       $loop_start = 0;
415 402
       $loop_end = '$_' . $tag_args . '_count';
@@ -422,8 +409,7 @@  discard block
 block discarded – undo
422 409
     {
423 410
       // We need to implode $no_nesting times from the end...
424 411
       $block = array_slice($this->block_names, -$no_nesting);
425
-    }
426
-    else
412
+    } else
427 413
     {
428 414
       $block = $this->block_names;
429 415
     }
@@ -433,8 +419,7 @@  discard block
 block discarded – undo
433 419
       // Block is not nested.
434 420
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
435 421
       $varref = "\$this->_tpldata['$tag_args']";
436
-    }
437
-    else
422
+    } else
438 423
     {
439 424
       // This block is nested.
440 425
       // Generate a namespace string for this block.
@@ -473,8 +458,7 @@  discard block
 block discarded – undo
473 458
   * some adaptions for our block level methods
474 459
   * @access private
475 460
   */
476
-  function compile_tag_if($tag_args, $elseif)
477
-  {
461
+  function compile_tag_if($tag_args, $elseif) {
478 462
     // Tokenize args for 'if' tag.
479 463
     preg_match_all('/(?:
480 464
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -582,8 +566,7 @@  discard block
 block discarded – undo
582 566
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
583 567
           {
584 568
             $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
585
-          }
586
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
569
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
587 570
           {
588 571
             // Allow checking if loops are set with .loopname
589 572
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -599,8 +582,7 @@  discard block
 block discarded – undo
599 582
 
600 583
               // Add the block reference for the last child.
601 584
               $varref .= "['" . $block . "']";
602
-            }
603
-            else
585
+            } else
604 586
             {
605 587
               $varref = '$this->_tpldata';
606 588
 
@@ -608,8 +590,7 @@  discard block
 block discarded – undo
608 590
               $varref .= "['" . $blocks[0] . "']";
609 591
             }
610 592
             $token = "sizeof($varref)";
611
-          }
612
-          else if (!empty($token))
593
+          } else if (!empty($token))
613 594
           {
614 595
             $token = '(' . $token . ')';
615 596
           }
@@ -630,8 +611,7 @@  discard block
 block discarded – undo
630 611
   * Compile DEFINE tags
631 612
   * @access private
632 613
   */
633
-  function compile_tag_define($tag_args, $op)
634
-  {
614
+  function compile_tag_define($tag_args, $op) {
635 615
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
636 616
 
637 617
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -654,8 +634,7 @@  discard block
 block discarded – undo
654 634
 
655 635
       // Now replace the php code
656 636
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
657
-    }
658
-    else
637
+    } else
659 638
     {
660 639
       preg_match('#true|false|\.#i', $match[4], $type);
661 640
 
@@ -683,8 +662,7 @@  discard block
 block discarded – undo
683 662
   * Compile INCLUDE tag
684 663
   * @access private
685 664
   */
686
-  function compile_tag_include($tag_args)
687
-  {
665
+  function compile_tag_include($tag_args) {
688 666
     // Process dynamic includes
689 667
     if ($tag_args[0] == '$')
690 668
     {
@@ -698,8 +676,7 @@  discard block
 block discarded – undo
698 676
   * Compile INCLUDE_PHP tag
699 677
   * @access private
700 678
   */
701
-  function compile_tag_include_php($tag_args)
702
-  {
679
+  function compile_tag_include_php($tag_args) {
703 680
     return "\$this->_php_include('$tag_args');";
704 681
   }
705 682
 
@@ -708,8 +685,7 @@  discard block
 block discarded – undo
708 685
   * This is from Smarty
709 686
   * @access private
710 687
   */
711
-  function _parse_is_expr($is_arg, $tokens)
712
-  {
688
+  function _parse_is_expr($is_arg, $tokens) {
713 689
     $expr_end = 0;
714 690
     $negate_expr = false;
715 691
 
@@ -717,8 +693,7 @@  discard block
 block discarded – undo
717 693
     {
718 694
       $negate_expr = true;
719 695
       $expr_type = array_shift($tokens);
720
-    }
721
-    else
696
+    } else
722 697
     {
723 698
       $expr_type = $first_token;
724 699
     }
@@ -731,8 +706,7 @@  discard block
 block discarded – undo
731 706
           $expr_end++;
732 707
           $expr_arg = $tokens[$expr_end++];
733 708
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
734
-        }
735
-        else
709
+        } else
736 710
         {
737 711
           $expr = "!($is_arg & 1)";
738 712
         }
@@ -744,8 +718,7 @@  discard block
 block discarded – undo
744 718
           $expr_end++;
745 719
           $expr_arg = $tokens[$expr_end++];
746 720
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
747
-        }
748
-        else
721
+        } else
749 722
         {
750 723
           $expr = "($is_arg & 1)";
751 724
         }
@@ -784,8 +757,7 @@  discard block
 block discarded – undo
784 757
    *
785 758
    * @return string
786 759
    */
787
-  private function generate_block_varref($namespace, $varname, $defop = false)
788
-  {
760
+  private function generate_block_varref($namespace, $varname, $defop = false) {
789 761
     // Strip the trailing period.
790 762
     $namespace = substr($namespace, 0, -1);
791 763
 
@@ -808,8 +780,7 @@  discard block
 block discarded – undo
808 780
   * NOTE: does not expect a trailing "." on the blockname.
809 781
   * @access private
810 782
   */
811
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
812
-  {
783
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
813 784
     // Get an array of the blocks involved.
814 785
     $blocks = explode('.', $blockname);
815 786
     $blockcount = sizeof($blocks) - 1;
@@ -831,12 +802,10 @@  discard block
 block discarded – undo
831 802
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
832 803
       }
833 804
       return $varref;
834
-    }
835
-    else if ($include_last_iterator)
805
+    } else if ($include_last_iterator)
836 806
     {
837 807
       return '$_'. $blocks[$blockcount] . '_val';
838
-    }
839
-    else
808
+    } else
840 809
     {
841 810
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
842 811
     }
@@ -846,8 +815,7 @@  discard block
 block discarded – undo
846 815
   * Write compiled file to cache directory
847 816
   * @access private
848 817
   */
849
-  function compile_write($handle, $data)
850
-  {
818
+  function compile_write($handle, $data) {
851 819
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
852 820
 
853 821
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -871,8 +839,7 @@  discard block
 block discarded – undo
871 839
   * Minifies template w/i PHP code by removing extra spaces
872 840
   * @access private
873 841
   */
874
-  function minify($html)
875
-  {
842
+  function minify($html) {
876 843
     if(!SN::$config->tpl_minifier)
877 844
     {
878 845
       return $html;
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminMining.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
         'ID'        => self::PAGE_SORT_BY_RANK,
30 30
         'HTML_ID'   => 'byTotalRank',
31 31
         'HTML_NAME' => '{ byTotalRank }',
32
-        'SQL_SORT'  => ['u.total_rank',],
32
+        'SQL_SORT'  => ['u.total_rank', ],
33 33
       ],
34 34
       self::PAGE_SORT_BY_ID => [
35 35
         'ID'        => self::PAGE_SORT_BY_ID,
36 36
         'HTML_ID'   => 'byId',
37 37
         'HTML_NAME' => '{ byId }',
38
-        'SQL_SORT'  => ['u.id',],
38
+        'SQL_SORT'  => ['u.id', ],
39 39
       ],
40 40
       self::PAGE_SORT_BY_NAME => [
41 41
         'ID'        => self::PAGE_SORT_BY_NAME,
42 42
         'HTML_ID'   => 'byName',
43 43
         'HTML_NAME' => '{ byName }',
44
-        'SQL_SORT'  => ['u.username',],
44
+        'SQL_SORT'  => ['u.username', ],
45 45
       ],
46 46
 
47 47
       self::PAGE_SORT_BY_POINTS => [
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminModules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
   const SORT_BY_ACTIVITY = 1;
14 14
 
15 15
   private static $sorting = [
16
-    self::SORT_BY_PACKAGE  => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED',],
17
-    self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME',],
16
+    self::SORT_BY_PACKAGE  => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED', ],
17
+    self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME', ],
18 18
   ];
19 19
 
20 20
   private static $sortFields = [];
Please login to merge, or discard this patch.
classes/Fleet/FleetStatic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
    * @return DbMysqliResultIterator|EmptyCountableIterator
19 19
    */
20 20
   public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) {
21
-    if(empty($planetIds) || !is_array($planetIds)) {
21
+    if (empty($planetIds) || !is_array($planetIds)) {
22 22
       return new EmptyCountableIterator();
23 23
     }
24 24
 
Please login to merge, or discard this patch.
admin/admin_locale.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-define('INSIDE'  , true);
11
-define('INSTALL' , false);
12
-define('IN_ADMIN'  , true);
10
+define('INSIDE', true);
11
+define('INSTALL', false);
12
+define('IN_ADMIN', true);
13 13
 
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 function adm_lng_assign_string($lang_id, $locale_string_name, $value) {
21 21
   global $locale_string_template, $languages_info, $languages, $domain;
22 22
 
23
-  if(is_array($value)) {
24
-    foreach($value as $sub_key => $sub_value) {
23
+  if (is_array($value)) {
24
+    foreach ($value as $sub_key => $sub_value) {
25 25
       adm_lng_assign_string($lang_id, "{$locale_string_name}[{$sub_key}]", $sub_value);
26 26
     }
27
-  } elseif($value) {
28
-    if(!isset($locale_string_template[$locale_string_name])) {
27
+  } elseif ($value) {
28
+    if (!isset($locale_string_template[$locale_string_name])) {
29 29
       $locale_string_template[$locale_string_name] = array();
30 30
     }
31 31
     $locale_string_template[$locale_string_name] = array_merge($locale_string_template[$locale_string_name], array("[{$lang_id}]" => htmlentities($value, ENT_COMPAT, 'utf-8')));
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
   global $domain, $lang_id;
47 47
 
48 48
   $return = "{$ident}'{$string_name}' => ";
49
-  if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
49
+  if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
50 50
     $return .= "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',";
51 51
   } else {
52 52
     $return .= "array(\r\n";
53
-    foreach($string_value as $arr_name => $arr_data) {
53
+    foreach ($string_value as $arr_name => $arr_data) {
54 54
       $return .= adm_lng_parse_string($arr_name, $arr_data, $ident . '  ');
55 55
     }
56 56
     $return .= "{$ident}),\r\n";
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 
104 104
   $string_name_new = false;
105 105
 
106
-  if(isset($honor_constants[$domain][$string_name_prefix])) {
106
+  if (isset($honor_constants[$domain][$string_name_prefix])) {
107 107
     $found_constants = array_keys($constants, $string_name);
108
-    foreach($found_constants as $constant_name) {
108
+    foreach ($found_constants as $constant_name) {
109 109
       $honor_prefix_list = is_array($honor_constants[$domain][$string_name_prefix]) ? $honor_constants[$domain][$string_name_prefix] : array($honor_constants[$domain][$string_name_prefix]);
110
-      foreach($honor_prefix_list as $honor_prefix) {
111
-        if(strpos($constant_name, $honor_prefix) === 0) {
110
+      foreach ($honor_prefix_list as $honor_prefix) {
111
+        if (strpos($constant_name, $honor_prefix) === 0) {
112 112
           $string_name_new = $constant_name;
113 113
           break;
114 114
         }
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 
119 119
   $string_name_new = $string_name_new ? $string_name_new : "'{$string_name}'";
120 120
   fwrite($file_handler, "{$ident}{$string_name_new} => ");
121
-  if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
121
+  if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) {
122 122
     fwrite($file_handler, "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',");
123 123
 //    fwrite($file_handler, "'" . addslashes($string_value[$lang_id]) . "',");
124 124
   } else {
125 125
     $string_name_prefix = $string_name_prefix . "[{$string_name}]";
126 126
     fwrite($file_handler, "array(\r\n");
127
-    foreach($string_value as $arr_name => $arr_data) {
127
+    foreach ($string_value as $arr_name => $arr_data) {
128 128
       adm_lng_write_string($arr_name, $arr_data, $ident . '  ', $string_name_prefix);
129 129
     }
130 130
     fwrite($file_handler, "{$ident}),\r\n");
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 $languages_info = lng_get_list();
145 145
 $domain = sys_get_param_str('domain');
146 146
 
147
-if($domain) {
147
+if ($domain) {
148 148
   $lang_new = sys_get_param('lang_new');
149
-  if(!empty($lang_new) && is_array($lang_new)) {
149
+  if (!empty($lang_new) && is_array($lang_new)) {
150 150
     $constants = get_defined_constants(true);
151 151
     $constants = $constants['user'];
152 152
     ksort($constants);
153
-    foreach($languages_info as $lang_id => $land_data) {
153
+    foreach ($languages_info as $lang_id => $land_data) {
154 154
       $file_handler = fopen(SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php.new", 'w');
155 155
       fwrite($file_handler, "<?php\r\n\r\n/*\r\n#############################################################################
156 156
 #  Filename: {$domain}.mo.php
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 #  Website: http://www.supernova.ws
159 159
 #  Description: Massive Multiplayer Online Browser Space Strategy Game\r\n#\r\n");
160 160
 
161
-      foreach($land_data['LANG_COPYRIGHT'] as $lang_copyright) {
161
+      foreach ($land_data['LANG_COPYRIGHT'] as $lang_copyright) {
162 162
         $lang_copyright = str_replace(array('&copy;', '&quot;', '&lt;', '&gt;'), array('©', '"', '<', '>'), $lang_copyright);
163 163
         fwrite($file_handler, "#  {$lang_copyright}\r\n");
164 164
       }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 /**\r\n*\r\n* @package language\r\n* @system [{$land_data['LANG_NAME_ENGLISH']}]\r\n* @version " . SN_VERSION . "\r\n*\r\n*/\r\n
167 167
 /**\r\n* DO NOT CHANGE\r\n*/\r\n\r\nif (!defined('INSIDE')) die();\r\n
168 168
 \$a_lang_array = array(\r\n");
169
-      foreach($lang_new as $string_name => $string_value) {
169
+      foreach ($lang_new as $string_name => $string_value) {
170 170
         adm_lng_write_string($string_name, $string_value);
171 171
       }
172 172
       fwrite($file_handler, ");\r\n");
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
     sys_redirect("admin_locale.php?domain={$domain}");
177 177
   }
178 178
 
179
-  foreach($languages_info as $lang_id => $lang_data) {
179
+  foreach ($languages_info as $lang_id => $lang_data) {
180 180
     $template->assign_block_vars('language', $lang_data);
181 181
     $full_filename = SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php";
182 182
     $languages[$lang_id] = adm_lng_load($full_filename . (file_exists($full_filename . '.new') ? '.new' : ''));
183
-    foreach($languages[$lang_id] as $locale_string_name => $cork) {
183
+    foreach ($languages[$lang_id] as $locale_string_name => $cork) {
184 184
       adm_lng_assign_string($lang_id, "[{$locale_string_name}]", $languages[$lang_id][$locale_string_name]);
185 185
     }
186 186
   }
187 187
 
188
-  foreach($locale_string_template as $locale_string_name => $locale_string_list) {
188
+  foreach ($locale_string_template as $locale_string_name => $locale_string_list) {
189 189
     $template->assign_block_vars('string', array(
190 190
       'NAME' => $locale_string_name,
191 191
     ));
192 192
 
193
-    foreach($languages_info as $lang_id => $cork2) {
193
+    foreach ($languages_info as $lang_id => $cork2) {
194 194
       $template->assign_block_vars('string.locale', array(
195 195
         'LANG' => $lang_id,
196 196
         'VALUE' => $locale_string_list["[{$lang_id}]"],
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
   $dir = dir($path);
207 207
   while (false !== ($lang_id = $dir->read())) {
208 208
     $full_path = $path . $lang_id;
209
-    if($lang_id[0] != "." && is_dir($full_path)) {
209
+    if ($lang_id[0] != "." && is_dir($full_path)) {
210 210
       $lang_file_list = dir($full_path);
211 211
       while (false !== ($filename = $lang_file_list->read())) {
212 212
         $lang_domain = strtolower(substr($filename, 0, strpos($filename, '.')));
213
-        if(!$lang_domain) {
213
+        if (!$lang_domain) {
214 214
           continue;
215 215
         }
216 216
 
217 217
         $file_ext = strtolower(substr($filename, strpos($filename, '.')));
218
-        if($lang_domain != 'language') {
219
-          if($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) {
218
+        if ($lang_domain != 'language') {
219
+          if ($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) {
220 220
             $language_domains[$lang_domain] = $lang_domain;
221 221
             $languages[$lang_id][$lang_domain] = $lang_domain;
222 222
           }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
   }
227 227
   $dir->close();
228 228
 
229
-  foreach($language_domains as $lang_domain) {
229
+  foreach ($language_domains as $lang_domain) {
230 230
     $template->assign_block_vars('domain', array(
231 231
       'NAME' => $lang_domain,
232 232
     ));
Please login to merge, or discard this patch.
classes/classConfig.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
165 165
 
166 166
     // Alliance bonus calculations
167
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
167
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
168 168
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
169
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
169
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
170 170
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
171 171
     'ali_bonus_members'            => 10, // Minimum alliance size to start using bonus
172 172
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     'eco_scale_storage'            => 1,
210 210
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
211
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
211
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
212 212
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
213 213
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
214 214
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
     'energy_basic_income'          => 0,
220 220
 
221 221
     // Bashing protection settings
222
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
223
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
224
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
225
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
226
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
222
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
223
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
224
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
225
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
226
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
227 227
 
228 228
     'Fleet_Cdr'   => 30,
229 229
     'fleet_speed' => 1,
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
     'fleet_update_interval' => 4,
232 232
     'fleet_update_lock'     => '', // SQL time when lock was acquired
233 233
 
234
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
235
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
234
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
235
+    'game_counter'          => 0, // Does built-in page hit counter is on?
236 236
     // Defaults
237 237
     'game_default_language' => 'ru',
238 238
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
     'game_maxSystem'      => 199,
247 247
     'game_maxPlanet'      => 15,
248 248
     // Game global settings
249
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
249
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
250 250
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
251 251
 
252 252
     'game_news_actual'        => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days
253
-    'game_news_overview'      => 3,    // How much last news to show in Overview page
254
-    'game_news_overview_show' => PERIOD_WEEK_2,    // How long news will be shown in Overview page in seconds. Default - 2 weeks
253
+    'game_news_overview'      => 3, // How much last news to show in Overview page
254
+    'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks
255 255
     // Noob protection
256
-    'game_noob_factor'        => 5,    // Multiplier to divide "stronger" and "weaker" users
256
+    'game_noob_factor'        => 5, // Multiplier to divide "stronger" and "weaker" users
257 257
     'game_noob_points'        => 5000, // Below this point user threated as noob. 0 to disable
258 258
 
259 259
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
     'payment_currency_exchange_wmu' => 30,
308 308
     'payment_currency_exchange_wmz' => 1,
309 309
 
310
-    'payment_lot_price' => 1,     // Lot price in default currency
311
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
310
+    'payment_lot_price' => 1, // Lot price in default currency
311
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
312 312
 
313 313
     'planet_capital_cost'          => 25000, // Cost in DM to move Capital to current planet
314
-    'planet_capital_mining_rate'   => 2.0,   // Capital Mining rates
315
-    'planet_capital_building_rate' => 2.0,   // Capital Building rates
314
+    'planet_capital_mining_rate'   => 2.0, // Capital Mining rates
315
+    'planet_capital_building_rate' => 2.0, // Capital Building rates
316 316
     'planet_teleport_cost'         => 50000, // Cost of planet teleportation
317 317
     'planet_teleport_timeout'      => 86400, // Timeout for next teleportation
318 318
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     'resource_multiplier'     => 1,
335 335
 
336 336
     //Roleplay system
337
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
337
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
338 338
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
339 339
 
340 340
     // Black Market - General
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function sys_user_vacation($user) {
13 13
   global $config;
14 14
 
15
-  if(sys_get_param_str('vacation') == 'leave') {
15
+  if (sys_get_param_str('vacation') == 'leave') {
16 16
     if ($user['vacation'] < SN_TIME_NOW) {
17 17
       $user['vacation'] = 0;
18 18
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
   }
22 22
 
23
-  if($user['vacation']) {
23
+  if ($user['vacation']) {
24 24
     // sn_sys_logout(false, true);
25 25
     // core_auth::logout(false, true);
26 26
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
164 164
   $user_new = db_user_by_id(db_insert_id());
165 165
 
166
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
166
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
167 167
     $options['galaxy'] = SN::$config->LastSettedGalaxyPos;
168 168
     $options['system'] = SN::$config->LastSettedSystemPos;
169 169
     $segment_size = floor(SN::$config->game_maxPlanet / 3);
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
     $segment++;
172 172
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
173 173
 
174
-    while(true) {
175
-      if($options['planet'] > SN::$config->game_maxPlanet) {
174
+    while (true) {
175
+      if ($options['planet'] > SN::$config->game_maxPlanet) {
176 176
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
177 177
         $options['system']++;
178 178
       }
179
-      if($options['system'] > SN::$config->game_maxSystem) {
179
+      if ($options['system'] > SN::$config->game_maxSystem) {
180 180
         $options['system'] = 1;
181 181
         $options['galaxy']++;
182 182
       }
183 183
       $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
184 184
 
185 185
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
186
-      if(!$galaxy_row['id']) {
186
+      if (!$galaxy_row['id']) {
187 187
         SN::$config->db_saveItem(array(
188 188
           'LastSettedGalaxyPos' => $options['galaxy'],
189 189
           'LastSettedSystemPos' => $options['system'],
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
   $username_safe = db_escape($username_unsafe);
207 207
   doquery("REPLACE INTO {{player_name_history}} SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
208 208
 
209
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
209
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
210 210
     doquery("INSERT INTO {{referrals}} SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
211 211
   }
212 212
 
Please login to merge, or discard this patch.
includes/vars.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1175,12 +1175,12 @@
 block discarded – undo
1175 1175
     ],
1176 1176
     // Defensive building list
1177 1177
     'defense'            => [UNIT_DEF_TURRET_MISSILE   => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1178
-                             UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1179
-                             UNIT_DEF_TURRET_ION       => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1178
+                              UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
1179
+                              UNIT_DEF_TURRET_ION       => UNIT_DEF_TURRET_ION, UNIT_DEF_TURRET_PLASMA => UNIT_DEF_TURRET_PLASMA,
1180 1180
 
1181
-                             UNIT_DEF_SHIELD_SMALL => UNIT_DEF_SHIELD_SMALL, UNIT_DEF_SHIELD_BIG => UNIT_DEF_SHIELD_BIG, UNIT_DEF_SHIELD_PLANET => UNIT_DEF_SHIELD_PLANET,
1181
+                              UNIT_DEF_SHIELD_SMALL => UNIT_DEF_SHIELD_SMALL, UNIT_DEF_SHIELD_BIG => UNIT_DEF_SHIELD_BIG, UNIT_DEF_SHIELD_PLANET => UNIT_DEF_SHIELD_PLANET,
1182 1182
 
1183
-                             UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,
1183
+                              UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,
1184 1184
     ],
1185 1185
 
1186 1186
     // Missiles list
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
           2 => 0.01,
583 583
         ],
584 584
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
585
-          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2,],
586
-          [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1,],
587
-          [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0,],
585
+          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2, ],
586
+          [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1, ],
587
+          [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0, ],
588 588
         ],
589 589
       ],
590 590
       FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES => [
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
           2 => 0.025,
597 597
         ],
598 598
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
599
-          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2,],
600
-          [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1,],
601
-          [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0,],
599
+          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2, ],
600
+          [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1, ],
601
+          [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0, ],
602 602
         ],
603 603
       ],
604 604
       FLT_EXPEDITION_OUTCOME_FOUND_DM        => [
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
     ],
644 644
 
645 645
     'planet_generator' => [
646
-      0  => [ // HomeWorld
646
+      0  => [// HomeWorld
647 647
         't_max_min'     => 40, // Tmax 40
648 648
         't_max_max'     => 40,
649 649
         't_delta_min'   => 40, // Tmin 0
650 650
         't_delta_max'   => 40,
651 651
         'size_min'      => $config->initial_fields,
652 652
         'size_max'      => $config->initial_fields,
653
-        'core_types'    => [PLANET_DENSITY_STANDARD,],
653
+        'core_types'    => [PLANET_DENSITY_STANDARD, ],
654 654
         'planet_images' => ['normaltemp'],
655 655
       ],
656 656
       1  => [
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
         ],
881 881
         'planet_images' => ['eis'],
882 882
       ],
883
-      16 => [ // Random planet - stranger; -35 avg
883
+      16 => [// Random planet - stranger; -35 avg
884 884
         't_max_min'     => -90,
885 885
         't_max_max'     => +40,
886 886
         't_delta_min'   => 2,
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
           PLANET_DENSITY_METAL_PERIDOT,
901 901
           PLANET_DENSITY_METAL_RAW,
902 902
         ],
903
-        'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis',],
903
+        'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis', ],
904 904
       ],
905 905
     ],
906 906
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_HYDROGEN,
924 924
         UNIT_PLANET_DENSITY_RARITY        => 30, // 1, // 40.00, // * 1/121 0,82645
925 925
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
926
-        UNIT_RESOURCES                    => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,],
926
+        UNIT_RESOURCES                    => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ],
927 927
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
928 928
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
929 929
       ],
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_METHANE,
933 933
         UNIT_PLANET_DENSITY_RARITY        => 130, // 6, // 6.67, // * 6,0	4,95868
934 934
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
935
-        UNIT_RESOURCES                    => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,],
935
+        UNIT_RESOURCES                    => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ],
936 936
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
937 937
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
938 938
       ],
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_ICE_WATER,
942 942
         UNIT_PLANET_DENSITY_RARITY        => 450, //20, // 2.00, // * 20,0	16,52893
943 943
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
944
-        UNIT_RESOURCES                    => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,],
944
+        UNIT_RESOURCES                    => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ],
945 945
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
946 946
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
947 947
       ],
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_RAW,
952 952
         UNIT_PLANET_DENSITY_RARITY        => 20, // 1, // 40.00, // *1,0	0,82645
953 953
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
954
-        UNIT_RESOURCES                    => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,],
954
+        UNIT_RESOURCES                    => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ],
955 955
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
956 956
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
957 957
       ],
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_SILICATE,
961 961
         UNIT_PLANET_DENSITY_RARITY        => 140, // 5.71, // * 7,0	5,78512
962 962
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
963
-        UNIT_RESOURCES                    => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,],
963
+        UNIT_RESOURCES                    => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ],
964 964
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
965 965
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
966 966
       ],
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_CRYSTAL_STONE,
970 970
         UNIT_PLANET_DENSITY_RARITY        => 500, // 1.90, // * 21,0	17,35537
971 971
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
972
-        UNIT_RESOURCES                    => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,],
972
+        UNIT_RESOURCES                    => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ],
973 973
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
974 974
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
975 975
       ],
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_STANDARD,
980 980
         UNIT_PLANET_DENSITY_RARITY        => 1000, // 1.0, // * 40,0	33,05785
981 981
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_NORMAL,
982
-        UNIT_RESOURCES                    => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,],
982
+        UNIT_RESOURCES                    => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ],
983 983
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
984 984
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
985 985
       ],
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_ORE,
990 990
         UNIT_PLANET_DENSITY_RARITY        => 550, // 2.11, // * 19,0	15,70248
991 991
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_AVERAGE,
992
-        UNIT_RESOURCES                    => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,],
992
+        UNIT_RESOURCES                    => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ],
993 993
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 999,
994 994
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0,
995 995
       ],
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_PERIDOT,
999 999
         UNIT_PLANET_DENSITY_RARITY        => 120, // 8.00, // * 5,0	4,13223
1000 1000
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_GOOD,
1001
-        UNIT_RESOURCES                    => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,],
1001
+        UNIT_RESOURCES                    => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ],
1002 1002
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 200,
1003 1003
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6,
1004 1004
       ],
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
         UNIT_PLANET_DENSITY_INDEX         => PLANET_DENSITY_METAL_RAW,
1008 1008
         UNIT_PLANET_DENSITY_RARITY        => 25, // 40.00, // * 1,0	0,82645
1009 1009
         UNIT_PLANET_DENSITY_RICHNESS      => PLANET_DENSITY_RICHNESS_PERFECT,
1010
-        UNIT_RESOURCES                    => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,],
1010
+        UNIT_RESOURCES                    => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ],
1011 1011
         UNIT_PLANET_DENSITY_MAX_SECTORS   => 150,
1012 1012
         UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11,
1013 1013
       ],
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
     ],
1185 1185
 
1186 1186
     // Missiles list
1187
-    'missile'            => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,],
1187
+    'missile'            => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ],
1188 1188
 
1189 1189
     // Combat units list
1190 1190
     'combat'             => [
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
     // Resource list
1234 1234
     'resources'          => [0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'],
1235 1235
     // Resources all
1236
-    'resources_all'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,],
1236
+    'resources_all'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ],
1237 1237
     // Resources can be produced on planet
1238 1238
     'resources_planet'   => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY],
1239 1239
     // Resources can be looted from planet
@@ -1252,13 +1252,13 @@  discard block
 block discarded – undo
1252 1252
     ],
1253 1253
 
1254 1254
     // Resources that can be tradeable in market trader AND be a quest_rewards
1255
-    'quest_rewards'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,],
1255
+    'quest_rewards'      => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ],
1256 1256
 
1257 1257
 //      // Ques list
1258 1258
 //      'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH),
1259 1259
 
1260
-    'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,],
1261
-    'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,],
1260
+    'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ],
1261
+    'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ],
1262 1262
 
1263 1263
     GROUP_GROUP_ID_TO_NAMES => [
1264 1264
       UNIT_STRUCTURES   => 'structures',
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
       UNIT_PLANS        => 'plans',
1273 1273
     ],
1274 1274
 
1275
-    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet',],
1275
+    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet', ],
1276 1276
 
1277 1277
     GROUP_UNIT_COMBAT_SORT_ORDER => [
1278 1278
       SHIP_SPY,
Please login to merge, or discard this patch.
includes/pages/imperator.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 //    $same_user = false;
48 48
 //  }
49 49
 
50
-  if(!$user_data) {
50
+  if (!$user_data) {
51 51
     messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10);
52 52
     die();
53 53
   }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
   $stat_array = array();
59 59
   $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;");
60 60
   $stat_count = SN::$db->db_affected_rows();
61
-  while($row = db_fetch($query)) {
62
-    foreach($stat_fields as $field_db_name => $field_template_name) {
61
+  while ($row = db_fetch($query)) {
62
+    foreach ($stat_fields as $field_db_name => $field_template_name) {
63 63
       // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS
64 64
       $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name];
65 65
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
   $stat_array_date = $stat_array['STAT_DATE'];
69 69
   empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false;
70
-  foreach($stat_array_date['DATA'] as $key => $value) {
70
+  foreach ($stat_array_date['DATA'] as $key => $value) {
71 71
     $template->assign_block_vars('stat_date', array(
72 72
       'ID' => $key,
73 73
       'VALUE' => $value,
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 
78 78
   unset($stat_array['STAT_DATE']);
79 79
   $template_data = array();
80
-  foreach($stat_array as $stat_type => &$stat_type_data) {
80
+  foreach ($stat_array as $stat_type => &$stat_type_data) {
81 81
     $reverse_min_max = strpos($stat_type, '_RANK') !== false;
82 82
     $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']);
83 83
     $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']);
84 84
     $stat_type_data['AVG'] = avg($stat_type_data['DATA']);
85
-    foreach($stat_type_data['DATA'] as $key => $value) {
85
+    foreach ($stat_type_data['DATA'] as $key => $value) {
86 86
       $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100;
87 87
       $template_data[$stat_type][$key]['ID'] = $key;
88 88
       $template_data[$stat_type][$key]['VALUE'] = $value;
89
-      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN']  - $value : $value - $stat_type_data['MAX']);
89
+      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']);
90 90
       $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key];
91 91
     }
92 92
   }
93 93
 
94
-  foreach($template_data as $stat_type => $stat_type_data) {
94
+  foreach ($template_data as $stat_type => $stat_type_data) {
95 95
     $template->assign_block_vars('stat', array(
96 96
       'TYPE' => $stat_type,
97 97
       'TEXT' => $lang['imp_stat_types'][$stat_type],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
       'MAX' => $stat_array[$stat_type]['MAX'],
100 100
       'AVG' => $stat_array[$stat_type]['AVG'],
101 101
     ));
102
-    foreach($stat_type_data as $stat_entry) {
102
+    foreach ($stat_type_data as $stat_entry) {
103 103
       $template->assign_block_vars('stat.entry', $stat_entry);
104 104
     }
105 105
   }
106 106
 
107 107
 
108
-  if($same_user) {
108
+  if ($same_user) {
109 109
     rpg_level_up($user, RPG_STRUCTURE);
110 110
     rpg_level_up($user, RPG_RAID);
111 111
     rpg_level_up($user, RPG_TECH);
@@ -142,29 +142,29 @@  discard block
 block discarded – undo
142 142
     'builder_xp'           => HelperString::numberFloorAndFormat($user_data['xpminier']),
143 143
     'builder_lvl'          => HelperString::numberFloorAndFormat($user_data['lvl_minier']),
144 144
     'builder_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])),
145
-    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)),
145
+    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)),
146 146
     'raid_xp'              => HelperString::numberFloorAndFormat($user_data['xpraid']),
147 147
     'raid_lvl'             => HelperString::numberFloorAndFormat($user_data['lvl_raid']),
148
-    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)),
148
+    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)),
149 149
     'raids'                => HelperString::numberFloorAndFormat($user_data['raids']),
150 150
     'raidswin'             => HelperString::numberFloorAndFormat($user_data['raidswin']),
151 151
     'raidsloose'           => HelperString::numberFloorAndFormat($user_data['raidsloose']),
152 152
     'tech_xp'              => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']),
153 153
     'tech_lvl'             => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']),
154 154
     'tech_lvl_st'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])),
155
-    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)),
155
+    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)),
156 156
 
157 157
     'explore_xp'           => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']),
158 158
     'explore_lvl'          => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']),
159 159
     'explore_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])),
160
-    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)),
161
-
162
-    'build_points'         => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ),
163
-    'tech_points'          => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ),
164
-    'fleet_points'         => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ),
165
-    'defs_points'          => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ),
166
-    'res_points'           => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ),
167
-    'total_points'         => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ),
160
+    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)),
161
+
162
+    'build_points'         => HelperString::numberFloorAndFormat($StatRecord['build_points']),
163
+    'tech_points'          => HelperString::numberFloorAndFormat($StatRecord['tech_points']),
164
+    'fleet_points'         => HelperString::numberFloorAndFormat($StatRecord['fleet_points']),
165
+    'defs_points'          => HelperString::numberFloorAndFormat($StatRecord['defs_points']),
166
+    'res_points'           => HelperString::numberFloorAndFormat($StatRecord['res_points']),
167
+    'total_points'         => HelperString::numberFloorAndFormat($StatRecord['total_points']),
168 168
     'user_rank'            => $StatRecord['total_rank'],
169 169
     'RANK_DIFF'            => $StatRecord['total_old_rank'] - $StatRecord['total_rank'],
170 170
 
Please login to merge, or discard this patch.