Completed
Push — work-fleets ( ff9274...a405f7 )
by SuperNova.WS
06:32
created
infos.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
   ));
48 48
 
49 49
   $ActualProd = floor($Prod[$BuildID]);
50
-  if($BuildID != STRUC_MINE_FUSION) {
50
+  if ($BuildID != STRUC_MINE_FUSION) {
51 51
     $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]);
52 52
   } else {
53 53
     $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]);
54 54
   }
55 55
 
56 56
   $BuildStartLvl = $CurrentBuildtLvl - 2;
57
-  if($BuildStartLvl < 1) {
57
+  if ($BuildStartLvl < 1) {
58 58
     $BuildStartLvl = 1;
59 59
   }
60 60
   $Table = '';
61 61
   $ProdFirst = 0;
62
-  for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
-    if($BuildID != STRUC_MOON_PHALANX) {
62
+  for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
+    if ($BuildID != STRUC_MOON_PHALANX) {
64 64
       $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value(
65 65
         $CurrentUser,
66 66
         $CurrentPlanet,
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
       ));
88 88
 
89 89
       $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
90
-      if($ProdFirst > 0) {
91
-        if($BuildID != STRUC_MINE_FUSION) {
90
+      if ($ProdFirst > 0) {
91
+        if ($BuildID != STRUC_MINE_FUSION) {
92 92
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>";
93 93
         } else {
94 94
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>";
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
       } else {
97 97
         $bloc['build_gain'] = '';
98 98
       }
99
-      if($BuildID != STRUC_MINE_FUSION) {
99
+      if ($BuildID != STRUC_MINE_FUSION) {
100 100
         $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
101 101
         $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true);
102 102
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true);
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true);
108 108
         $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true);
109 109
       }
110
-      if($ProdFirst == 0) {
111
-        if($BuildID != STRUC_MINE_FUSION) {
110
+      if ($ProdFirst == 0) {
111
+        if ($BuildID != STRUC_MINE_FUSION) {
112 112
           $ProdFirst = floor($Prod[$BuildID]);
113 113
         } else {
114 114
           $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]);
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 
134 134
   $str_rapid_from = '';
135 135
   $str_rapid_to = '';
136
-  foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
136
+  foreach (sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
137 137
     $enemy_data = get_unit_param($enemy_id);
138 138
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
139 139
 
140 140
     $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability);
141
-    if($rapid >= 1) {
141
+    if ($rapid >= 1) {
142 142
       $str_rapid_to .= "{$classLocale['nfo_rf_again']} {$classLocale['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>";
143 143
     }
144 144
 
145 145
     $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability);
146
-    if($rapid >= 1) {
146
+    if ($rapid >= 1) {
147 147
       $str_rapid_from .= "{$classLocale['tech'][$enemy_id]} {$classLocale['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>";
148 148
     }
149 149
   }
150 150
 
151
-  if($str_rapid_to && $str_rapid_from) {
151
+  if ($str_rapid_to && $str_rapid_from) {
152 152
     $str_rapid_to .= '<hr>';
153 153
   }
154 154
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 }
157 157
 
158 158
 $unit_id = sys_get_param_id('gid');
159
-if($unit_id == RES_DARK_MATTER) {
159
+if ($unit_id == RES_DARK_MATTER) {
160 160
   sys_redirect('dark_matter.php');
161 161
 }
162 162
 
163
-if($unit_id == RES_METAMATTER) {
163
+if ($unit_id == RES_METAMATTER) {
164 164
   sys_redirect('metamatter.php');
165 165
 }
166 166
 
167 167
 lng_include('infos');
168
-if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
168
+if (!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
169 169
   sys_redirect('index.php?page=techtree');
170 170
 }
171 171
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 $unit_data = get_unit_param($unit_id);
175 175
 $unit_type = $unit_data['type'];
176 176
 
177
-if($unit_type == UNIT_SHIPS) {
177
+if ($unit_type == UNIT_SHIPS) {
178 178
   $template_result['UNIT_IS_SHIP'] = true;
179 179
 
180 180
   $ship_data = get_ship_data($unit_id, $user);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
   );
191 191
 
192 192
   $engine_template_info = array();
193
-  foreach($unit_data['engine'] as $unit_engine_data) {
193
+  foreach ($unit_data['engine'] as $unit_engine_data) {
194 194
     $unit_engine_data = get_engine_data($user, $unit_engine_data);
195 195
 
196 196
     $engine_template_info[] = array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 
211 211
 $sn_data_group_combat = sn_get_groups('combat');
212
-if(in_array($unit_id, $sn_data_group_combat)) {
212
+if (in_array($unit_id, $sn_data_group_combat)) {
213 213
   $template_result['UNIT_IS_COMBAT'] = true;
214 214
 
215 215
   $unit_durability = $unit_data['shield'] + $unit_data['armor'];
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
   $volley_arr = $rapid_to = $rapid_from = array();
218 218
   $str_rapid_from = '';
219 219
   $str_rapid_to = '';
220
-  foreach($sn_data_group_combat as $enemy_id) {
220
+  foreach ($sn_data_group_combat as $enemy_id) {
221 221
     $enemy_data = get_unit_param($enemy_id);
222 222
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
223 223
 
224 224
     $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability;
225
-    if($rapid >= 1) {
225
+    if ($rapid >= 1) {
226 226
       $volley_arr[$enemy_id]['TO'] = floor($rapid);
227 227
     }
228 228
 
229 229
     $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability;
230
-    if($rapid >= 1) {
230
+    if ($rapid >= 1) {
231 231
       $volley_arr[$enemy_id]['FROM'] = floor($rapid);
232 232
     }
233 233
   }
234
-  foreach($volley_arr as $enemy_id => &$rapid) {
234
+  foreach ($volley_arr as $enemy_id => &$rapid) {
235 235
     $rapid['ENEMY_ID'] = $enemy_id;
236 236
     $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id];
237 237
   }
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 
250 250
 }
251 251
 
252
-if(classLocale::$lang['info'][$unit_id]['effect']) {
252
+if (classLocale::$lang['info'][$unit_id]['effect']) {
253 253
   $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect'];
254 254
 }
255 255
 
256
-if($unit_data['bonus']) {
256
+if ($unit_data['bonus']) {
257 257
   $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : (
258 258
     ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '')
259 259
   );
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
15
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
16 16
   message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type) {
29
-  switch($type) {
28
+if ($searchtext && $type) {
29
+  switch ($type) {
30 30
     case "planetname":
31 31
       // $search = db_planet_list_search($searchtext);
32 32
     break;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     break;
42 42
   }
43 43
 
44
-  while($row = db_fetch($search)) {
45
-    if($type == 'playername' || $type == 'planetname') {
44
+  while ($row = db_fetch($search)) {
45
+    if ($type == 'playername' || $type == 'planetname') {
46 46
       $template->assign_block_vars('search_result', array(
47 47
         'PLAYER_ID'       => $row['uid'],
48 48
         'PLAYER_NAME'     => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         'ALLY_NAME'       => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
58 58
         'ALLY_TAG'        => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
59 59
       ));
60
-    } elseif($type == 'ally') {
60
+    } elseif ($type == 'ally') {
61 61
       $template->assign_block_vars('search_result', array(
62 62
         'ALLY_NAME'     => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
63 63
         'ALLY_TAG'      => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   'ally'       => 'sys_alliance',
76 76
 );
77 77
 
78
-foreach($search_type as $type_id => $type_lang) {
78
+foreach ($search_type as $type_id => $type_lang) {
79 79
   $template->assign_block_vars('type', array(
80 80
     'ID'       => $type_id,
81 81
     'TEXT'     => classLocale::$lang[$type_lang],
Please login to merge, or discard this patch.
includes/includes/market_info.inc 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true)
5
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true)
6 6
 {
7 7
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
8 8
 }
@@ -17,50 +17,50 @@  discard block
 block discarded – undo
17 17
 ));
18 18
 
19 19
 $info_action = sys_get_param_int('action');
20
-if($info_action)
20
+if ($info_action)
21 21
 {
22 22
   try
23 23
   {
24 24
     sn_db_transaction_start();
25 25
 
26 26
     $user = db_user_by_id($user['id'], true);
27
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info)
27
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info)
28 28
     {
29 29
       throw new Exception(MARKET_NO_DM, ERR_ERROR);
30 30
     }
31 31
 
32
-    switch($info_action)
32
+    switch ($info_action)
33 33
     {
34 34
       case MARKET_INFO_PLAYER:
35 35
         $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name');
36
-        if(!$user_info_name_unsafe)
36
+        if (!$user_info_name_unsafe)
37 37
         {
38 38
           throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR);
39 39
         }
40 40
 
41
-        if(is_id($user_info_name_unsafe))
41
+        if (is_id($user_info_name_unsafe))
42 42
         {
43 43
           $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true);
44 44
         }
45
-        if(!is_array($user_info))
45
+        if (!is_array($user_info))
46 46
         {
47 47
           $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true);
48 48
         }
49
-        if(!is_array($user_info))
49
+        if (!is_array($user_info))
50 50
         {
51 51
           throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR);
52 52
         }
53
-        if($user_info['id'] == $user['id'])
53
+        if ($user_info['id'] == $user['id'])
54 54
         {
55 55
           throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
56 56
         }
57 57
 
58 58
         $msg_text = array();
59
-        foreach(sn_get_groups('mercenaries') as $mercenary_id)
59
+        foreach (sn_get_groups('mercenaries') as $mercenary_id)
60 60
         {
61 61
           $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']);
62 62
         }
63
-        if($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM))
63
+        if ($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM))
64 64
         {
65 65
           $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}";
66 66
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
       break;
75 75
     }
76 76
 
77
-    if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
77
+    if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
78 78
     {
79 79
       // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
80 80
     }
Please login to merge, or discard this patch.
includes/includes/sys_avatar.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@  discard block
 block discarded – undo
5 5
     $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id;
6 6
     $avatar_filename .= '.png';
7 7
     $fullsize_filename .= '_full.png';
8
-    if(sys_get_param_int('avatar_remove')) {
9
-      if(file_exists($avatar_filename) && !unlink($avatar_filename)) {
8
+    if (sys_get_param_int('avatar_remove')) {
9
+      if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
10 10
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR);
11 11
       }
12 12
       $avatar_field = 0;
13 13
       throw new Exception(classLocale::$lang['opt_msg_avatar_removed'], ERR_NONE);
14
-    } elseif($_FILES['avatar']['size']) {
15
-      if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) {
14
+    } elseif ($_FILES['avatar']['size']) {
15
+      if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) {
16 16
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
17 17
       }
18 18
 
19
-      if($_FILES['avatar']['error']) {
19
+      if ($_FILES['avatar']['error']) {
20 20
         throw new Exception(sprintf(classLocale::$lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR);
21 21
       }
22 22
 
23
-      if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) {
23
+      if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) {
24 24
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
25 25
       }
26 26
 
27 27
       $avatar_size = getimagesize($_FILES['avatar']['tmp_name']);
28 28
       $avatar_max_width = classSupernova::$config->avatar_max_width;
29 29
       $avatar_max_height = classSupernova::$config->avatar_max_height;
30
-      if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) {
30
+      if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) {
31 31
         $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]);
32 32
         $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio);
33 33
         $result = imagecopyresized($avatar_image_new, $avatar_image, 0, 0, 0, 0, $avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio, $avatar_size[0], $avatar_size[1]);
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
         $avatar_image = $avatar_image_new;
36 36
       }
37 37
 
38
-      if(file_exists($avatar_filename) && !unlink($avatar_filename)) {
38
+      if (file_exists($avatar_filename) && !unlink($avatar_filename)) {
39 39
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR);
40 40
       }
41 41
 
42
-      if(!imagepng($avatar_image, $avatar_filename, 9)) {
42
+      if (!imagepng($avatar_image, $avatar_filename, 9)) {
43 43
         throw new Exception(classLocale::$lang['opt_msg_avatar_error_writing'], ERR_ERROR);
44 44
       }
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
       imagedestroy($avatar_image);
48 48
       throw new Exception(classLocale::$lang['opt_msg_avatar_uploaded'], ERR_NONE);
49 49
     }
50
-  } catch(Exception $e) {
50
+  } catch (Exception $e) {
51 51
     return array(
52 52
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
53 53
       'MESSAGE' => $e->getMessage()
Please login to merge, or discard this patch.
includes/includes/mrc_mercenary.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 function mrc_officer_accessible(&$user, $mercenary_id) {
6 6
   $mercenary_info = get_unit_param($mercenary_id);
7
-  if(classSupernova::$config->empire_mercenary_temporary || $mercenary_info[P_UNIT_TYPE] == UNIT_PLANS) {
7
+  if (classSupernova::$config->empire_mercenary_temporary || $mercenary_info[P_UNIT_TYPE] == UNIT_PLANS) {
8 8
     return true;
9 9
   }
10 10
 
11
-  if(isset($mercenary_info[P_REQUIRE])) {
12
-    foreach($mercenary_info[P_REQUIRE] as $unit_id => $unit_level) {
13
-      if(mrc_get_level($user, null, $unit_id) < $unit_level) {
11
+  if (isset($mercenary_info[P_REQUIRE])) {
12
+    foreach ($mercenary_info[P_REQUIRE] as $unit_id => $unit_level) {
13
+      if (mrc_get_level($user, null, $unit_id) < $unit_level) {
14 14
         return false;
15 15
       }
16 16
     }
@@ -26,35 +26,35 @@  discard block
 block discarded – undo
26 26
     $is_permanent = $mode == UNIT_PLANS || !classSupernova::$config->empire_mercenary_temporary;
27 27
     $cost_alliance_multiplyer = (SN_IN_ALLY === true && $mode == UNIT_PLANS ? classSupernova::$config->ali_bonus_members : 1);
28 28
     $cost_alliance_multiplyer = $cost_alliance_multiplyer >= 1 ? $cost_alliance_multiplyer : 1;
29
-    if(!in_array($mercenary_id, sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries'))) {
29
+    if (!in_array($mercenary_id, sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries'))) {
30 30
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_mercenary'], ERR_ERROR);
31 31
     }
32 32
 
33
-    if(!mrc_officer_accessible($user, $mercenary_id)) {
33
+    if (!mrc_officer_accessible($user, $mercenary_id)) {
34 34
       throw new Exception(classLocale::$lang['mrc_msg_error_requirements'], ERR_ERROR);
35 35
     }
36 36
 
37 37
     $mercenary_level = sys_get_param_int('mercenary_level');
38
-    if($mercenary_level < 0 || $mercenary_level > get_unit_param($mercenary_id, P_MAX_STACK)) {
38
+    if ($mercenary_level < 0 || $mercenary_level > get_unit_param($mercenary_id, P_MAX_STACK)) {
39 39
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_level'], ERR_ERROR);
40 40
     }
41 41
 
42
-    if($mercenary_level && !array_key_exists($mercenary_period = sys_get_param_int('mercenary_period'), $sn_powerup_buy_discounts)) {
42
+    if ($mercenary_level && !array_key_exists($mercenary_period = sys_get_param_int('mercenary_period'), $sn_powerup_buy_discounts)) {
43 43
       throw new Exception(classLocale::$lang['mrc_msg_error_wrong_period'], ERR_ERROR);
44 44
     }
45 45
 
46 46
     sn_db_transaction_start();
47 47
 
48 48
     $mercenary_level_old = mrc_get_level($user, $planetrow, $mercenary_id, true, true);
49
-    if(classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old && $mercenary_level) {
49
+    if (classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old && $mercenary_level) {
50 50
       throw new Exception(classLocale::$lang['mrc_msg_error_already_hired'], ERR_ERROR); // Can't hire already hired temp mercenary - dismiss first
51
-    } elseif(classSupernova::$config->empire_mercenary_temporary && !$mercenary_level_old && !$mercenary_level) {
51
+    } elseif (classSupernova::$config->empire_mercenary_temporary && !$mercenary_level_old && !$mercenary_level) {
52 52
       throw new Exception('', ERR_NONE); // Can't dismiss (!$mercenary_level) not hired (!$mercenary_level_old) temp mercenary. But no error
53 53
     }
54 54
 
55
-    if($mercenary_level) {
55
+    if ($mercenary_level) {
56 56
       $darkmater_cost = eco_get_total_cost($mercenary_id, $mercenary_level);
57
-      if(!classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old) {
57
+      if (!classSupernova::$config->empire_mercenary_temporary && $mercenary_level_old) {
58 58
         $darkmater_cost_old = eco_get_total_cost($mercenary_id, $mercenary_level_old);
59 59
         $darkmater_cost[BUILD_CREATE][RES_DARK_MATTER] -= $darkmater_cost_old[BUILD_CREATE][RES_DARK_MATTER];
60 60
       }
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
     }
65 65
     $darkmater_cost *= $cost_alliance_multiplyer;
66 66
 
67
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < $darkmater_cost) {
67
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < $darkmater_cost) {
68 68
       throw new Exception(classLocale::$lang['mrc_msg_error_no_resource'], ERR_ERROR);
69 69
     }
70 70
 
71
-    if(($darkmater_cost && $mercenary_level) || !$is_permanent) {
71
+    if (($darkmater_cost && $mercenary_level) || !$is_permanent) {
72 72
       $unit_row = db_unit_by_location($user['id'], LOC_USER, $user['id'], $mercenary_id);
73
-      if(is_array($unit_row) && ($dismiss_left_days = floor((strtotime($unit_row['unit_time_finish']) - SN_TIME_NOW) / PERIOD_DAY))) {
73
+      if (is_array($unit_row) && ($dismiss_left_days = floor((strtotime($unit_row['unit_time_finish']) - SN_TIME_NOW) / PERIOD_DAY))) {
74 74
         $dismiss_full_cost = eco_get_total_cost($mercenary_id, $unit_row['unit_level']);
75 75
         $dismiss_full_cost = $dismiss_full_cost[BUILD_CREATE][RES_DARK_MATTER];
76 76
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
       db_unit_list_delete($user['id'], LOC_USER, $user['id'], $mercenary_id);
84 84
     }
85 85
 
86
-    if($darkmater_cost && $mercenary_level) {
86
+    if ($darkmater_cost && $mercenary_level) {
87 87
       db_unit_set_insert(
88 88
         "unit_player_id = {$user['id']},
89 89
         unit_location_type = " . LOC_USER . ",
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
     sn_db_transaction_commit();
102 102
     sys_redirect($_SERVER['REQUEST_URI']);
103
-  } catch(Exception $e) {
103
+  } catch (Exception $e) {
104 104
     sn_db_transaction_rollback();
105 105
     $operation_result = array(
106 106
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   $mode = in_array($mode, array(UNIT_MERCENARIES, UNIT_PLANS)) ? $mode : UNIT_MERCENARIES;
119 119
   $is_permanent = $mode == UNIT_PLANS || !classSupernova::$config->empire_mercenary_temporary;
120 120
 
121
-  if($mercenary_id = sys_get_param_int('mercenary_id')) {
121
+  if ($mercenary_id = sys_get_param_int('mercenary_id')) {
122 122
     $operation_result = mrc_mercenary_hire($mode, $user, $mercenary_id);
123 123
   }
124 124
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
   $template = gettemplate('mrc_mercenary_hire', true);
128 128
 
129
-  if(!empty($operation_result)) {
129
+  if (!empty($operation_result)) {
130 130
     $template->assign_block_vars('result', $operation_result);
131 131
   }
132 132
 
133
-  foreach($sn_powerup_buy_discounts as $hire_period => $hire_discount) {
133
+  foreach ($sn_powerup_buy_discounts as $hire_period => $hire_discount) {
134 134
     $template->assign_block_vars('period', array(
135 135
       'LENGTH'   => $hire_period,
136 136
       'TEXT'     => classLocale::$lang['mrc_period_list'][$hire_period],
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
   $user_dark_matter = mrc_get_level($user, null, RES_DARK_MATTER);
143 143
   $cost_alliance_multiplyer = (SN_IN_ALLY === true && $mode == UNIT_PLANS ? classSupernova::$config->ali_bonus_members : 1);
144 144
   $cost_alliance_multiplyer = $cost_alliance_multiplyer >= 1 ? $cost_alliance_multiplyer : 1;
145
-  foreach(sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries') as $mercenary_id) {
145
+  foreach (sn_get_groups($mode == UNIT_PLANS ? 'plans' : 'mercenaries') as $mercenary_id) {
146 146
     {
147 147
       $mercenary = get_unit_param($mercenary_id);
148 148
       $mercenary_bonus = $mercenary['bonus'];
149 149
       $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}";
150
-      switch($mercenary['bonus_type']) {
150
+      switch ($mercenary['bonus_type']) {
151 151
         case BONUS_PERCENT:
152 152
           $mercenary_bonus = "{$mercenary_bonus}% ";
153 153
         break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
       $mercenary_level = mrc_get_level($user, null, $mercenary_id, false, true);
165 165
       $mercenary_level_bonus = max(0, mrc_get_level($user, null, $mercenary_id) - $mercenary_level);
166 166
       $total_cost_old = 0;
167
-      if($is_permanent) {
167
+      if ($is_permanent) {
168 168
         $total_cost_old = eco_get_total_cost($mercenary_id, $mercenary_level);
169 169
         $total_cost_old = $total_cost_old[BUILD_CREATE][RES_DARK_MATTER] * $cost_alliance_multiplyer;
170 170
       }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
       ));
194 194
 
195 195
       $upgrade_cost = 1;
196
-      for($i = classSupernova::$config->empire_mercenary_temporary ? 1 : $mercenary_level + 1; $mercenary['max'] ? ($i <= $mercenary['max']) : $upgrade_cost <= $user_dark_matter; $i++) {
196
+      for ($i = classSupernova::$config->empire_mercenary_temporary ? 1 : $mercenary_level + 1; $mercenary['max'] ? ($i <= $mercenary['max']) : $upgrade_cost <= $user_dark_matter; $i++) {
197 197
         $total_cost = eco_get_total_cost($mercenary_id, $i);
198 198
         $total_cost[BUILD_CREATE][RES_DARK_MATTER] *= $cost_alliance_multiplyer;
199 199
         $upgrade_cost = $total_cost[BUILD_CREATE][RES_DARK_MATTER] - $total_cost_old;
Please login to merge, or discard this patch.
alliance.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(classSupernova::$config->game_mode == GAME_BLITZ) {
5
+if (classSupernova::$config->game_mode == GAME_BLITZ) {
6 6
   message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10);
7 7
   die();
8 8
 }
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 
15 15
 $mode = sys_get_param_str('mode');
16 16
 
17
-if($mode == 'ainfo') {
17
+if ($mode == 'ainfo') {
18 18
   include('includes/alliance/ali_info.inc');
19 19
 }
20 20
 
21
-if(!$user['ally_id']) {
21
+if (!$user['ally_id']) {
22 22
   $user_request = db_ally_request_get_by_user_id($user['id']);
23
-  if($user_request['id_user']) {
23
+  if ($user_request['id_user']) {
24 24
     require('includes/alliance/ali_external_request.inc');
25 25
   } else {
26
-    switch($mode) {
26
+    switch ($mode) {
27 27
       case 'search':
28 28
         require('includes/alliance/ali_external_search.inc');
29 29
       break;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 }
45 45
 
46 46
 sn_ali_fill_user_ally($user);
47
-if(!isset($user['ally'])) {
47
+if (!isset($user['ally'])) {
48 48
   db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0");
49 49
   message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['your_alliance'], 'alliance.php');
50 50
 }
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 
73 73
 // This piece converting old ally data to new one
74 74
 //  unset($ally['ranklist']);
75
-if(!$ally['ranklist'] && $ally['ally_ranks']) {
75
+if (!$ally['ranklist'] && $ally['ally_ranks']) {
76 76
   $ally_ranks = unserialize($ally['ally_ranks']);
77 77
   $i = 0;
78
-  foreach($ally_ranks as $rank_id => $rank) {
79
-    foreach($ally_rights as $key => $value) {
78
+  foreach ($ally_ranks as $rank_id => $rank) {
79
+    foreach ($ally_rights as $key => $value) {
80 80
       $ranks[$i][$value] = $rank[$rights_old[$key]];
81 81
     }
82 82
     db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id);
83 83
     $i++;
84 84
   }
85 85
 
86
-  if(!empty($ranks)) {
86
+  if (!empty($ranks)) {
87 87
     ali_rank_list_save($ranks);
88 88
   }
89 89
 }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 
102 102
 $edit = sys_get_param_str('edit');
103 103
 ally_pre_call();
104
-switch($mode) {
104
+switch ($mode) {
105 105
   case 'admin':
106
-    if(!array_key_exists($edit, $sn_ali_admin_internal)) {
106
+    if (!array_key_exists($edit, $sn_ali_admin_internal)) {
107 107
       $edit = 'default';
108 108
     }
109
-    if($sn_ali_admin_internal[$edit]['include']) {
109
+    if ($sn_ali_admin_internal[$edit]['include']) {
110 110
       require("includes/{$sn_ali_admin_internal[$edit]['include']}");
111 111
     }
112
-    if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) {
112
+    if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) {
113 113
       call_user_func($sn_ali_admin_internal[$edit]['function']);
114 114
     }
115 115
   break;
Please login to merge, or discard this patch.
admin/settings.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
  * @copyright 2008 by ??????? for XNova
9 9
  */
10 10
 
11
-define('INSIDE'  , true);
12
-define('INSTALL' , false);
11
+define('INSIDE', true);
12
+define('INSTALL', false);
13 13
 define('IN_ADMIN', true);
14 14
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
15 15
 
16
-if($user['authlevel'] < 3) {
16
+if ($user['authlevel'] < 3) {
17 17
   AdminMessage(classLocale::$lang['adm_err_denied']);
18 18
 }
19 19
 
20 20
 $template = gettemplate('admin/settings', true);
21 21
 
22
-if(sys_get_param('save')) {
22
+if (sys_get_param('save')) {
23 23
   classSupernova::$config->game_name               = sys_get_param_str_unsafe('game_name');
24 24
   classSupernova::$config->game_mode               = sys_get_param_int('game_mode');
25 25
   classSupernova::$config->game_speed              = sys_get_param_float('game_speed', 1);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   classSupernova::$config->url_faq                 = sys_get_param_str_unsafe('url_faq');
30 30
   classSupernova::$config->url_forum               = sys_get_param_str_unsafe('url_forum');
31 31
   classSupernova::$config->url_rules               = sys_get_param_str_unsafe('url_rules');
32
-  classSupernova::$config->url_purchase_metamatter         = sys_get_param_str_unsafe('url_purchase_metamatter');
32
+  classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter');
33 33
   classSupernova::$config->game_disable            = sys_get_param_int('game_disable');
34 34
   classSupernova::$config->game_disable_reason     = sys_get_param_str_unsafe('game_disable_reason');
35 35
   classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto');
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
   classSupernova::$config->stats_schedule          = sys_get_param_str('stats_schedule');
97 97
 
98 98
   classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period');
99
-  if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
100
-    if(classSupernova::$config->empire_mercenary_temporary) {
99
+  if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) {
100
+    if (classSupernova::$config->empire_mercenary_temporary) {
101 101
       db_unit_list_admin_delete_mercenaries_finished();
102 102
     } else {
103 103
       db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period);
@@ -138,21 +138,21 @@  discard block
 block discarded – undo
138 138
   'STATS_HIDE_PM_LINK' => classSupernova::$config->stats_hide_pm_link,
139 139
 ));
140 140
 
141
-foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) {
141
+foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) {
142 142
   $template->assign_block_vars('sys_game_disable_reason', array(
143 143
     'ID'   => $id,
144 144
     'NAME' => $name,
145 145
   ));
146 146
 }
147 147
 
148
-foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) {
148
+foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) {
149 149
   $template->assign_block_vars('game_modes', array(
150 150
     'ID'   => $mode_id,
151 151
     'NAME' => $mode_name,
152 152
   ));
153 153
 }
154 154
 
155
-foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) {
155
+foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) {
156 156
   $template->assign_block_vars('ver_response', array(
157 157
     'ID'   => $ver_id,
158 158
     'NAME' => js_safe_string($ver_response),
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 }
161 161
 
162 162
 $lang_list = lng_get_list();
163
-foreach($lang_list as $lang_id => $lang_data) {
163
+foreach ($lang_list as $lang_id => $lang_data) {
164 164
   $template->assign_block_vars('game_languages', array(
165 165
     'ID'   => $lang_id,
166 166
     'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})",
Please login to merge, or discard this patch.
ajax_version_check.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
   . '&key=' . urlencode(classSupernova::$config->server_updater_key)
13 13
   . '&id=' . urlencode(classSupernova::$config->server_updater_id);
14 14
 
15
-switch($mode) {
15
+switch ($mode) {
16 16
   case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
17
+    if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+      if ($ajax) {
19 19
         print(SNC_VER_REGISTER_ERROR_REGISTERED);
20 20
       }
21 21
       die();
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
28
-if(!$check_result) {
28
+if (!$check_result) {
29 29
   $version_check = SNC_VER_ERROR_CONNECT;
30
-} elseif(($version_check = intval($check_result)) && $version_check == $check_result) {
30
+} elseif (($version_check = intval($check_result)) && $version_check == $check_result) {
31 31
   $version_check = $check_result;
32 32
 } else {
33 33
   // JSON decode if string
34 34
   $check_result = json_decode($check_result, true);
35 35
   $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check'];
36 36
 
37
-  switch($mode) {
37
+  switch ($mode) {
38 38
     case SNC_MODE_REGISTER:
39
-      if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
39
+      if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
40 40
         classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']);
41 41
         classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']);
42 42
       }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW);
50 50
 classSupernova::$config->db_saveItem('server_updater_check_result', $version_check);
51 51
 
52
-if($ajax) {
52
+if ($ajax) {
53 53
   define('IN_AJAX', true);
54 54
   print($version_check);
55 55
 }
Please login to merge, or discard this patch.
admin/tools.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if($user['authlevel'] < 1)
15
-if($user['authlevel'] < 3) {
15
+if ($user['authlevel'] < 3) {
16 16
   AdminMessage(classLocale::$lang['adm_err_denied']);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function templateAssignTable($template, $str, $status) {
27 27
   $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table'][$str]);
28
-  foreach($status as $key => $value) {
28
+  foreach ($status as $key => $value) {
29 29
     $template->assign_block_vars('table.row', array(
30 30
       'VALUE_1' => $key,
31 31
       'VALUE_2' => $value,
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
   }
34 34
 }
35 35
 
36
-switch($mode) {
36
+switch ($mode) {
37 37
   case ADM_TOOL_CONFIG_RELOAD:
38 38
     classSupernova::$config->db_loadAll();
39 39
     sys_refresh_tablelist();
40 40
 
41 41
     classSupernova::$config->db_loadItem('game_watchlist');
42
-    if(classSupernova::$config->game_watchlist) {
42
+    if (classSupernova::$config->game_watchlist) {
43 43
       classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44 44
     } else {
45 45
       unset(classSupernova::$config->game_watchlist_array);
Please login to merge, or discard this patch.