Test Failed
Branch trunk (412648)
by SuperNova.WS
03:40
created
includes/includes/art_artifact.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 {
5 5
   global $lang;
6 6
 
7
-  if(!in_array($unit_id, sn_get_groups('artifacts')))
7
+  if (!in_array($unit_id, sn_get_groups('artifacts')))
8 8
   {
9 9
     return;
10 10
   }
@@ -13,24 +13,24 @@  discard block
 block discarded – undo
13 13
   $user = db_user_by_id($user['id'], true);
14 14
 
15 15
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
16
-  if($unit_level > 0)
16
+  if ($unit_level > 0)
17 17
   {
18 18
     $db_changeset = array();
19
-    switch($unit_id)
19
+    switch ($unit_id)
20 20
     {
21 21
       case ART_LHC:
22 22
       case ART_HOOK_SMALL:
23 23
       case ART_HOOK_MEDIUM:
24 24
       case ART_HOOK_LARGE:
25 25
         $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`');
26
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
26
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id'])
27 27
         {
28 28
           $unit_level--;
29 29
           $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : (
30 30
             $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)
31 31
           );
32 32
           $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance;
33
-          if($random <= $moon_chance)
33
+          if ($random <= $moon_chance)
34 34
           {
35 35
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 36
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
       case ART_RCD_MEDIUM:
52 52
       case ART_RCD_LARGE:
53 53
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
54
-        if($planetrow['planet_type'] != PT_PLANET)
54
+        if ($planetrow['planet_type'] != PT_PLANET)
55 55
         {
56 56
           $message = $lang['art_rcd_err_moon'];
57 57
           break;
58 58
         }
59 59
 
60 60
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
61
-        if(!empty($que['items']))
61
+        if (!empty($que['items']))
62 62
         {
63 63
           $message = $lang['art_rcd_err_que'];
64 64
           break;
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
         $artifact_deploy = get_unit_param($unit_id, P_DEPLOY);
68 68
 
69 69
         $sectors_used = 0;
70
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
70
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71 71
         {
72
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
72
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73 73
             continue;
74 74
           $sectors_used += $levels_deployed;
75 75
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
76 76
         }
77 77
 
78
-        if($sectors_used == 0)
78
+        if ($sectors_used == 0)
79 79
         {
80 80
           $message = $lang['art_rcd_err_no_sense'];
81 81
           break;
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
         $que_item = null;
91 91
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
92 92
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
93
-        if(!empty($current_que))
93
+        if (!empty($current_que))
94 94
         {
95 95
           reset($current_que);
96 96
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
97 97
         }
98 98
 
99
-        if(!empty($que_item) && $que_item['que_time_left'] > 60)
99
+        if (!empty($que_item) && $que_item['que_time_left'] > 60)
100 100
         {
101 101
           $unit_level--;
102 102
           $old_time = $que_item['que_time_left'];
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
118 118
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
119 119
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
120
-        if(!empty($current_que))
120
+        if (!empty($current_que))
121 121
         {
122 122
           reset($current_que);
123 123
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
124 124
         }
125 125
 
126
-        if(isset($que_item) && $que_item['que_time_left'] > 60)
126
+        if (isset($que_item) && $que_item['que_time_left'] > 60)
127 127
         {
128 128
           $unit_level--;
129 129
           $old_time = $que_item['que_time_left'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
       break;
142 142
 
143 143
     }
144
-    if($unit_level != $artifact_level_old)
144
+    if ($unit_level != $artifact_level_old)
145 145
     {
146 146
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
147 147
       OldDbChangeSet::db_changeset_apply($db_changeset);
Please login to merge, or discard this patch.
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function art_use(&$user, &$planetrow, $unit_id)
4
-{
3
+function art_use(&$user, &$planetrow, $unit_id) {
5 4
   global $lang;
6 5
 
7 6
   if(!in_array($unit_id, sn_get_groups('artifacts')))
@@ -34,14 +33,12 @@  discard block
 block discarded – undo
34 33
           {
35 34
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 35
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
37
-          }
38
-          else
36
+          } else
39 37
           {
40 38
             $message = $lang['art_lhc_moon_fail'];
41 39
           }
42 40
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
43
-        }
44
-        else
41
+        } else
45 42
         {
46 43
           $message = $lang['art_moon_exists'];
47 44
         }
@@ -69,8 +66,9 @@  discard block
 block discarded – undo
69 66
         $sectors_used = 0;
70 67
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71 68
         {
72
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73
-            continue;
69
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
70
+                      continue;
71
+          }
74 72
           $sectors_used += $levels_deployed;
75 73
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
76 74
         }
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
           DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
105 103
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
106 104
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
107
-        }
108
-        else
105
+        } else
109 106
         {
110 107
           $message = $lang['art_heurestic_chip_no_research'];
111 108
         }
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
134 131
           );
135 132
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
136
-        }
137
-        else
133
+        } else
138 134
         {
139 135
           $message = $lang['art_nano_builder_no_que'];
140 136
         }
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
147 143
       OldDbChangeSet::db_changeset_apply($db_changeset);
148 144
     }
149
-  }
150
-  else
145
+  } else
151 146
   {
152 147
     $message = $lang['art_err_no_artifact'];
153 148
   }
Please login to merge, or discard this patch.
includes/template.php 2 patches
Doc Comments   +14 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @param string    $title
27 27
  * @param string    $redirectTo
28 28
  * @param int       $timeout
29
- * @param bool|true $showHeader
29
+ * @param boolean $showHeader
30 30
  */
31 31
 function messageBox($message, $title = '', $redirectTo = '', $timeout = 5, $showHeader = true) {
32 32
   global $lang;
@@ -57,6 +57,9 @@  discard block
 block discarded – undo
57 57
   messageBox($message, $title, $redirectTo, $timeout, false);
58 58
 }
59 59
 
60
+/**
61
+ * @param integer $level
62
+ */
60 63
 function messageBoxAdminAccessDenied($level = AUTH_LEVEL_ADMINISTRATOR) {
61 64
   global $user, $lang;
62 65
 
@@ -212,10 +215,6 @@  discard block
 block discarded – undo
212 215
 /**
213 216
  * @param template|string $page
214 217
  * @param string          $title
215
- * @param bool|true       $isDisplayTopNav
216
- * @param string          $metatags
217
- * @param bool|false      $AdminPage
218
- * @param bool|true       $isDisplayMenu
219 218
  *
220 219
  * @return mixed
221 220
  */
@@ -230,11 +229,6 @@  discard block
 block discarded – undo
230 229
 /**
231 230
  * @param template|string $page
232 231
  * @param string          $title
233
- * @param bool|true       $isDisplayTopNav
234
- * @param string          $metatags
235
- * @param bool|false      $AdminPage
236
- * @param bool|true       $isDisplayMenu
237
- * @param bool|int|string $exitStatus - Код или сообщение выхода
238 232
  */
239 233
 function sn_display($page, $title = '') {
240 234
   global $debug, $user, $planetrow, $config, $lang, $template_result, $sn_mvc, $sn_page_name;
@@ -296,7 +290,7 @@  discard block
 block discarded – undo
296 290
  * @param $page
297 291
  * @param $title
298 292
  * @param $template_result
299
- * @param $inLoginLogout
293
+ * @param boolean $inLoginLogout
300 294
  * @param $user
301 295
  * @param $config
302 296
  * @param $lang
@@ -419,7 +413,7 @@  discard block
 block discarded – undo
419 413
 }
420 414
 
421 415
 /**
422
- * @return mixed|string
416
+ * @return string
423 417
  */
424 418
 function playerFontSize() {
425 419
   $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE];
@@ -454,7 +448,7 @@  discard block
 block discarded – undo
454 448
 /**
455 449
  * Checks if minified/full-size CSS file exists - and adds it if any
456 450
  *
457
- * @param $cssFileName
451
+ * @param string $cssFileName
458 452
  * @param &$cssArray
459 453
  *
460 454
  * @return bool
@@ -527,10 +521,10 @@  discard block
 block discarded – undo
527 521
 
528 522
 /**
529 523
  * @param $time
530
- * @param $event
524
+ * @param integer $event
531 525
  * @param $msg
532
- * @param $prefix
533
- * @param $is_decrease
526
+ * @param string $prefix
527
+ * @param boolean $is_decrease
534 528
  * @param $fleet_flying_row
535 529
  * @param $fleet_flying_sorter
536 530
  * @param $fleet_flying_events
@@ -826,7 +820,7 @@  discard block
 block discarded – undo
826 820
 }
827 821
 
828 822
 /**
829
- * @param template|string $template
823
+ * @param template $template
830 824
  */
831 825
 function templateRenderToHtml($template) {
832 826
   $output = null;
@@ -861,7 +855,7 @@  discard block
 block discarded – undo
861 855
  * @param template $template
862 856
  * @param array|bool      $array
863 857
  *
864
- * @return mixed
858
+ * @return template
865 859
  */
866 860
 function templateObjectParse($template, $array = false) {
867 861
   global $user;
@@ -884,7 +878,7 @@  discard block
 block discarded – undo
884 878
 }
885 879
 
886 880
 /**
887
- * @param template|string $template
881
+ * @param template $template
888 882
  * @param array|bool      $array
889 883
  *
890 884
  * @return mixed
@@ -907,7 +901,7 @@  discard block
 block discarded – undo
907 901
 }
908 902
 
909 903
 /**
910
- * @param array|string  $files
904
+ * @param string  $files
911 905
  * @param template|null $template
912 906
  * @param string|null   $template_path - path to template
913 907
  *
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 function getSkinPathTemplate($userSkinPath) {
15 15
   static $template_names = array();
16 16
 
17
-  if(!isset($template_names[$userSkinPath])) {
17
+  if (!isset($template_names[$userSkinPath])) {
18 18
     $template_names[$userSkinPath] = file_exists(SN_ROOT_PHYSICAL . $userSkinPath . '_template.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $userSkinPath . '_template.ini') : TEMPLATE_NAME;
19 19
   }
20 20
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 function messageBoxAdminAccessDenied($level = AUTH_LEVEL_ADMINISTRATOR) {
61 61
   global $user, $lang;
62 62
 
63
-  if($user['authlevel'] < $level) {
63
+  if ($user['authlevel'] < $level) {
64 64
     messageBoxAdmin($lang['adm_err_denied'], $lang['admin_title_access_denied'], SN_ROOT_VIRTUAL . 'overview.php');
65 65
   }
66 66
 }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
  * @param $extra
71 71
  */
72 72
 function tpl_menu_merge_extra(&$menu, &$extra) {
73
-  if(empty($menu) || empty($extra)) {
73
+  if (empty($menu) || empty($extra)) {
74 74
     return;
75 75
   }
76 76
 
77
-  foreach($extra as $menu_item_id => $menu_item) {
78
-    if(empty($menu_item['LOCATION'])) {
77
+  foreach ($extra as $menu_item_id => $menu_item) {
78
+    if (empty($menu_item['LOCATION'])) {
79 79
       $menu[$menu_item_id] = $menu_item;
80 80
       continue;
81 81
     }
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
     unset($menu_item['LOCATION']);
85 85
 
86 86
     $is_positioned = $item_location[0];
87
-    if($is_positioned == '+' || $is_positioned == '-') {
87
+    if ($is_positioned == '+' || $is_positioned == '-') {
88 88
       $item_location = substr($item_location, 1);
89 89
     } else {
90 90
       $is_positioned = '';
91 91
     }
92 92
 
93
-    if($item_location) {
93
+    if ($item_location) {
94 94
       $menu_keys = array_keys($menu);
95 95
       $insert_position = array_search($item_location, $menu_keys);
96
-      if($insert_position === false) {
96
+      if ($insert_position === false) {
97 97
         $insert_position = count($menu) - 1;
98 98
         $is_positioned = '+';
99 99
         $item_location = '';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     $spliced = array_splice($menu, $insert_position, count($menu) - $insert_position);
107 107
     $menu[$menu_item_id] = $menu_item;
108 108
 
109
-    if(!$is_positioned && $item_location) {
109
+    if (!$is_positioned && $item_location) {
110 110
       unset($spliced[$item_location]);
111 111
     }
112 112
     $menu = array_merge($menu, $spliced);
@@ -122,24 +122,24 @@  discard block
 block discarded – undo
122 122
 function tpl_menu_assign_to_template(&$sn_menu, &$template) {
123 123
   global $lang;
124 124
 
125
-  if(empty($sn_menu) || !is_array($sn_menu)) {
125
+  if (empty($sn_menu) || !is_array($sn_menu)) {
126 126
     return;
127 127
   }
128 128
 
129
-  foreach($sn_menu as $menu_item_id => $menu_item) {
130
-    if(!$menu_item) {
129
+  foreach ($sn_menu as $menu_item_id => $menu_item) {
130
+    if (!$menu_item) {
131 131
       continue;
132 132
     }
133 133
 
134
-    if(is_string($menu_item_id)) {
134
+    if (is_string($menu_item_id)) {
135 135
       $menu_item['ID'] = $menu_item_id;
136 136
     }
137 137
 
138
-    if($menu_item['TYPE'] == 'lang') {
138
+    if ($menu_item['TYPE'] == 'lang') {
139 139
       $lang_string = &$lang;
140
-      if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
141
-        for($i = 1; $i < count($matches); $i++) {
142
-          if(defined($matches[$i])) {
140
+      if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
141
+        for ($i = 1; $i < count($matches); $i++) {
142
+          if (defined($matches[$i])) {
143 143
             $matches[$i] = constant($matches[$i]);
144 144
           }
145 145
           $lang_string = &$lang_string[$matches[$i]];
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
     $menu_item['ALT'] = htmlentities($menu_item['ALT']);
152 152
     $menu_item['TITLE'] = htmlentities($menu_item['TITLE']);
153 153
 
154
-    if(!empty($menu_item['ICON'])) {
155
-      if(is_string($menu_item['ICON'])) {
154
+    if (!empty($menu_item['ICON'])) {
155
+      if (is_string($menu_item['ICON'])) {
156 156
         $menu_item['ICON_PATH'] = $menu_item['ICON'];
157 157
       } else {
158 158
         $menu_item['ICON'] = $menu_item_id;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     'MENU_START_HIDE'     => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'),
185 185
   ));
186 186
 
187
-  if(isset($template_result['MENU_CUSTOMIZE'])) {
187
+  if (isset($template_result['MENU_CUSTOMIZE'])) {
188 188
     $template->assign_vars(array(
189 189
       'PLAYER_OPTION_MENU_SHOW_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON],
190 190
       'PLAYER_OPTION_MENU_HIDE_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON],
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     ));
199 199
   }
200 200
 
201
-  if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
201
+  if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
202 202
     tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra);
203 203
     tpl_menu_assign_to_template($sn_menu_admin, $template);
204 204
   } else {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  * @return mixed
221 221
  */
222 222
 function display($page, $title = '') {
223
-  if(!defined('SN_TIME_RENDER_START')) {
223
+  if (!defined('SN_TIME_RENDER_START')) {
224 224
     define('SN_TIME_RENDER_START', microtime(true));
225 225
   }
226 226
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
   $exitStatus = true;
245 245
   $template_result['LOGIN_LOGOUT'] = $inLoginLogout = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true;
246 246
 
247
-  if(is_object($page)) {
247
+  if (is_object($page)) {
248 248
     isset($page->_rootref['PAGE_TITLE']) && empty($title) ? $title = $page->_rootref['PAGE_TITLE'] : false;
249 249
     !$title && !empty($page->_rootref['PAGE_HEADER']) ? $title = $page->_rootref['PAGE_HEADER'] : false;
250 250
     !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false;
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
   $isRenderGlobal = is_object($page) && isset($template_result['GLOBAL_DISPLAY_HEADER']) ? $template_result['GLOBAL_DISPLAY_HEADER'] : true;
254 254
 
255 255
   // Global header
256
-  if($isRenderGlobal) {
256
+  if ($isRenderGlobal) {
257 257
     renderHeader($page, $title, $template_result, $inLoginLogout, $user, $config, $lang, $planetrow);
258 258
   }
259 259
 
260 260
   // Page content
261 261
   !is_array($page) ? $page = array($page) : false;
262 262
   $result_added = false;
263
-  foreach($page as $page_item) {
263
+  foreach ($page as $page_item) {
264 264
     /**
265 265
      * @var template $page_item
266 266
      */
267
-    if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
267
+    if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
268 268
       $resultTemplate = gettemplate('_result_message');
269 269
       $resultTemplate->_tpldata = $page_item->_tpldata;
270 270
       displayP($resultTemplate);
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
   }
282 282
 
283 283
   // Global footer
284
-  if($isRenderGlobal) {
284
+  if ($isRenderGlobal) {
285 285
     renderFooter();
286 286
   }
287 287
 
288
-  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
288
+  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
289 289
 
290 290
   sn_db_disconnect();
291 291
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
  * @param $planetrow
304 304
  */
305 305
 function renderHeader($page, $title, &$template_result, $inLoginLogout, &$user, $config, $lang, $planetrow) {
306
-  if(classSupernova::$headerRendered) {
306
+  if (classSupernova::$headerRendered) {
307 307
     return;
308 308
   }
309 309
 
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
  */
462 462
 function cssAddFileName($cssFileName, &$cssArray) {
463 463
   $result = false;
464
-  if(file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.min.css')) {
464
+  if (file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.min.css')) {
465 465
     $cssArray[$cssFileName . '.min.css'] = '';
466 466
     $result = true;
467
-  } elseif(file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.css')) {
467
+  } elseif (file_exists(SN_ROOT_PHYSICAL . $cssFileName . '.css')) {
468 468
     $cssArray[$cssFileName . '.css'] = '';
469 469
     $result = true;
470 470
   }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
  * @param string   $type
557 557
  */
558 558
 function tpl_topnav_event_build(&$template, $fleet_flying_list, $type = 'fleet') {
559
-  if(empty($fleet_flying_list)) {
559
+  if (empty($fleet_flying_list)) {
560 560
     return;
561 561
   }
562 562
 
@@ -565,19 +565,19 @@  discard block
 block discarded – undo
565 565
   $fleet_event_count = 0;
566 566
   $fleet_flying_sorter = array();
567 567
   $fleet_flying_events = array();
568
-  foreach($fleet_flying_list as &$fleet_flying_row) {
568
+  foreach ($fleet_flying_list as &$fleet_flying_row) {
569 569
     $will_return = true;
570
-    if($fleet_flying_row['fleet_mess'] == 0) {
570
+    if ($fleet_flying_row['fleet_mess'] == 0) {
571 571
       // cut fleets on Hold and Expedition
572
-      if($fleet_flying_row['fleet_start_time'] >= SN_TIME_NOW) {
572
+      if ($fleet_flying_row['fleet_start_time'] >= SN_TIME_NOW) {
573 573
         $fleet_flying_row['fleet_mission'] == MT_RELOCATE ? $will_return = false : false;
574 574
         tpl_topnav_event_build_helper($fleet_flying_row['fleet_start_time'], EVENT_FLEET_ARRIVE, $lang['sys_event_arrive'], 'fleet_end_', !$will_return, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
575 575
       }
576
-      if($fleet_flying_row['fleet_end_stay']) {
576
+      if ($fleet_flying_row['fleet_end_stay']) {
577 577
         tpl_topnav_event_build_helper($fleet_flying_row['fleet_end_stay'], EVENT_FLEET_STAY, $lang['sys_event_stay'], 'fleet_end_', false, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
578 578
       }
579 579
     }
580
-    if($will_return) {
580
+    if ($will_return) {
581 581
       tpl_topnav_event_build_helper($fleet_flying_row['fleet_end_time'], EVENT_FLEET_RETURN, $lang['sys_event_return'], 'fleet_start_', true, $fleet_flying_row, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
582 582
     }
583 583
   }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
   asort($fleet_flying_sorter);
586 586
 
587 587
   $fleet_flying_count = count($fleet_flying_list);
588
-  foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
588
+  foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
589 589
     $fleet_event = &$fleet_flying_events[$fleet_event_id];
590 590
     $template->assign_block_vars("flying_{$type}s", array(
591 591
       'TIME' => max(0, $fleet_time - SN_TIME_NOW),
@@ -615,15 +615,15 @@  discard block
 block discarded – undo
615 615
 function sn_tpl_render_topnav(&$user, $planetrow, $template) {
616 616
   global $lang, $config, $sn_module_list, $template_result, $sn_mvc;
617 617
 
618
-  if(!is_array($user)) {
618
+  if (!is_array($user)) {
619 619
     return '';
620 620
   }
621 621
 
622 622
   $GET_mode = sys_get_param_str('mode');
623 623
 
624 624
   $ThisUsersPlanets = DBStaticPlanet::db_planet_list_sorted($user);
625
-  foreach($ThisUsersPlanets as $CurPlanet) {
626
-    if($CurPlanet['destruyed']) {
625
+  foreach ($ThisUsersPlanets as $CurPlanet) {
626
+    if ($CurPlanet['destruyed']) {
627 627
       continue;
628 628
     }
629 629
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
     'QUE_ID'   => QUE_RESEARCH,
668 668
     'QUE_HTML' => 'topnav',
669 669
 
670
-    'RESEARCH_ONGOING' => (boolean)$user['que'],
670
+    'RESEARCH_ONGOING' => (boolean) $user['que'],
671 671
 
672 672
     'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
673 673
       $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     'QUE_STRUCTURES' => QUE_STRUCTURES,
750 750
   ));
751 751
 
752
-  if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
752
+  if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
753 753
     tpl_set_resource_info($template, $planetrow);
754 754
     $template->assign_vars(array(
755 755
       'SN_RENDER_NAVBAR_PLANET' => true,
@@ -844,12 +844,12 @@  discard block
 block discarded – undo
844 844
  * @param template|string $template
845 845
  */
846 846
 function displayP($template) {
847
-  if(is_object($template)) {
848
-    if(empty($template->parsed)) {
847
+  if (is_object($template)) {
848
+    if (empty($template->parsed)) {
849 849
       parsetemplate($template);
850 850
     }
851 851
 
852
-    foreach($template->files as $section => $filename) {
852
+    foreach ($template->files as $section => $filename) {
853 853
       $template->display($section);
854 854
     }
855 855
   } else {
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 function templateObjectParse($template, $array = false) {
867 867
   global $user;
868 868
 
869
-  if(!empty($array) && is_array($array)) {
870
-    foreach($array as $key => $data) {
869
+  if (!empty($array) && is_array($array)) {
870
+    foreach ($array as $key => $data) {
871 871
       $template->assign_var($key, $data);
872 872
     }
873 873
   }
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
  * @return mixed
891 891
  */
892 892
 function parsetemplate($template, $array = false) {
893
-  if(is_object($template)) {
893
+  if (is_object($template)) {
894 894
     return templateObjectParse($template, $array);
895 895
   } else {
896 896
     $search[] = '#\{L_([a-z0-9\-_]*?)\[([a-z0-9\-_]*?)\]\}#Ssie';
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
   !empty($sn_mvc['i18n']['']) ? lng_load_i18n($sn_mvc['i18n']['']) : false;
936 936
   $sn_page_name ? lng_load_i18n($sn_mvc['i18n'][$sn_page_name]) : false;
937 937
 
938
-  foreach($files as &$filename) {
938
+  foreach ($files as &$filename) {
939 939
     $filename = $filename . $template_ex;
940 940
   }
941 941
 
@@ -960,13 +960,13 @@  discard block
 block discarded – undo
960 960
     'LANG'     => $language ? $language : '',
961 961
     'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
962 962
 
963
-    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
963
+    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
964 964
     'FILENAME'       => basename($_SERVER['PHP_SELF']),
965 965
   ));
966 966
 
967
-  foreach(lng_get_list() as $lng_id => $lng_data) {
968
-    if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
969
-      foreach($lng_data['LANG_VARIANTS'] as $lang_variant) {
967
+  foreach (lng_get_list() as $lng_id => $lng_data) {
968
+    if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
969
+      foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
970 970
         $lng_data1 = $lng_data;
971 971
         $lng_data1 = array_merge($lng_data1, $lang_variant);
972 972
         $template->assign_block_vars('language', $lng_data1);
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
   $fleet_flying_list = array();
987 987
 
988 988
   $fleet_flying_list[0] = fleet_list_by_owner_id($user['id']);
989
-  foreach($fleet_flying_list[0] as $fleet_id => $fleet_flying_row) {
989
+  foreach ($fleet_flying_list[0] as $fleet_id => $fleet_flying_row) {
990 990
     $fleet_flying_list[$fleet_flying_row['fleet_mission']][$fleet_id] = &$fleet_flying_list[0][$fleet_id];
991 991
   }
992 992
 
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
   $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']];
1006 1006
 
1007 1007
   $que_length = 0;
1008
-  if(!empty($que)) {
1009
-    foreach($que as $que_item) {
1008
+  if (!empty($que)) {
1009
+    foreach ($que as $que_item) {
1010 1010
       $template->assign_block_vars('que', que_tpl_parse_element($que_item));
1011 1011
     }
1012 1012
     $que_length = count($que);
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) {
1024 1024
   global $lang;
1025 1025
 
1026
-  foreach($density_price_chart as $density_price_index => &$density_price_data) {
1026
+  foreach ($density_price_chart as $density_price_index => &$density_price_data) {
1027 1027
     $density_cost = $density_price_data;
1028 1028
     $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false);
1029 1029
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 function tpl_assign_select(&$template, $name, $values) {
1048 1048
   !is_array($values) ? $values = array($values => $values) : false;
1049 1049
 
1050
-  foreach($values as $key => $value) {
1050
+  foreach ($values as $key => $value) {
1051 1051
     $template->assign_block_vars($name, array(
1052 1052
       'KEY'   => htmlentities($key, ENT_COMPAT, 'UTF-8'),
1053 1053
       'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'),
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 global $debug, $template_result, $user, $lang, $planetrow;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17 17
 }
18 18
 unset($disable_reason);
19 19
 
20 20
 
21
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
21
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
22 22
   lng_include('admin');
23
-} elseif($sys_user_logged_in) {
23
+} elseif ($sys_user_logged_in) {
24 24
   sys_user_vacation($user);
25 25
 
26 26
   $planet_id = SetSelectedPlanet($user);
27 27
 
28 28
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
-  if($user['ally_id']) {
29
+  if ($user['ally_id']) {
30 30
     sn_db_transaction_start();
31 31
     sn_ali_fill_user_ally($user);
32
-    if(!$user['ally']['player']['id']) {
32
+    if (!$user['ally']['player']['id']) {
33 33
       // sn_sys_logout(false, true);
34 34
       // core_auth::logout(false);
35 35
       classSupernova::$auth->logout(false);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   sn_db_transaction_commit();
49 49
 
50 50
   $planetrow = $global_data['planet'];
51
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
51
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52 52
     // sn_sys_logout(false, true);
53 53
     // core_auth::logout(false);
54 54
     classSupernova::$auth->logout(false);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 sys_user_options_unpack($user);
64 64
 
65 65
 global $sn_page_name, $sn_mvc;
66
-if(!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
66
+if (!empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_EARLY_HEADER])) {
67 67
   $title = !empty($sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE]) ? $sn_mvc['pages'][INITIAL_PAGE][PAGE_OPTION_TITLE] : '';
68 68
   renderHeader($page, $title, $template_result, false, $user, classSupernova::$config, $lang, $planetrow);
69 69
 }
Please login to merge, or discard this patch.
jumpgate.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@  discard block
 block discarded – undo
14 14
 
15 15
 lng_include('fleet');
16 16
 
17
-if($TargetPlanet = sys_get_param_id('jmpto'))
17
+if ($TargetPlanet = sys_get_param_id('jmpto'))
18 18
 {
19 19
   sn_db_transaction_start();
20 20
   db_user_by_id($user['id'], true, 'id');
21 21
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
22
-  if(!($NextJumpTime = uni_get_time_to_jump($planetrow)))
22
+  if (!($NextJumpTime = uni_get_time_to_jump($planetrow)))
23 23
   {
24 24
     $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
25
-    if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
25
+    if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
26 26
     {
27
-      $NextDestTime = uni_get_time_to_jump ( $TargetGate );
28
-      if(!$NextDestTime)
27
+      $NextDestTime = uni_get_time_to_jump($TargetGate);
28
+      if (!$NextDestTime)
29 29
       {
30 30
         // $SubQueryOri = "";
31 31
         // $SubQueryDes = "";
32 32
         $ship_list = sys_get_param('ships');
33 33
         $db_changeset = array();
34
-        foreach($ship_list as $ship_id => $ship_count)
34
+        foreach ($ship_list as $ship_id => $ship_count)
35 35
         {
36
-          if(!in_array($ship_id, sn_get_groups('fleet')))
36
+          if (!in_array($ship_id, sn_get_groups('fleet')))
37 37
           {
38 38
             continue;
39 39
           }
40 40
 
41 41
           $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
42
-          if($ship_count)
42
+          if ($ship_count)
43 43
           {
44 44
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']);
45 45
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']);
46 46
           }
47 47
         }
48 48
         // Dit monsieur, y avait quelque chose a envoyer ???
49
-        if(!empty($db_changeset))
49
+        if (!empty($db_changeset))
50 50
         {
51 51
           DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
52 52
           DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
           db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'");
56 56
 
57 57
           $planetrow['last_jump_time'] = SN_TIME_NOW;
58
-          $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow));
58
+          $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow));
59 59
         } else {
60 60
           $RetMessage = $lang['gate_wait_data'];
61 61
         }
62 62
       } else {
63
-        $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime);
63
+        $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime);
64 64
       }
65 65
     } else {
66 66
       $RetMessage = $lang['gate_no_dest_g'];
67 67
     }
68 68
   } else {
69
-    $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime);
69
+    $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
70 70
   }
71 71
   sn_db_transaction_commit();
72 72
   messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
73 73
 } else {
74 74
   $template = gettemplate('jumpgate', true);
75
-  if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
75
+  if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
76 76
   {
77 77
     $Combo = '';
78 78
     $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']);
79 79
     // while($CurMoon = db_fetch($MoonList))
80
-    foreach($MoonList as $CurMoon)
80
+    foreach ($MoonList as $CurMoon)
81 81
     {
82
-      if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
82
+      if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
83 83
       {
84 84
         $NextJumpTime = uni_get_time_to_jump($CurMoon);
85 85
         $template->assign_block_vars('moon', array(
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
       }
94 94
     }
95 95
 
96
-    foreach(sn_get_groups('fleet') as $Ship)
96
+    foreach (sn_get_groups('fleet') as $Ship)
97 97
     {
98
-      if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
98
+      if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
99 99
       {
100 100
         continue;
101 101
       }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     messageBox($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
fleet.php 2 patches
Switch Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -73,121 +73,121 @@  discard block
 block discarded – undo
73 73
 }
74 74
 
75 75
 switch ($fleet_page) {
76
-  case 3:
76
+    case 3:
77 77
 
78
-  case 2:
79
-    $fleet_group_mr = sys_get_param_id('fleet_group');
80
-    $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
81
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
78
+    case 2:
79
+      $fleet_group_mr = sys_get_param_id('fleet_group');
80
+      $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
81
+      $fleetarray = is_array($fleetarray) ? $fleetarray : array();
82 82
 
83
-    foreach($fleetarray as $ship_id => &$ship_amount) {
84
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
85
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
86
-        die();
87
-      }
88
-      $ship_amount = floatval($ship_amount);
89
-    }
90
-
91
-    $UsedPlanet = false;
92
-    $YourPlanet = false;
93
-    $missiontype = array();
94
-    if ($planet > classSupernova::$config->game_maxPlanet) {
95
-      $target_mission = MT_EXPLORE;
96
-      $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
97
-    } elseif ($galaxy && $system && $planet) {
98
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
99
-
100
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
101
-
102
-      if ($TargetPlanet['id_owner']) {
103
-        $UsedPlanet = true;
104
-        if ($TargetPlanet['id_owner'] == $user['id']) {
105
-          $YourPlanet = true;
83
+      foreach($fleetarray as $ship_id => &$ship_amount) {
84
+        if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
85
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
86
+          die();
106 87
         }
88
+        $ship_amount = floatval($ship_amount);
107 89
       }
108 90
 
109
-      if (!$UsedPlanet) {
110
-        if ($fleetarray[SHIP_COLONIZER]) {
111
-          $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
112
-          $target_mission = MT_COLONIZE;
113
-          $planet_type = PT_PLANET;
114
-        } else {
115
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
116
-        }
117
-      } else {
118
-        $recyclers = 0;
119
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
120
-          $recyclers += $fleetarray[$recycler_id];
91
+      $UsedPlanet = false;
92
+      $YourPlanet = false;
93
+      $missiontype = array();
94
+      if ($planet > classSupernova::$config->game_maxPlanet) {
95
+        $target_mission = MT_EXPLORE;
96
+        $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
97
+      } elseif ($galaxy && $system && $planet) {
98
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
99
+
100
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
101
+
102
+        if ($TargetPlanet['id_owner']) {
103
+          $UsedPlanet = true;
104
+          if ($TargetPlanet['id_owner'] == $user['id']) {
105
+            $YourPlanet = true;
106
+          }
121 107
         }
122
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
123
-          $target_mission = MT_RECYCLE;
124
-          $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
125
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
126
-          if ($YourPlanet) {
127
-            $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
128
-            $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
108
+
109
+        if (!$UsedPlanet) {
110
+          if ($fleetarray[SHIP_COLONIZER]) {
111
+            $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
112
+            $target_mission = MT_COLONIZE;
113
+            $planet_type = PT_PLANET;
129 114
           } else {
130
-            // Not Your Planet
131
-            if ($fleetarray[SHIP_SPY]) {
132
-              // Only spy missions if any spy
133
-              $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
115
+            messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
116
+          }
117
+        } else {
118
+          $recyclers = 0;
119
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
120
+            $recyclers += $fleetarray[$recycler_id];
121
+          }
122
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
123
+            $target_mission = MT_RECYCLE;
124
+            $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
125
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
126
+            if ($YourPlanet) {
127
+              $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
128
+              $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
134 129
             } else {
135
-              // If no spies...
136
-              if ($fleet_group_mr) {
137
-                $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
130
+              // Not Your Planet
131
+              if ($fleetarray[SHIP_SPY]) {
132
+                // Only spy missions if any spy
133
+                $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
138 134
               } else {
139
-                $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
140
-                $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
141
-
142
-                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
143
-
144
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
145
-                  $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
135
+                // If no spies...
136
+                if ($fleet_group_mr) {
137
+                  $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
138
+                } else {
139
+                  $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
140
+                  $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
141
+
142
+                  $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
143
+
144
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
145
+                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
146
+                  }
146 147
                 }
147 148
               }
148 149
             }
149 150
           }
150 151
         }
151 152
       }
152
-    }
153
-
154
-    if (!$target_mission && is_array($missiontype)) {
155
-      $target_mission = MT_ATTACK;
156
-    }
157
-
158
-//    $sn_group_missions = sn_get_groups('missions');
159
-//    foreach($sn_group_missions as $mission_id => $cork) {
160
-//      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
161
-//    }
162
-//
163
-//
164
-    ksort($missiontype);
165
-
166
-    $speed_percent = sys_get_param_int('speed', 10);
167
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
168
-
169
-//    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
170
-    $fleet_speed   = $travel_data['fleet_speed'];
171
-    $distance      = $travel_data['distance'];
172
-    $duration      = $travel_data['duration'];
173
-    $consumption   = $travel_data['consumption'];
174
-  // No Break
175
-
176
-  case 1:
177
-    if ($galaxy && $system && $planet) {
178
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
179
-
180
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
181
-    }
182
-
183
-  case 0:
184
-    $template_result += array(
185
-      'thisgalaxy'      => $planetrow['galaxy'],
186
-      'thissystem'      => $planetrow['system'],
187
-      'thisplanet'      => $planetrow['planet'],
188
-      'thisplanet_type' => $planetrow['planet_type'],
189
-    );
190
-  // no break
153
+
154
+      if (!$target_mission && is_array($missiontype)) {
155
+        $target_mission = MT_ATTACK;
156
+      }
157
+
158
+  //    $sn_group_missions = sn_get_groups('missions');
159
+  //    foreach($sn_group_missions as $mission_id => $cork) {
160
+  //      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
161
+  //    }
162
+  //
163
+  //
164
+      ksort($missiontype);
165
+
166
+      $speed_percent = sys_get_param_int('speed', 10);
167
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
168
+
169
+  //    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
170
+      $fleet_speed   = $travel_data['fleet_speed'];
171
+      $distance      = $travel_data['distance'];
172
+      $duration      = $travel_data['duration'];
173
+      $consumption   = $travel_data['consumption'];
174
+    // No Break
175
+
176
+    case 1:
177
+      if ($galaxy && $system && $planet) {
178
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
179
+
180
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
181
+      }
182
+
183
+    case 0:
184
+      $template_result += array(
185
+        'thisgalaxy'      => $planetrow['galaxy'],
186
+        'thissystem'      => $planetrow['system'],
187
+        'thisplanet'      => $planetrow['planet'],
188
+        'thisplanet_type' => $planetrow['planet_type'],
189
+      );
190
+    // no break
191 191
 
192 192
 }
193 193
 
@@ -209,31 +209,31 @@  discard block
 block discarded – undo
209 209
 }
210 210
 
211 211
 switch($fleet_page) {
212
-  case 1:
213
-    require('includes/includes/flt_page1.inc');
214
-  break;
212
+    case 1:
213
+      require('includes/includes/flt_page1.inc');
214
+    break;
215 215
 
216
-  case 2:
217
-    require_once('includes/includes/flt_page2.inc');
218
-    sn_fleet_page2();
219
-  break;
216
+    case 2:
217
+      require_once('includes/includes/flt_page2.inc');
218
+      sn_fleet_page2();
219
+    break;
220 220
 
221
-  case 3:
222
-    require_once('includes/includes/flt_page3.inc');
223
-    sn_fleet_page3();
224
-  break;
221
+    case 3:
222
+      require_once('includes/includes/flt_page3.inc');
223
+      sn_fleet_page3();
224
+    break;
225 225
 
226
-  case 4:
227
-    require('includes/includes/flt_page4.inc');
228
-  break;
226
+    case 4:
227
+      require('includes/includes/flt_page4.inc');
228
+    break;
229 229
 
230
-  case 5:
231
-    require('includes/includes/flt_page5.inc');
232
-  break;
230
+    case 5:
231
+      require('includes/includes/flt_page5.inc');
232
+    break;
233 233
 
234
-  default:
235
-    define('SN_RENDER_NAVBAR_PLANET', true);
234
+    default:
235
+      define('SN_RENDER_NAVBAR_PLANET', true);
236 236
 
237
-    require('includes/includes/flt_page0.inc');
238
-  break;
237
+      require('includes/includes/flt_page0.inc');
238
+    break;
239 239
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 $planet = sys_get_param_int('planet', $planetrow['planet']);
40 40
 
41 41
 $target_mission = sys_get_param_int('target_mission');
42
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
42
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
43 43
   $planet_type = PT_PLANET;
44
-} elseif($target_mission == MT_RECYCLE) {
44
+} elseif ($target_mission == MT_RECYCLE) {
45 45
   $planet_type = PT_DEBRIS;
46
-} elseif($target_mission == MT_DESTROY) {
46
+} elseif ($target_mission == MT_DESTROY) {
47 47
   $planet_type = PT_MOON;
48 48
 } else {
49 49
   $planet_type = sys_get_param_int('planet_type');
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true);
60 60
 //$FlyingFleets = $FlyingFleets['Number'];
61 61
 $FlyingFleets = fleet_count_flying($user['id']);
62
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
62
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
63 63
   messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
64 64
 }
65 65
 
66 66
 $MaxExpeditions = get_player_max_expeditons($user);
67
-if($MaxExpeditions) {
67
+if ($MaxExpeditions) {
68 68
 //  $FlyingExpeditions  = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
69 69
 //  $FlyingExpeditions  = $FlyingExpeditions['expedi'];
70
-  $FlyingExpeditions  = fleet_count_flying($user['id'], MT_EXPLORE);
70
+  $FlyingExpeditions = fleet_count_flying($user['id'], MT_EXPLORE);
71 71
 } else {
72 72
   $FlyingExpeditions = 0;
73 73
 }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
     $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
81 81
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
82 82
 
83
-    foreach($fleetarray as $ship_id => &$ship_amount) {
84
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
83
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
84
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
85 85
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
86 86
         die();
87 87
       }
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
           $target_mission = MT_COLONIZE;
113 113
           $planet_type = PT_PLANET;
114 114
         } else {
115
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
115
+          messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']);
116 116
         }
117 117
       } else {
118 118
         $recyclers = 0;
119
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
119
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
120 120
           $recyclers += $fleetarray[$recycler_id];
121 121
         }
122 122
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
143 143
 
144
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
144
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
145 145
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
146 146
                 }
147 147
               }
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 );
202 202
 
203 203
 $is_transport_missions = false;
204
-if($missiontype) {
204
+if ($missiontype) {
205 205
   $sn_group_missions = sn_get_groups('missions');
206
-  foreach($missiontype as $mission_data_id => $mission_data) {
206
+  foreach ($missiontype as $mission_data_id => $mission_data) {
207 207
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
208 208
   }
209 209
 }
210 210
 
211
-switch($fleet_page) {
211
+switch ($fleet_page) {
212 212
   case 1:
213 213
     require('includes/includes/flt_page1.inc');
214 214
   break;
Please login to merge, or discard this patch.
annonce.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@  discard block
 block discarded – undo
18 18
 
19 19
 lng_include('announce');
20 20
 
21
-switch($action)
21
+switch ($action)
22 22
 {
23 23
   case 1://on veut poster une annonce
24
-    $page .='<HTML>
24
+    $page .= '<HTML>
25 25
     <center>
26 26
     <br>
27 27
     <table width="600">
28
-    <td class="c" colspan="10" align="center"><b><font color="white">'.$lang['Classifieds'].'</font></b></td></tr>
28
+    <td class="c" colspan="10" align="center"><b><font color="white">'.$lang['Classifieds'] . '</font></b></td></tr>
29 29
     <form action="annonce.php?action=2" method="post">
30
-    <td class="c" colspan="10" align="center"><b>'.$lang['Resources_to_be_sold'].'</font></b></td>
31
-    <tr><th colspan="5">'.$lang['metal'].'</th><th colspan="5"><input type="texte" value="0" name="metalvendre" /></th></tr>
32
-    <tr><th colspan="5">'.$lang['crystal'].'</th><th colspan="5"><input type="texte" value="0" name="cristalvendre" /></th></tr>
33
-    <tr><th colspan="5">'.$lang['deuterium'].'</th><th colspan="5"><input type="texte" value="0" name="deutvendre" /></th></tr>
30
+    <td class="c" colspan="10" align="center"><b>'.$lang['Resources_to_be_sold'] . '</font></b></td>
31
+    <tr><th colspan="5">'.$lang['metal'] . '</th><th colspan="5"><input type="texte" value="0" name="metalvendre" /></th></tr>
32
+    <tr><th colspan="5">'.$lang['crystal'] . '</th><th colspan="5"><input type="texte" value="0" name="cristalvendre" /></th></tr>
33
+    <tr><th colspan="5">'.$lang['deuterium'] . '</th><th colspan="5"><input type="texte" value="0" name="deutvendre" /></th></tr>
34 34
 
35
-    <td class="c" colspan="10" align="center"><b>'.$lang['Desired_resources'].'</font></b></td></tr>
36
-    <tr><th colspan="5">'.$lang['metal'].'</th><th colspan="5"><input type="texte" value="0" name="metalsouhait" /></th></tr>
37
-    <tr><th colspan="5">'.$lang['crystal'].'</th><th colspan="5"><input type="texte" value="0" name="cristalsouhait" /></th></tr>
38
-    <tr><th colspan="5">'.$lang['deuterium'].'</th><th colspan="5"><input type="texte" value="0" name="deutsouhait" /></th></tr>
39
-    <tr><th colspan="10"><input type="submit" value="'.$lang['send'].'" /></th></tr>
35
+    <td class="c" colspan="10" align="center"><b>'.$lang['Desired_resources'] . '</font></b></td></tr>
36
+    <tr><th colspan="5">'.$lang['metal'] . '</th><th colspan="5"><input type="texte" value="0" name="metalsouhait" /></th></tr>
37
+    <tr><th colspan="5">'.$lang['crystal'] . '</th><th colspan="5"><input type="texte" value="0" name="cristalsouhait" /></th></tr>
38
+    <tr><th colspan="5">'.$lang['deuterium'] . '</th><th colspan="5"><input type="texte" value="0" name="deutsouhait" /></th></tr>
39
+    <tr><th colspan="10"><input type="submit" value="'.$lang['send'] . '" /></th></tr>
40 40
 
41 41
     <form>
42 42
     </table>
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
     $deutvendre = sys_get_param_float('deutvendre');
54 54
     $deutsouhait = sys_get_param_float('deutsouhait');
55 55
 
56
-    if(($metalvendre!=0 && $metalsouhait==0) ||($cristalvendre!=0 && $cristalsouhait==0) || ($deutvendre!=0 && $deutsouhait==0))
56
+    if (($metalvendre != 0 && $metalsouhait == 0) || ($cristalvendre != 0 && $cristalsouhait == 0) || ($deutvendre != 0 && $deutsouhait == 0))
57 57
     {
58 58
       doquery("INSERT INTO {{annonce}} SET `user` ='{$users['username']}', `galaxie` ='{$users['galaxy']}', `systeme` ='{$users['system']}', `metala` ='{$metalvendre}', `cristala` ='{$cristalvendre}', `deuta` ='{$deutvendre}', `metals` ='{$metalsouhait}', `cristals` ='{$cristalsouhait}', `deuts` ='{$deutsouhait}'");
59
-      messageBox ($lang['Your_announce_was_recorded'], $lang['announce_status'],"annonce.php");
59
+      messageBox($lang['Your_announce_was_recorded'], $lang['announce_status'], "annonce.php");
60 60
     }
61 61
     else
62 62
     {
63
-      messageBox ($lang['Your_announce_not_recorded'], $lang['announce_status'],"annonce.php?action=1");
63
+      messageBox($lang['Your_announce_not_recorded'], $lang['announce_status'], "annonce.php?action=1");
64 64
     }
65 65
   break;
66 66
 
67 67
   case 3://Suppression d'annonce
68 68
     doquery("DELETE FROM {{annonce}} WHERE `id` = {$GET_id}");
69
-    messageBox ($lang['Your_announce_was_deleted'], $lang['announce_status'],"annonce.php");
69
+    messageBox($lang['Your_announce_was_deleted'], $lang['announce_status'], "annonce.php");
70 70
   break;
71 71
 
72 72
   default://Sinon on affiche la liste des annonces
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
     while ($b = db_fetch($annonce))
82 82
     {
83 83
       $page2 .= '<tr><th>';
84
-      foreach($b as $name => $value)
84
+      foreach ($b as $name => $value)
85 85
       {
86
-        if($name!='id')
86
+        if ($name != 'id')
87 87
         {
88
-          $page2 .= $value ;
88
+          $page2 .= $value;
89 89
           $page2 .= '</th><th>';
90 90
         }
91 91
       }
92
-      $page2 .= ($b['user']==$users['username'])?"<a href=\"annonce.php?action=3&id={$b[id]}\">X</a></th></tr>":"</th></tr>";
92
+      $page2 .= ($b['user'] == $users['username']) ? "<a href=\"annonce.php?action=3&id={$b[id]}\">X</a></th></tr>" : "</th></tr>";
93 93
     }
94 94
 
95 95
     $page2 .= "<tr><th colspan=\"10\" align=\"center\"><a href=\"annonce.php?action=1\">{$lang['add_announce']}</a></th></tr></td></table></HTML>";
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@
 block discarded – undo
57 57
     {
58 58
       doquery("INSERT INTO {{annonce}} SET `user` ='{$users['username']}', `galaxie` ='{$users['galaxy']}', `systeme` ='{$users['system']}', `metala` ='{$metalvendre}', `cristala` ='{$cristalvendre}', `deuta` ='{$deutvendre}', `metals` ='{$metalsouhait}', `cristals` ='{$cristalsouhait}', `deuts` ='{$deutsouhait}'");
59 59
       messageBox ($lang['Your_announce_was_recorded'], $lang['announce_status'],"annonce.php");
60
-    }
61
-    else
60
+    } else
62 61
     {
63 62
       messageBox ($lang['Your_announce_not_recorded'], $lang['announce_status'],"annonce.php?action=1");
64 63
     }
Please login to merge, or discard this patch.
flying_fleets.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(!empty($_POST['return']) && is_array($_POST['return'])) {
6
-  foreach($_POST['return'] as $fleet_id) {
7
-    if($fleet_id = idval($fleet_id)) {
5
+if (!empty($_POST['return']) && is_array($_POST['return'])) {
6
+  foreach ($_POST['return'] as $fleet_id) {
7
+    if ($fleet_id = idval($fleet_id)) {
8 8
       sn_db_transaction_start();
9 9
       $FleetRow = db_fleet_get($fleet_id);
10 10
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 lng_include('overview');
24 24
 lng_include('fleet');
25 25
 
26
-if(!$planetrow) {
26
+if (!$planetrow) {
27 27
   messageBox($lang['fl_noplanetrow'], $lang['fl_error']);
28 28
 }
29 29
 
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
 $i = 0;
33 33
 $fleet_list = fleet_list_by_owner_id($user['id']);
34
-foreach($fleet_list as $fleet_id => $fleet_row) {
34
+foreach ($fleet_list as $fleet_id => $fleet_row) {
35 35
   $i++;
36 36
   $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user);
37 37
 
38 38
   $template->assign_block_vars('fleets', $fleet_data['fleet']);
39 39
 
40
-  foreach($fleet_data['ships'] as $ship_data) {
40
+  foreach ($fleet_data['ships'] as $ship_data) {
41 41
     $template->assign_block_vars('fleets.ships', $ship_data);
42 42
   }
43 43
 }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_admin) {
7
+if (!$user_admin) {
8 8
   messageBox($lang['Denied_access'], $lang['ally_admin']);
9 9
 }
10 10
 
11 11
 $template = gettemplate('ali_admin', $template);
12 12
 
13 13
 $text_list = array(
14
-  1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
15
-  2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
16
-  3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
14
+  1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'),
15
+  2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'),
16
+  3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'),
17 17
 );
18 18
 
19 19
 $allyTextID = sys_get_param_int('t', 1);
20
-$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID;
20
+$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
21 21
 
22
-if(sys_get_param_str('isSaveOptions')) {
22
+if (sys_get_param_str('isSaveOptions')) {
23 23
   require_once('includes/includes/sys_avatar.php');
24 24
 
25 25
   $new_image = $ally['ally_image'];
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 //  $template->assign_block_vars('result', $avatar_upload_result);
32 32
 
33 33
   $ally_changeset = array();
34
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
34
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
35 35
     $new_tag_unsafe = $new_tag;
36 36
     $new_tag = db_escape($new_tag);
37 37
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag);
38
-    if(!empty($isTaggedAllyExists)) {
38
+    if (!empty($isTaggedAllyExists)) {
39 39
       messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally');
40 40
     }
41 41
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
42 42
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
43 43
   }
44 44
 
45
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
45
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
46 46
     $new_name_unsafe = $new_name;
47 47
     $new_name = db_escape($new_name);
48 48
     $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name);
49
-    if(!empty($isTaggedAllyExists)) {
49
+    if (!empty($isTaggedAllyExists)) {
50 50
       messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally');
51 51
     }
52 52
     $ally_changeset[] = "`ally_name`='{$new_name}'";
53 53
   }
54 54
 
55
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
55
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
56 56
     $new_owner_rank = db_escape($new_owner_rank);
57 57
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
58 58
   }
59
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
59
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
60 60
     $new_web = db_escape($new_web);
61 61
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
62 62
   }
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 //  if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) {
66 66
 //    $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
67 67
 //  }
68
-  if($new_image != $ally['ally_image']) {
68
+  if ($new_image != $ally['ally_image']) {
69 69
     $new_image = intval($new_image);
70 70
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
71 71
   }
72 72
 
73
-  if(!empty($ally_changeset)) {
73
+  if (!empty($ally_changeset)) {
74 74
     doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
75 75
     sys_redirect('alliance.php?mode=admin&edit=ally');
76 76
   }
77 77
 }
78
-elseif(sys_get_param_str('isSaveText'))
78
+elseif (sys_get_param_str('isSaveText'))
79 79
 {
80 80
   $text = sys_get_param_str_both('text');
81 81
   doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
82 82
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
83 83
 }
84
-elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
84
+elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
85 85
 {
86
-  if(!$isAllyOwner)
86
+  if (!$isAllyOwner)
87 87
   {
88 88
     messageBox($lang['Denied_access'], $lang['ally_admin']);
89 89
   }
90 90
 
91 91
   $newLeader = db_user_by_id($idNewLeader, false, `ally_id`);
92
-  if($newLeader['ally_id'] == $user['ally_id'])
92
+  if ($newLeader['ally_id'] == $user['ally_id'])
93 93
   {
94 94
     sn_db_transaction_start();
95 95
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     sys_redirect('alliance.php');
100 100
   }
101 101
 }
102
-elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
102
+elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
103 103
 {
104
-  if(!$isAllyOwner)
104
+  if (!$isAllyOwner)
105 105
   {
106 106
     messageBox($lang['Denied_access'], $lang['ally_admin']);
107 107
   }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
   'ally_name' => htmlspecialchars($ally['ally_name']),
125 125
   'ally_tag' => htmlspecialchars($ally['ally_tag']),
126 126
   'ally_web' => htmlspecialchars($ally['ally_web']),
127
-  'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''),
127
+  'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''),
128 128
   'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''),
129 129
   'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']),
130 130
   'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 {
134 134
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
135 135
   unset($tmp);
136
-  foreach($userAllyAdmins as $userAllyAdmin)
136
+  foreach ($userAllyAdmins as $userAllyAdmin)
137 137
   {
138 138
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
139 139
   }
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
   $template->assign_var('adminMembers', $tmp);
142 142
 }
143 143
 
144
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
144
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale)
145 145
 {
146
-  if(!$sn_ali_admin_action_locale['title'])
146
+  if (!$sn_ali_admin_action_locale['title'])
147 147
   {
148 148
     continue;
149 149
   }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
     doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
75 75
     sys_redirect('alliance.php?mode=admin&edit=ally');
76 76
   }
77
-}
78
-elseif(sys_get_param_str('isSaveText'))
77
+} elseif(sys_get_param_str('isSaveText'))
79 78
 {
80 79
   $text = sys_get_param_str_both('text');
81 80
   doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
82 81
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
83
-}
84
-elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
82
+} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
85 83
 {
86 84
   if(!$isAllyOwner)
87 85
   {
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
     sn_db_transaction_commit();
99 97
     sys_redirect('alliance.php');
100 98
   }
101
-}
102
-elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
99
+} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
103 100
 {
104 101
   if(!$isAllyOwner)
105 102
   {
Please login to merge, or discard this patch.
includes/alliance/ali_info.inc 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
4 4
 {
5 5
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
7 7
 
8 8
 $template = gettemplate('ali_info', true);
9 9
 
10
-if($mode == 'exit')
10
+if ($mode == 'exit')
11 11
 {
12 12
   if ($ally['ally_owner'] == $user['id'])
13 13
   {
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
     messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
25 25
   }
26 26
 }
27
-elseif($mode == 'ainfo')
27
+elseif ($mode == 'ainfo')
28 28
 {
29 29
   $tag = sys_get_param_str('tag');
30 30
   $id_ally = sys_get_param_id('a');
31
-  if($tag)
31
+  if ($tag)
32 32
   {
33 33
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
34 34
   }
35
-  elseif($id_ally)
35
+  elseif ($id_ally)
36 36
   {
37 37
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
38 38
   }
39 39
 
40
-  if(!$ally)
40
+  if (!$ally)
41 41
   {
42 42
     messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']);
43 43
   }
44 44
 
45
-  if(!$ally['ally_description'])
45
+  if (!$ally['ally_description'])
46 46
   {
47 47
     $ally['ally_description'] = $lang['Ally_nodescription'];
48 48
   }
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     'EXTERNAL'     => true,
52 52
     'USER_ALLY_ID' => $user['ally_id'],
53 53
   ));
54
-  $page_header          = $lang['sys_alliance'];
54
+  $page_header = $lang['sys_alliance'];
55 55
 }
56 56
 else
57 57
 {
58 58
   $page_header = $lang['your_alliance'];
59 59
 
60
-  if($ally['ally_owner'] == $user['id'])
60
+  if ($ally['ally_owner'] == $user['id'])
61 61
   {
62 62
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
63 63
   }
64
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
64
+  elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
65 65
   {
66 66
     $range = $ranks[$user['ally_rank_id']]['name'];
67 67
   }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 ));
106 106
 
107 107
 $relations = ali_relations($ally['id']);
108
-foreach($relations as $relation)
108
+foreach ($relations as $relation)
109 109
 {
110
-  if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
110
+  if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id'])
111 111
   {
112 112
     $template->assign_block_vars('relation', array(
113 113
       'NAME'     => $relation['alliance_diplomacy_contr_ally_name'],
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
   }
118 118
 }
119 119
 
120
-function ali_render(){$func_args = func_get_args();return sn_function_call(__FUNCTION__, $func_args);}
120
+function ali_render() {$func_args = func_get_args(); return sn_function_call(__FUNCTION__, $func_args); }
121 121
 ali_render();
122 122
 
123 123
 display($template, "{$lang['alliance']} [{$ally['ally_name']}]");
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,16 +23,14 @@  discard block
 block discarded – undo
23 23
     $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']);
24 24
     messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
25 25
   }
26
-}
27
-elseif($mode == 'ainfo')
26
+} elseif($mode == 'ainfo')
28 27
 {
29 28
   $tag = sys_get_param_str('tag');
30 29
   $id_ally = sys_get_param_id('a');
31 30
   if($tag)
32 31
   {
33 32
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
34
-  }
35
-  elseif($id_ally)
33
+  } elseif($id_ally)
36 34
   {
37 35
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
38 36
   }
@@ -52,20 +50,17 @@  discard block
 block discarded – undo
52 50
     'USER_ALLY_ID' => $user['ally_id'],
53 51
   ));
54 52
   $page_header          = $lang['sys_alliance'];
55
-}
56
-else
53
+} else
57 54
 {
58 55
   $page_header = $lang['your_alliance'];
59 56
 
60 57
   if($ally['ally_owner'] == $user['id'])
61 58
   {
62 59
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
63
-  }
64
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
60
+  } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
65 61
   {
66 62
     $range = $ranks[$user['ally_rank_id']]['name'];
67
-  }
68
-  else
63
+  } else
69 64
   {
70 65
     $range = $lang['member'];
71 66
   }
Please login to merge, or discard this patch.