Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created
includes/includes/sys_avatar.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar')
4
-{
3
+function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') {
5 4
   global $config, $lang, $user;
6 5
 
7 6
   try
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
       }
18 17
       $avatar_field = 0;
19 18
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20
-    }
21
-    elseif($_FILES['avatar']['size'])
19
+    } elseif($_FILES['avatar']['size'])
22 20
     {
23 21
       if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 22
       {
@@ -61,8 +59,7 @@  discard block
 block discarded – undo
61 59
       imagedestroy($avatar_image);
62 60
       throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE);
63 61
     }
64
-  }
65
-  catch (Exception $e)
62
+  } catch (Exception $e)
66 63
   {
67 64
     return array(
68 65
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
Please login to merge, or discard this patch.
includes/includes/flt_mission_colonize.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 // ----------------------------------------------------------------------------------------------------------------
11 11
 // Mission Case 9: -> Coloniser
12 12
 //
13
-function flt_mission_colonize(&$mission_data)
14
-{
13
+function flt_mission_colonize(&$mission_data) {
15 14
   $fleet_row          = &$mission_data['fleet'];
16 15
   $src_user_row       = &$mission_data['src_user'];
17 16
 
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));}
4
-function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
5
-{
4
+function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {
6 5
   global $lang;
7 6
 
8 7
   $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array(
@@ -20,8 +19,7 @@  discard block
 block discarded – undo
20 19
 }
21 20
 
22 21
 function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));}
23
-function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode)
24
-{
22
+function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) {
25 23
   global $lang;
26 24
 
27 25
   $unit_list = sn_get_groups($mode);
@@ -43,15 +41,13 @@  discard block
 block discarded – undo
43 41
 }
44 42
 
45 43
 function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));}
46
-function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode)
47
-{
44
+function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {
48 45
   if($unit_amount && in_array($unit_id, sn_get_groups($mode)))
49 46
   {
50 47
     $unit_amount = round($unit_amount);
51 48
     $unit_name = get_unit_param($unit_id, P_NAME);
52 49
     $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))";
53
-  }
54
-  else
50
+  } else
55 51
   {
56 52
     $result = '';
57 53
   }
Please login to merge, or discard this patch.
simulator.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
   $sym_defender = $unpacked['D'];
23 23
   $sym_attacker = $unpacked['A'];
24
-}
25
-else
24
+} else
26 25
 {
27 26
   $sym_defender = array(0 => $sym_defender);
28 27
   $sym_attacker = array(1 => $sym_attacker);
@@ -62,8 +61,7 @@  discard block
 block discarded – undo
62 61
   ));
63 62
 
64 63
   display($template);
65
-}
66
-else
64
+} else
67 65
 {
68 66
   $template = gettemplate('simulator', true);
69 67
   $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL);
Please login to merge, or discard this patch.
classes/classSupernova.php 1 patch
Braces   +78 added lines, -50 removed lines patch added patch discarded remove patch
@@ -188,14 +188,18 @@  discard block
 block discarded – undo
188 188
   // Перепаковывает массив на заданную глубину, убирая поля с null
189 189
   public static function array_repack(&$array, $level = 0) {
190 190
     // TODO $lock_table не нужна тут
191
-    if(!is_array($array)) return;
191
+    if(!is_array($array)) {
192
+      return;
193
+    }
192 194
 
193 195
     foreach($array as $key => &$value) {
194 196
       if($value === null) {
195 197
         unset($array[$key]);
196 198
       } elseif($level > 0 && is_array($value)) {
197 199
         static::array_repack($value, $level - 1);
198
-        if(empty($value)) unset($array[$key]);
200
+        if(empty($value)) {
201
+          unset($array[$key]);
202
+        }
199 203
       }
200 204
     }
201 205
   }
@@ -204,7 +208,9 @@  discard block
 block discarded – undo
204 208
   // TODO Вынести в отдельный объект
205 209
   public static function cache_repack($location_type, $record_id = 0) {
206 210
     // Если есть $user_id - проверяем, а надо ли перепаковывать?
207
-    if($record_id && isset(static::$data[$location_type][$record_id]) && static::$data[$location_type][$record_id] !== null) return;
211
+    if($record_id && isset(static::$data[$location_type][$record_id]) && static::$data[$location_type][$record_id] !== null) {
212
+      return;
213
+    }
208 214
 
209 215
     static::array_repack(static::$data[$location_type]);
210 216
     static::array_repack(static::$locator[$location_type], 3); // TODO У каждого типа локации - своя глубина!!!! Но можно и глубже ???
@@ -249,7 +255,9 @@  discard block
 block discarded – undo
249 255
   */
250 256
   public static function cache_set($location_type, $record_id, $record, $force_overwrite = false, $skip_lock = false) {
251 257
     // нет идентификатора - выход
252
-    if(!($record_id = $record[static::$location_info[$location_type][P_ID]])) return;
258
+    if(!($record_id = $record[static::$location_info[$location_type][P_ID]])) {
259
+      return;
260
+    }
253 261
 
254 262
     $in_transaction = static::db_transaction_check(false);
255 263
     if(
@@ -283,8 +291,9 @@  discard block
 block discarded – undo
283 291
     return static::$locks[$location_type][$record_id] = true; // Не всегда - от результата
284 292
   }
285 293
   public static function cache_lock_unset($location_type, $record_id) {
286
-    if(isset(static::$locks[$location_type][$record_id]))
287
-      unset(static::$locks[$location_type][$record_id]);
294
+    if(isset(static::$locks[$location_type][$record_id])) {
295
+          unset(static::$locks[$location_type][$record_id]);
296
+    }
288 297
     return true; // Не всегда - от результата
289 298
   }
290 299
   public static function cache_lock_unset_all() {
@@ -454,8 +463,9 @@  discard block
 block discarded – undo
454 463
 
455 464
           while($row = db_fetch($query)) {
456 465
             // Исключаем из списка родительских ИД уже заблокированные записи
457
-            if(!static::cache_lock_get($owner_location_type, $row['parent_id']))
458
-              $parent_id_list[$row['parent_id']] = $row['parent_id'];
466
+            if(!static::cache_lock_get($owner_location_type, $row['parent_id'])) {
467
+                          $parent_id_list[$row['parent_id']] = $row['parent_id'];
468
+            }
459 469
           }
460 470
 
461 471
           // Если все-таки какие-то записи еще не заблокированы - вынимаем текущие версии из базы
@@ -483,7 +493,9 @@  discard block
 block discarded – undo
483 493
       if(is_array($query_cache)) {
484 494
         foreach($query_cache as $key => $value) {
485 495
           $result[$key] = $value;
486
-          if($fetch) break;
496
+          if($fetch) {
497
+            break;
498
+          }
487 499
         }
488 500
       }
489 501
       return $fetch ? (is_array($result) ? reset($result) : false) : $result;
@@ -491,12 +503,15 @@  discard block
 block discarded – undo
491 503
   }
492 504
 
493 505
   public static function db_upd_record_by_id($location_type, $record_id, $set) {
494
-    if(!($record_id = idval($record_id)) || !($set = trim($set))) return false;
506
+    if(!($record_id = idval($record_id)) || !($set = trim($set))) {
507
+      return false;
508
+    }
495 509
 
496 510
     $location_info = &static::$location_info[$location_type];
497 511
     $id_field = $location_info[P_ID];
498 512
     $table_name = $location_info[P_TABLE_NAME];
499
-    if($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
513
+    if($result = static::db_query_update("UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
514
+      // TODO Как-то вернуть может быть LIMIT 1 ?
500 515
     {
501 516
       if(static::$db->db_affected_rows()) {
502 517
         // Обновляем данные только если ряд был затронут
@@ -504,6 +519,7 @@  discard block
 block discarded – undo
504 519
 
505 520
         // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее
506 521
         static::$data[$location_type][$record_id] = null;
522
+    }
507 523
         // Вытаскиваем обновленную запись
508 524
         static::db_get_record_by_id($location_type, $record_id);
509 525
         static::cache_clear($location_type, false); // Мягкий сброс - только $queries
@@ -513,7 +529,9 @@  discard block
 block discarded – undo
513 529
     return $result;
514 530
   }
515 531
   public static function db_upd_record_list($location_type, $condition, $set) {
516
-    if(!($set = trim($set))) return false;
532
+    if(!($set = trim($set))) {
533
+      return false;
534
+    }
517 535
 
518 536
     $condition = trim($condition);
519 537
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
@@ -534,9 +552,11 @@  discard block
 block discarded – undo
534 552
     $set = trim($set);
535 553
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
536 554
     if($result = static::db_query_insert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
537
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
555
+      if(static::$db->db_affected_rows()) {
556
+        // Обновляем данные только если ряд был затронут
538 557
       {
539 558
         $record_id = db_insert_id();
559
+      }
540 560
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
541 561
         $result = static::db_get_record_by_id($location_type, $record_id);
542 562
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -548,37 +568,43 @@  discard block
 block discarded – undo
548 568
     return $result;
549 569
   }
550 570
 
551
-  public static function db_del_record_by_id($location_type, $safe_record_id)
552
-  {
553
-    if(!($safe_record_id = idval($safe_record_id))) return false;
571
+  public static function db_del_record_by_id($location_type, $safe_record_id) {
572
+    if(!($safe_record_id = idval($safe_record_id))) {
573
+      return false;
574
+    }
554 575
 
555 576
     $location_info = &static::$location_info[$location_type];
556 577
     $id_field = $location_info[P_ID];
557 578
     $table_name = $location_info[P_TABLE_NAME];
558 579
     if($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}"))
559 580
     {
560
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
581
+      if(static::$db->db_affected_rows()) {
582
+        // Обновляем данные только если ряд был затронут
561 583
       {
562 584
         static::cache_unset($location_type, $safe_record_id);
563 585
       }
586
+      }
564 587
     }
565 588
 
566 589
     return $result;
567 590
   }
568
-  public static function db_del_record_list($location_type, $condition)
569
-  {
570
-    if(!($condition = trim($condition))) return false;
591
+  public static function db_del_record_list($location_type, $condition) {
592
+    if(!($condition = trim($condition))) {
593
+      return false;
594
+    }
571 595
 
572 596
     $location_info = &static::$location_info[$location_type];
573 597
     $table_name = $location_info[P_TABLE_NAME];
574 598
 
575 599
     if($result = static::db_query_delete("DELETE FROM `{{{$table_name}}}` WHERE {$condition}"))
576 600
     {
577
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
601
+      if(static::$db->db_affected_rows()) {
602
+        // Обновляем данные только если ряд был затронут
578 603
       {
579 604
         // Обнуление кэша, потому что непонятно, что поменялось
580 605
         static::cache_clear($location_type);
581 606
       }
607
+      }
582 608
     }
583 609
 
584 610
     return $result;
@@ -604,8 +630,7 @@  discard block
 block discarded – undo
604 630
    *    <p>false - Нет записи с указанным ID и $player</p>
605 631
    *    <p>array - запись типа $user</p>
606 632
    */
607
-  public static function db_get_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null)
608
-  {
633
+  public static function db_get_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) {
609 634
     $user = static::db_get_record_by_id(LOC_USER, $user_id_unsafe, $for_update, $fields);
610 635
 
611 636
     return (is_array($user) &&
@@ -617,14 +642,15 @@  discard block
 block discarded – undo
617 642
       ($player === false && $user['user_as_ally'])
618 643
     )) ? $user : false;
619 644
   }
620
-  public static function db_get_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false)
621
-  {
645
+  public static function db_get_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false) {
622 646
     // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ?
623
-    if(!($username_unsafe = trim($username_unsafe))) return false;
647
+    if(!($username_unsafe = trim($username_unsafe))) {
648
+      return false;
649
+    }
624 650
 
625 651
     $user = null;
626
-    if(is_array(static::$data[LOC_USER]))
627
-    foreach(static::$data[LOC_USER] as $user_id => $user_data)
652
+    if(is_array(static::$data[LOC_USER])) {
653
+        foreach(static::$data[LOC_USER] as $user_id => $user_data)
628 654
     {
629 655
       if(is_array($user_data) && isset($user_data['username']))
630 656
       {
@@ -634,6 +660,7 @@  discard block
 block discarded – undo
634 660
         {
635 661
           // $user_as_ally = intval($user_data['user_as_ally']);
636 662
           $user_as_ally = idval($user_data['user_as_ally']);
663
+    }
637 664
           if($player === null || ($player === true && !$user_as_ally) || ($player === false && $user_as_ally))
638 665
           {
639 666
             $user = $user_data;
@@ -659,7 +686,9 @@  discard block
 block discarded – undo
659 686
   }
660 687
   // UNUSED
661 688
   public static function db_get_user_by_email($email_unsafe, $use_both = false, $for_update = false, $fields = '*') {
662
-    if(!($email_unsafe = strtolower(trim($email_unsafe)))) return false;
689
+    if(!($email_unsafe = strtolower(trim($email_unsafe)))) {
690
+      return false;
691
+    }
663 692
 
664 693
     $user = null;
665 694
     if(is_array(static::$data[LOC_USER])) {
@@ -718,15 +747,13 @@  discard block
 block discarded – undo
718 747
 
719 748
 
720 749
 
721
-  public static function db_unit_time_restrictions($date = SN_TIME_NOW)
722
-  {
750
+  public static function db_unit_time_restrictions($date = SN_TIME_NOW) {
723 751
     $date = is_numeric($date) ? "FROM_UNIXTIME({$date})" : "'{$date}'";
724 752
     return
725 753
       "(unit_time_start IS NULL OR unit_time_start <= {$date}) AND
726 754
     (unit_time_finish IS NULL OR unit_time_finish = '1970-01-01 03:00:00' OR unit_time_finish >= {$date})";
727 755
   }
728
-  public static function db_get_unit_by_id($unit_id, $for_update = false, $fields = '*')
729
-  {
756
+  public static function db_get_unit_by_id($unit_id, $for_update = false, $fields = '*') {
730 757
     // TODO запихивать в $data[LOC_LOCATION][$location_type][$location_id]
731 758
     $unit = static::db_get_record_by_id(LOC_UNIT, $unit_id, $for_update, $fields);
732 759
     if(is_array($unit))
@@ -737,9 +764,10 @@  discard block
 block discarded – undo
737 764
     return $unit;
738 765
   }
739 766
 
740
-  public static function db_get_unit_list_by_location($user_id = 0, $location_type, $location_id)
741
-  {
742
-    if(!($location_type = idval($location_type)) || !($location_id = idval($location_id))) return false;
767
+  public static function db_get_unit_list_by_location($user_id = 0, $location_type, $location_id) {
768
+    if(!($location_type = idval($location_type)) || !($location_id = idval($location_id))) {
769
+      return false;
770
+    }
743 771
 
744 772
     $query_cache = &static::$locator[LOC_UNIT][$location_type][$location_id];
745 773
     if(!isset($query_cache))
@@ -764,8 +792,7 @@  discard block
 block discarded – undo
764 792
 
765 793
     return $result;
766 794
   }
767
-  public static function db_get_unit_by_location($user_id = 0, $location_type, $location_id, $unit_snid = 0, $for_update = false, $fields = '*')
768
-  {
795
+  public static function db_get_unit_by_location($user_id = 0, $location_type, $location_id, $unit_snid = 0, $for_update = false, $fields = '*') {
769 796
     static::db_get_unit_list_by_location($user_id, $location_type, $location_id);
770 797
 
771 798
     return $unit_snid ? static::$locator[LOC_UNIT][$location_type][$location_id][$unit_snid] : static::$locator[LOC_UNIT][$location_type][$location_id];
@@ -793,8 +820,7 @@  discard block
 block discarded – undo
793 820
    * TODO Переформатировать вывод данных, что бы можно было возвращать данные по всем планетам и юзерам в одном запросе: добавить подмассивы 'que', 'planets', 'players'
794 821
    *
795 822
    */
796
-  public static function db_que_list_by_type_location($user_id, $planet_id = null, $que_type = false, $for_update = false)
797
-  {
823
+  public static function db_que_list_by_type_location($user_id, $planet_id = null, $que_type = false, $for_update = false) {
798 824
     if(!$user_id)
799 825
     {
800 826
       pdump(debug_backtrace());
@@ -805,15 +831,18 @@  discard block
 block discarded – undo
805 831
 
806 832
     $query = array();
807 833
 
808
-    if($user_id = idval($user_id))
809
-      $query[] = "`que_player_id` = {$user_id}";
834
+    if($user_id = idval($user_id)) {
835
+          $query[] = "`que_player_id` = {$user_id}";
836
+    }
810 837
 
811
-    if($que_type == QUE_RESEARCH || $planet_id === null)
812
-      $query[] = "`que_planet_id` IS NULL";
813
-    elseif($planet_id)
814
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
815
-    if($que_type)
816
-      $query[] = "`que_type` = {$que_type}";
838
+    if($que_type == QUE_RESEARCH || $planet_id === null) {
839
+          $query[] = "`que_planet_id` IS NULL";
840
+    } elseif($planet_id) {
841
+          $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
842
+    }
843
+    if($que_type) {
844
+          $query[] = "`que_type` = {$que_type}";
845
+    }
817 846
 
818 847
     $ques['items'] = static::db_get_record_list(LOC_QUE, implode(' AND ', $query));
819 848
 
@@ -861,8 +890,7 @@  discard block
 block discarded – undo
861 890
 
862 891
 
863 892
 
864
-  public static function db_changeset_revert()
865
-  {
893
+  public static function db_changeset_revert() {
866 894
     // TODO Для этапа 1 - достаточно чистить только те таблицы, что были затронуты
867 895
     // Для этапа 2 - чистить только записи
868 896
     // Для этапа 3 - возвращать всё
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
     {
@@ -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
     global $config;
126 121
 
127 122
     if ($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;
300 292
 
@@ -362,8 +354,7 @@  discard block
 block discarded – undo
362 354
   * Compile blocks
363 355
   * @access private
364 356
   */
365
-  function compile_tag_block($tag_args)
366
-  {
357
+  function compile_tag_block($tag_args) {
367 358
     $no_nesting = false;
368 359
 
369 360
     // Is the designer wanting to call another loop in a loop?
@@ -386,8 +377,7 @@  discard block
 block discarded – undo
386 377
       if ($match[2] < 0)
387 378
       {
388 379
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
389
-      }
390
-      else
380
+      } else
391 381
       {
392 382
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
393 383
       }
@@ -395,17 +385,14 @@  discard block
 block discarded – undo
395 385
       if (strlen($match[3]) < 1 || $match[3] == -1)
396 386
       {
397 387
         $loop_end = '$_' . $tag_args . '_count';
398
-      }
399
-      else if ($match[3] >= 0)
388
+      } else if ($match[3] >= 0)
400 389
       {
401 390
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
402
-      }
403
-      else //if ($match[3] < -1)
391
+      } else //if ($match[3] < -1)
404 392
       {
405 393
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
406 394
       }
407
-    }
408
-    else
395
+    } else
409 396
     {
410 397
       $loop_start = 0;
411 398
       $loop_end = '$_' . $tag_args . '_count';
@@ -418,8 +405,7 @@  discard block
 block discarded – undo
418 405
     {
419 406
       // We need to implode $no_nesting times from the end...
420 407
       $block = array_slice($this->block_names, -$no_nesting);
421
-    }
422
-    else
408
+    } else
423 409
     {
424 410
       $block = $this->block_names;
425 411
     }
@@ -429,8 +415,7 @@  discard block
 block discarded – undo
429 415
       // Block is not nested.
430 416
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
431 417
       $varref = "\$this->_tpldata['$tag_args']";
432
-    }
433
-    else
418
+    } else
434 419
     {
435 420
       // This block is nested.
436 421
       // Generate a namespace string for this block.
@@ -469,8 +454,7 @@  discard block
 block discarded – undo
469 454
   * some adaptions for our block level methods
470 455
   * @access private
471 456
   */
472
-  function compile_tag_if($tag_args, $elseif)
473
-  {
457
+  function compile_tag_if($tag_args, $elseif) {
474 458
     // Tokenize args for 'if' tag.
475 459
     preg_match_all('/(?:
476 460
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -578,8 +562,7 @@  discard block
 block discarded – undo
578 562
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
579 563
           {
580 564
             $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] . '\']');
581
-          }
582
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
565
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
583 566
           {
584 567
             // Allow checking if loops are set with .loopname
585 568
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -595,8 +578,7 @@  discard block
 block discarded – undo
595 578
 
596 579
               // Add the block reference for the last child.
597 580
               $varref .= "['" . $block . "']";
598
-            }
599
-            else
581
+            } else
600 582
             {
601 583
               $varref = '$this->_tpldata';
602 584
 
@@ -604,8 +586,7 @@  discard block
 block discarded – undo
604 586
               $varref .= "['" . $blocks[0] . "']";
605 587
             }
606 588
             $token = "sizeof($varref)";
607
-          }
608
-          else if (!empty($token))
589
+          } else if (!empty($token))
609 590
           {
610 591
             $token = '(' . $token . ')';
611 592
           }
@@ -626,8 +607,7 @@  discard block
 block discarded – undo
626 607
   * Compile DEFINE tags
627 608
   * @access private
628 609
   */
629
-  function compile_tag_define($tag_args, $op)
630
-  {
610
+  function compile_tag_define($tag_args, $op) {
631 611
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
632 612
 
633 613
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -650,8 +630,7 @@  discard block
 block discarded – undo
650 630
 
651 631
       // Now replace the php code
652 632
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
653
-    }
654
-    else
633
+    } else
655 634
     {
656 635
       preg_match('#true|false|\.#i', $match[4], $type);
657 636
 
@@ -679,8 +658,7 @@  discard block
 block discarded – undo
679 658
   * Compile INCLUDE tag
680 659
   * @access private
681 660
   */
682
-  function compile_tag_include($tag_args)
683
-  {
661
+  function compile_tag_include($tag_args) {
684 662
     // Process dynamic includes
685 663
     if ($tag_args[0] == '$')
686 664
     {
@@ -694,8 +672,7 @@  discard block
 block discarded – undo
694 672
   * Compile INCLUDE_PHP tag
695 673
   * @access private
696 674
   */
697
-  function compile_tag_include_php($tag_args)
698
-  {
675
+  function compile_tag_include_php($tag_args) {
699 676
     return "\$this->_php_include('$tag_args');";
700 677
   }
701 678
 
@@ -704,8 +681,7 @@  discard block
 block discarded – undo
704 681
   * This is from Smarty
705 682
   * @access private
706 683
   */
707
-  function _parse_is_expr($is_arg, $tokens)
708
-  {
684
+  function _parse_is_expr($is_arg, $tokens) {
709 685
     $expr_end = 0;
710 686
     $negate_expr = false;
711 687
 
@@ -713,8 +689,7 @@  discard block
 block discarded – undo
713 689
     {
714 690
       $negate_expr = true;
715 691
       $expr_type = array_shift($tokens);
716
-    }
717
-    else
692
+    } else
718 693
     {
719 694
       $expr_type = $first_token;
720 695
     }
@@ -727,8 +702,7 @@  discard block
 block discarded – undo
727 702
           $expr_end++;
728 703
           $expr_arg = $tokens[$expr_end++];
729 704
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
730
-        }
731
-        else
705
+        } else
732 706
         {
733 707
           $expr = "!($is_arg & 1)";
734 708
         }
@@ -740,8 +714,7 @@  discard block
 block discarded – undo
740 714
           $expr_end++;
741 715
           $expr_arg = $tokens[$expr_end++];
742 716
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
743
-        }
744
-        else
717
+        } else
745 718
         {
746 719
           $expr = "($is_arg & 1)";
747 720
         }
@@ -775,8 +748,7 @@  discard block
 block discarded – undo
775 748
   * NOTE: expects a trailing "." on the namespace.
776 749
   * @access private
777 750
   */
778
-  function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
779
-  {
751
+  function generate_block_varref($namespace, $varname, $echo = true, $defop = false) {
780 752
     // Strip the trailing period.
781 753
     $namespace = substr($namespace, 0, -1);
782 754
 
@@ -800,8 +772,7 @@  discard block
 block discarded – undo
800 772
   * NOTE: does not expect a trailing "." on the blockname.
801 773
   * @access private
802 774
   */
803
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
804
-  {
775
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
805 776
     // Get an array of the blocks involved.
806 777
     $blocks = explode('.', $blockname);
807 778
     $blockcount = sizeof($blocks) - 1;
@@ -823,12 +794,10 @@  discard block
 block discarded – undo
823 794
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
824 795
       }
825 796
       return $varref;
826
-    }
827
-    else if ($include_last_iterator)
797
+    } else if ($include_last_iterator)
828 798
     {
829 799
       return '$_'. $blocks[$blockcount] . '_val';
830
-    }
831
-    else
800
+    } else
832 801
     {
833 802
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
834 803
     }
@@ -838,8 +807,7 @@  discard block
 block discarded – undo
838 807
   * Write compiled file to cache directory
839 808
   * @access private
840 809
   */
841
-  function compile_write($handle, $data)
842
-  {
810
+  function compile_write($handle, $data) {
843 811
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
844 812
 
845 813
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -863,8 +831,7 @@  discard block
 block discarded – undo
863 831
   * Minifies template w/i PHP code by removing extra spaces
864 832
   * @access private
865 833
   */
866
-  function minify($html)
867
-  {
834
+  function minify($html) {
868 835
     global $config;
869 836
 
870 837
     if(!$config->tpl_minifier)
Please login to merge, or discard this patch.
classes/template.php 1 patch
Braces   +29 added lines, -58 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 * Base Template class.
23 23
 * @package phpBB3
24 24
 */
25
-class template
26
-{
25
+class template {
27 26
   /** variable that holds all the data we'll be substituting into
28 27
   * the compiled templates. Takes form:
29 28
   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
@@ -82,8 +81,7 @@  discard block
 block discarded – undo
82 81
   * Set template location
83 82
   * @access public
84 83
   */
85
-  function set_template()
86
-  {
84
+  function set_template() {
87 85
     global $user;
88 86
 
89 87
     if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template'))
@@ -108,8 +106,7 @@  discard block
 block discarded – undo
108 106
       {
109 107
         $this->inherit_root = $this->rootPhysical . 'styles/' . $user->theme['template_inherit_path'] . '/template';
110 108
       }
111
-    }
112
-    else
109
+    } else
113 110
     {
114 111
       trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
115 112
     }
@@ -123,8 +120,7 @@  discard block
 block discarded – undo
123 120
   * Set custom template location (able to use directory outside of phpBB)
124 121
   * @access public
125 122
   */
126
-  function set_custom_template($template_path, $template_name, $fallback_template_path = false)
127
-  {
123
+  function set_custom_template($template_path, $template_name, $fallback_template_path = false) {
128 124
     global $user;
129 125
 
130 126
     // Make sure $template_path has no ending slash
@@ -145,8 +141,7 @@  discard block
 block discarded – undo
145 141
 
146 142
       $this->inherit_root = $fallback_template_path;
147 143
       $this->orig_tpl_inherits_id = true;
148
-    }
149
-    else
144
+    } else
150 145
     {
151 146
       $this->orig_tpl_inherits_id = false;
152 147
     }
@@ -165,8 +160,7 @@  discard block
 block discarded – undo
165 160
   * should be a hash of handle => filename pairs.
166 161
   * @access public
167 162
   */
168
-  function set_filenames($filename_array)
169
-  {
163
+  function set_filenames($filename_array) {
170 164
     if (!is_array($filename_array))
171 165
     {
172 166
       return false;
@@ -194,8 +188,7 @@  discard block
 block discarded – undo
194 188
   * Destroy template data set
195 189
   * @access public
196 190
   */
197
-  function destroy()
198
-  {
191
+  function destroy() {
199 192
     $this->_tpldata = array('.' => array(0 => array()));
200 193
     $this->_rootref = &$this->_tpldata['.'][0];
201 194
   }
@@ -204,8 +197,7 @@  discard block
 block discarded – undo
204 197
   * Reset/empty complete block
205 198
   * @access public
206 199
   */
207
-  function destroy_block_vars($blockname)
208
-  {
200
+  function destroy_block_vars($blockname) {
209 201
     if (strpos($blockname, '.') !== false)
210 202
     {
211 203
       // Nested block.
@@ -220,8 +212,7 @@  discard block
 block discarded – undo
220 212
       }
221 213
 
222 214
       unset($str[$blocks[$blockcount]]);
223
-    }
224
-    else
215
+    } else
225 216
     {
226 217
       // Top-level block.
227 218
       unset($this->_tpldata[$blockname]);
@@ -234,8 +225,7 @@  discard block
 block discarded – undo
234 225
   * Display handle
235 226
   * @access public
236 227
   */
237
-  function display($handle, $include_once = true)
238
-  {
228
+  function display($handle, $include_once = true) {
239 229
     global $phpbb_hook,
240 230
           // This is used for accessing from compiled templates via include
241 231
            $user, $lang, $config;
@@ -260,8 +250,7 @@  discard block
 block discarded – undo
260 250
     if ($filename = $this->_tpl_load($handle))
261 251
     {
262 252
       ($include_once) ? include_once($filename) : include($filename);
263
-    }
264
-    else
253
+    } else
265 254
     {
266 255
       eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
267 256
     }
@@ -273,8 +262,7 @@  discard block
 block discarded – undo
273 262
   * Display the handle and assign the output to a template variable or return the compiled result.
274 263
   * @access public
275 264
   */
276
-  function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
277
-  {
265
+  function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) {
278 266
     ob_start();
279 267
     $this->display($handle, $include_once);
280 268
     $contents = ob_get_clean();
@@ -293,8 +281,7 @@  discard block
 block discarded – undo
293 281
   * Load a compiled template if possible, if not, recompile it
294 282
   * @access private
295 283
   */
296
-  function _tpl_load(&$handle)
297
-  {
284
+  function _tpl_load(&$handle) {
298 285
     global $user, $config;
299 286
 
300 287
     if (!isset($this->filename[$handle]))
@@ -315,8 +302,7 @@  discard block
 block discarded – undo
315 302
     if (!file_exists($filename) || @filesize($filename) === 0)
316 303
     {
317 304
       $recompile = true;
318
-    }
319
-    else if ($config->load_tplcompile)
305
+    } else if ($config->load_tplcompile)
320 306
     {
321 307
       // No way around it: we need to check inheritance here
322 308
       if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
@@ -399,15 +385,13 @@  discard block
 block discarded – undo
399 385
               $this->files[$row['template_filename']] = $file;
400 386
               $this->files_inherit[$row['template_filename']] = $file;
401 387
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
402
-            }
403
-            else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
388
+            } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
404 389
             {
405 390
               // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that.
406 391
               $force_reload = true;
407 392
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
408 393
             }
409
-          }
410
-          else
394
+          } else
411 395
           {
412 396
             $this->files_template[$row['template_filename']] = $user->theme['template_id'];
413 397
           }
@@ -417,8 +401,7 @@  discard block
 block discarded – undo
417 401
             if ($row['template_filename'] == $this->filename[$handle])
418 402
             {
419 403
               $compile->_tpl_load_file($handle, true);
420
-            }
421
-            else
404
+            } else
422 405
             {
423 406
               $this->files[$row['template_filename']] = $file;
424 407
               $this->filename[$row['template_filename']] = $row['template_filename'];
@@ -433,8 +416,7 @@  discard block
 block discarded – undo
433 416
           {
434 417
             $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
435 418
             $compile->compile_write($handle, $this->compiled_code[$handle]);
436
-          }
437
-          else
419
+          } else
438 420
           {
439 421
             // Only bother compiling if it doesn't already exist
440 422
             if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
@@ -445,8 +427,7 @@  discard block
 block discarded – undo
445 427
             }
446 428
           }
447 429
         }
448
-      }
449
-      else
430
+      } else
450 431
       {
451 432
         $file = $this->root . '/' . $row['template_filename'];
452 433
 
@@ -473,8 +454,7 @@  discard block
 block discarded – undo
473 454
   * Assign key variable pairs from an array
474 455
   * @access public
475 456
   */
476
-  function assign_vars($vararray)
477
-  {
457
+  function assign_vars($vararray) {
478 458
     foreach ($vararray as $key => $val)
479 459
     {
480 460
       $this->_rootref[$key] = $val;
@@ -487,8 +467,7 @@  discard block
 block discarded – undo
487 467
   * Assign a single variable to a single key
488 468
   * @access public
489 469
   */
490
-  function assign_var($varname, $varval)
491
-  {
470
+  function assign_var($varname, $varval) {
492 471
     $this->_rootref[$varname] = $varval;
493 472
 
494 473
     return true;
@@ -498,8 +477,7 @@  discard block
 block discarded – undo
498 477
   * Assign key variable pairs from an array to a specified block
499 478
   * @access public
500 479
   */
501
-  function assign_block_vars($blockname, $vararray)
502
-  {
480
+  function assign_block_vars($blockname, $vararray) {
503 481
     if (strpos($blockname, '.') !== false)
504 482
     {
505 483
       // Nested block.
@@ -534,8 +512,7 @@  discard block
 block discarded – undo
534 512
       // We're adding a new iteration to this block with the given
535 513
       // variable assignments.
536 514
       $str[$blocks[$blockcount]][] = $vararray;
537
-    }
538
-    else
515
+    } else
539 516
     {
540 517
       // Top-level block.
541 518
       $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
@@ -589,8 +566,7 @@  discard block
 block discarded – undo
589 566
   * @return bool false on error, true on success
590 567
   * @access public
591 568
   */
592
-  function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
593
-  {
569
+  function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') {
594 570
     if (strpos($blockname, '.') !== false)
595 571
     {
596 572
       // Nested blocks are not supported
@@ -635,8 +611,7 @@  discard block
 block discarded – undo
635 611
         $key = sizeof($this->_tpldata[$blockname]);
636 612
         unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
637 613
         $vararray['S_LAST_ROW'] = true;
638
-      }
639
-      else if ($key === 0)
614
+      } else if ($key === 0)
640 615
       {
641 616
         unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
642 617
         $vararray['S_FIRST_ROW'] = true;
@@ -675,8 +650,7 @@  discard block
 block discarded – undo
675 650
   * Include a separate template
676 651
   * @access private
677 652
   */
678
-  function _tpl_include($filename, $include = true)
679
-  {
653
+  function _tpl_include($filename, $include = true) {
680 654
     global $lang, $config;
681 655
 
682 656
     $handle = $filename;
@@ -706,8 +680,7 @@  discard block
 block discarded – undo
706 680
   * Include a php-file
707 681
   * @access private
708 682
   */
709
-  function _php_include($filename)
710
-  {
683
+  function _php_include($filename) {
711 684
     $file = $this->rootPhysical . $filename;
712 685
 
713 686
     if (!file_exists($file))
@@ -723,8 +696,7 @@  discard block
 block discarded – undo
723 696
   * Assign key variable pairs from an array with block support
724 697
   * @access public
725 698
   */
726
-  function assign_recursive($values, $name = '')
727
-  {
699
+  function assign_recursive($values, $name = '') {
728 700
     if(isset($values['.']))
729 701
     {
730 702
       $values_extra = $values['.'];
@@ -734,8 +706,7 @@  discard block
 block discarded – undo
734 706
     if(!$name)
735 707
     {
736 708
       $this->assign_vars($values);
737
-    }
738
-    else
709
+    } else
739 710
     {
740 711
       $this->assign_block_vars($name, $values);
741 712
     }
Please login to merge, or discard this patch.
admin/planet_compensate.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
         'TEXT' => $error,
75 75
       ));
76 76
     }
77
-  }
78
-  else
77
+  } else
79 78
   {
80 79
     $template->assign_var('CHECK', 1);
81 80
 
@@ -132,8 +131,7 @@  discard block
 block discarded – undo
132 131
 
133 132
 display($template, $lang['adm_pl_comp_title']);
134 133
 
135
-function killer_add_planet($planet)
136
-{
134
+function killer_add_planet($planet) {
137 135
   global $final_cost;
138 136
 
139 137
   $final_cost = array();
Please login to merge, or discard this patch.
includes/pages/techtree.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
  * version 2.0 copyright (c) 2012 by Gorlum for http://supernova.ws
7 7
  */
8 8
 
9
-function sn_techtree_view($template = null)
10
-{
9
+function sn_techtree_view($template = null) {
11 10
   global $lang, $user, $planetrow;
12 11
 
13 12
   $tech_tree = array();
Please login to merge, or discard this patch.