Completed
Push — work-fleets ( 9e446e...674b8a )
by SuperNova.WS
12:48 queued 05:50
created
includes/pages/imperium.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
   $sn_group_factories = sn_get_groups('factories');
23 23
   $planet_density = sn_get_groups('planet_density');
24 24
 
25
-  if(sys_get_param('save_production')) {
25
+  if (sys_get_param('save_production')) {
26 26
     $production = sys_get_param('percent');
27
-    if(is_array($production) && !empty($production)) {
27
+    if (is_array($production) && !empty($production)) {
28 28
       // sn_db_transaction_start();
29 29
       $query = array();
30 30
       $planet_row_list = db_planet_list_sorted($user, false, '*');
31 31
       // while($planet = db_fetch($planet_row_list))
32
-      foreach($planet_row_list as $planet) {
33
-        foreach($sn_group_factories as $factory_unit_id) {
32
+      foreach ($planet_row_list as $planet) {
33
+        foreach ($sn_group_factories as $factory_unit_id) {
34 34
           $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id);
35
-          if(
35
+          if (
36 36
             get_unit_param($factory_unit_id, P_MINING_IS_MANAGED)
37 37
             && isset($production[$factory_unit_id][$planet['id']])
38 38
             && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
           }
44 44
         }
45 45
       }
46
-      foreach($query as $planet_id => $query_data) {
46
+      foreach ($query as $planet_id => $query_data) {
47 47
         db_planet_set_by_id($planet_id, implode(',', $query_data));
48 48
       }
49 49
       // sn_db_transaction_commit();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
   $planet_row_list = db_planet_list_sorted($user);
54 54
   // while ($planet = db_fetch($planet_row_list))
55
-  foreach($planet_row_list as $planet) {
55
+  foreach ($planet_row_list as $planet) {
56 56
     sn_db_transaction_start();
57 57
     $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true);
58 58
     $planets[$planet['id']] = $global_data['planet'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
   $template = gettemplate('imperium', $template);
65 65
   $template->assign_var('amount', count($planets) + 2);
66 66
 
67
-  for($i = 100; $i >= 0; $i -= 10) {
67
+  for ($i = 100; $i >= 0; $i -= 10) {
68 68
     $template->assign_block_vars('percent', array('PERCENT' => $i));
69 69
   }
70 70
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
   $total['temp_min'] = 1000;
75 75
   $total['temp_max'] = -999;
76 76
 
77
-  foreach($planets as $planet_index => &$planet) {
77
+  foreach ($planets as $planet_index => &$planet) {
78 78
     $list_planet_que = $ques[$planet_index];
79 79
     $planet_template = tpl_parse_planet($planet);
80 80
 
81 81
     $planet_fleet_id = 0;
82
-    $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet);
83
-    if($fleet_list['own']['count']) {
82
+    $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet);
83
+    if ($fleet_list['own']['count']) {
84 84
       $planet_fleet_id = "p{$fleet_id}";
85 85
       $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
86 86
       $fleet_id++;
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
     UNIT_DEFENCE            => 'defense',
142 142
   );
143 143
 
144
-  foreach($show_groups as $unit_group_id => $mode) {
144
+  foreach ($show_groups as $unit_group_id => $mode) {
145 145
     $template->assign_block_vars('prods', array(
146 146
       'NAME' => classLocale::$lang['tech'][$unit_group_id],
147 147
     ));
148 148
     $unit_group = get_unit_param('techtree', $unit_group_id);
149
-    foreach($unit_group as $unit_id) {
149
+    foreach ($unit_group as $unit_id) {
150 150
       $unit_count = $unit_count_abs = 0;
151 151
       $block_vars = array();
152 152
       $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED);
153 153
       // $unit_db_name = pname_resource_name($unit_id);
154
-      foreach($planets as $planet) {
154
+      foreach ($planets as $planet) {
155 155
         $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true);
156 156
 
157 157
         $level_plus['FACTORY'] = $unit_is_factory;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $level_plus['LEVEL_PLUS_GREEN'] = 0;
160 160
 
161 161
         $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1;
162
-        switch($mode) {
162
+        switch ($mode) {
163 163
           /*
164 164
           case 'structures':
165 165
             $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id];
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
           case 'structures':
180 180
           case 'defense':
181 181
             $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id];
182
-            if($level_plus_build) {
182
+            if ($level_plus_build) {
183 183
               $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}";
184 184
               // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}";
185 185
               $total['units'][$unit_id]['LEVEL_PLUS_GREEN'] += $level_plus['LEVEL_PLUS_GREEN'];
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']);
200 200
       }
201 201
 
202
-      if($unit_count_abs) {
202
+      if ($unit_count_abs) {
203 203
         $template->assign_block_vars('prods', array(
204 204
           'ID'    => $unit_id,
205 205
           'FIELD' => 'unit_' . $unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
           'MODE'  => $mode,
208 208
         ));
209 209
 
210
-        foreach($block_vars as $block_var) {
210
+        foreach ($block_vars as $block_var) {
211 211
           $template->assign_block_vars('prods.planet', $block_var);
212 212
         }
213 213
         $unit_green = $total['units'][$unit_id]['LEVEL_PLUS_GREEN'];
Please login to merge, or discard this patch.
includes/pages/contact.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
   $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC");
17 17
 
18 18
   // while($row = db_fetch($query))
19
-  foreach($query as $row) {
19
+  foreach ($query as $row) {
20 20
     $template_result['.']['contact'][] = array(
21 21
       'NAME'  => $row['username'],
22 22
       'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']],
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 // Changing rank for single user
10 10
 $id_user = sys_get_param_id('id_user');
11
-if(isset($_GET['id_rank'])) {
11
+if (isset($_GET['id_rank'])) {
12 12
   $id_rank = sys_get_param_int('id_rank');
13 13
 }
14
-if($id_user && isset($id_rank) && $user_admin) {
14
+if ($id_user && isset($id_rank) && $user_admin) {
15 15
   db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
16 16
 }
17 17
 
18 18
 $id_kick = sys_get_param_id('kick');
19 19
 
20
-if($id_kick && $user_can_kick) {
20
+if ($id_kick && $user_can_kick) {
21 21
   $u = db_user_by_id($id_kick, true);
22
-  if($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
22
+  if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
23 23
     db_user_set_by_id($id_kick, '`ally_id`= null, `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0');
24 24
     db_ally_update_member_decrease($ally);
25 25
   }
26 26
 }
27 27
 
28 28
 $sort2 = sys_get_param_int('sort2');
29
-if($sort2) {
29
+if ($sort2) {
30 30
   $sort2s = "DESC";
31 31
   $sort2 = 0;
32 32
 } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 $sort1 = sys_get_param_int('sort1');
38
-if($sort1 > 5 || $sort1 < 0) {
38
+if ($sort1 > 5 || $sort1 < 0) {
39 39
   $sort1 = 0;
40 40
 }
41 41
 $sort1s = array(
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
54 54
 
55 55
 // while ($userRow = db_fetch($userList))
56
-foreach($userList as $userRow) {
56
+foreach ($userList as $userRow) {
57 57
   $i++;
58
-  if(!isset($ranks[$userRow['ally_rank_id']])) {
58
+  if (!isset($ranks[$userRow['ally_rank_id']])) {
59 59
     $userRow['ally_rank_id'] = 0;
60 60
   }
61 61
 
62
-  if($ally['ally_owner'] == $userRow['id']) {
62
+  if ($ally['ally_owner'] == $userRow['id']) {
63 63
     $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
64 64
   } else {
65
-    if($user_admin) {
65
+    if ($user_admin) {
66 66
       $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
67 67
 
68
-      foreach($ranks as $rankID => $rankArray) {
68
+      foreach ($ranks as $rankID => $rankArray) {
69 69
         $ally_range .= '<option value="' . $rankID . '"';
70
-        if($rankID == $userRow['ally_rank_id']) {
70
+        if ($rankID == $userRow['ally_rank_id']) {
71 71
           $ally_range .= " selected";
72 72
         }
73 73
         $ally_range .= '>' . $rankArray['name'];
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
   }
81 81
 
82 82
   $last_active = time() - $userRow["onlinetime"];
83
-  if($user_admin) {
84
-    if($last_active < 60) {
83
+  if ($user_admin) {
84
+    if ($last_active < 60) {
85 85
       $tmp = "lime>{$classLocale['On']}";
86
-    } elseif($last_active < 60 * 60) {
86
+    } elseif ($last_active < 60 * 60) {
87 87
       $last_active = round($last_active / 60);
88 88
       $tmp = "lime>{$last_active} {$classLocale['sys_min_short']}";
89
-    } elseif($last_active < 60 * 60 * 24) {
89
+    } elseif ($last_active < 60 * 60 * 24) {
90 90
       $last_active = round($last_active / (60 * 60));
91 91
       $tmp = "green>{$last_active} {$classLocale['sys_hrs_short']}";
92 92
     } else {
93 93
       $last_active = round($last_active / (60 * 60 * 24));
94
-      if($last_active < 7) {
94
+      if ($last_active < 7) {
95 95
         $tmp = "yellow";
96
-      } elseif($last_active < 30) {
96
+      } elseif ($last_active < 30) {
97 97
         $tmp = "orange";
98 98
       } else {
99 99
         $tmp = "red";
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
       $tmp .= ">{$last_active} {$classLocale['sys_day_short']}";
102 102
     }
103 103
   } else {
104
-    if($user_onlinestatus) {
105
-      if($last_active < 60 * 5) {
104
+    if ($user_onlinestatus) {
105
+      if ($last_active < 60 * 5) {
106 106
         $tmp = "lime>{$classLocale['On']}";
107
-      } elseif($last_active < 60 * 15) {
107
+      } elseif ($last_active < 60 * 15) {
108 108
         $tmp = "yellow>{$classLocale['ali_lessThen15min']}";
109 109
       } else {
110 110
         $tmp = "red>{$classLocale['Off']}";
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   ));
132 132
 }
133 133
 
134
-if($i != $ally['ally_members']) {
134
+if ($i != $ally['ally_members']) {
135 135
   db_ally_update_member_set($i, $ally);
136 136
 }
137 137
 
Please login to merge, or discard this patch.
admin/admin_chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage(classLocale::$lang['adm_err_denied']);
19 19
 }
20 20
 
21
-if($delete = sys_get_param_str('delete')) {
21
+if ($delete = sys_get_param_str('delete')) {
22 22
   db_chat_message_delete($delete);
23
-} elseif(sys_get_param_str('deleteall') == 'yes') {
23
+} elseif (sys_get_param_str('deleteall') == 'yes') {
24 24
   db_chat_message_purge();
25 25
 }
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $query = db_chat_message_get_last_25();
30 30
 $i = 0;
31
-while($e = db_fetch($query)) {
31
+while ($e = db_fetch($query)) {
32 32
   $i++;
33 33
   $template->assign_block_vars('messages', array(
34 34
     'ID' => $e['messageid'],
Please login to merge, or discard this patch.
admin/banned.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
18 18
 
19
-if($user['authlevel'] < 1) {
19
+if ($user['authlevel'] < 1) {
20 20
   AdminMessage(classLocale::$lang['adm_err_denied']);
21 21
 }
22 22
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 $template = gettemplate("admin/admin_ban", true);
29 29
 
30 30
 $player_banned_row = db_user_by_username($name_unsafe);
31
-if($mode == 'banit' && $action) {
32
-  if($player_banned_row) {
31
+if ($mode == 'banit' && $action) {
32
+  if ($player_banned_row) {
33 33
     $reas = $_POST['why'];
34 34
     $days = $_POST['days'];
35 35
     $hour = $_POST['hour'];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     $adm_bn_thpl = classLocale::$lang['adm_bn_thpl'];
50 50
     $DoneMessage = "{$adm_bn_thpl} {$name_output} {$adm_bn_isbn}";
51 51
 
52
-    if($is_vacation) {
52
+    if ($is_vacation) {
53 53
       $DoneMessage .= classLocale::$lang['adm_bn_vctn'];
54 54
     }
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   }
60 60
 
61 61
   AdminMessage($DoneMessage, classLocale::$lang['adm_ban_title']);
62
-} elseif($mode == 'unbanit' && $action) {
62
+} elseif ($mode == 'unbanit' && $action) {
63 63
   sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : classLocale::$lang['sys_unbanned']);
64 64
 
65 65
   $DoneMessage = classLocale::$lang['adm_unbn_thpl'] . " " . $name_output . " " . classLocale::$lang['adm_unbn_isbn'];
Please login to merge, or discard this patch.
admin/planet_compensate.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('INSIDE'  , true);
3
-define('INSTALL' , false);
2
+define('INSIDE', true);
3
+define('INSTALL', false);
4 4
 define('IN_ADMIN', true);
5 5
 
6 6
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
7 7
 
8
-if($user['authlevel'] < 3)
8
+if ($user['authlevel'] < 3)
9 9
 {
10 10
   AdminMessage(classLocale::$lang['adm_err_denied']);
11 11
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $username_unsafe = sys_get_param_str_unsafe('username');
26 26
 $username = sys_get_param_escaped('username');
27 27
 
28
-if($galaxy_src)
28
+if ($galaxy_src)
29 29
 {
30 30
   sn_db_transaction_start();
31 31
   $errors = array();
@@ -35,41 +35,41 @@  discard block
 block discarded – undo
35 35
   $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW);
36 36
   $que    = $planet['que'];
37 37
   $planet = $planet['planet'];
38
-  if(!$planet)
38
+  if (!$planet)
39 39
   {
40 40
     $errors[] = classLocale::$lang['adm_pl_comp_err_0'];
41 41
   }
42 42
 
43
-  if($planet['destruyed'])
43
+  if ($planet['destruyed'])
44 44
   {
45 45
     $errors[] = classLocale::$lang['adm_pl_comp_err_1'];
46 46
   }
47 47
 
48
-  if($planet['id_owner'] != $owner['id'] || !$username)
48
+  if ($planet['id_owner'] != $owner['id'] || !$username)
49 49
   {
50 50
     $errors[] = classLocale::$lang['adm_pl_comp_err_4'];
51 51
   }
52 52
 
53 53
   $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW);
54 54
   $destination = $destination['planet'];
55
-  if(!$destination)
55
+  if (!$destination)
56 56
   {
57 57
     $errors[] = classLocale::$lang['adm_pl_comp_err_2'];
58 58
   }
59 59
 
60
-  if($planet['id'] == $destination['id'])
60
+  if ($planet['id'] == $destination['id'])
61 61
   {
62 62
     $errors[] = classLocale::$lang['adm_pl_comp_err_5'];
63 63
   }
64 64
 
65
-  if($planet['id_owner'] != $destination['id_owner'])
65
+  if ($planet['id_owner'] != $destination['id_owner'])
66 66
   {
67 67
     $errors[] = classLocale::$lang['adm_pl_comp_err_3'];
68 68
   }
69 69
 
70
-  if(!empty($errors))
70
+  if (!empty($errors))
71 71
   {
72
-    foreach($errors as $error)
72
+    foreach ($errors as $error)
73 73
     {
74 74
       $template->assign_block_vars('error', array(
75 75
         'TEXT' => $error,
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
     killer_add_planet($planet);
84 84
 
85 85
     $moon = db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true);
86
-    if($moon)
86
+    if ($moon)
87 87
     {
88 88
       $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW);
89 89
       $moon = $moon['planet'];
90 90
       killer_add_planet($moon);
91 91
     }
92 92
 
93
-    foreach(sn_get_groups('resources_loot') as $resource_id)
93
+    foreach (sn_get_groups('resources_loot') as $resource_id)
94 94
     {
95 95
       $resource_name = pname_resource_name($resource_id);
96 96
       $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
       $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]);
99 99
     }
100 100
 
101
-    if($_GET['btn_confirm'])
101
+    if ($_GET['btn_confirm'])
102 102
     {
103 103
       $time = SN_TIME_NOW + PERIOD_DAY;
104 104
 
105 105
       db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']);
106 106
       db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}");
107
-      if($moon)
107
+      if ($moon)
108 108
       {
109 109
         db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']);
110 110
         db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}");
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   'username' => $username,
132 132
 ));
133 133
 
134
-display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true );
134
+display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true);
135 135
 
136 136
 function killer_add_planet($planet)
137 137
 {
@@ -146,34 +146,34 @@  discard block
 block discarded – undo
146 146
   }
147 147
   */
148 148
 
149
-  foreach(sn_get_groups('structures') as $unit_id)
149
+  foreach (sn_get_groups('structures') as $unit_id)
150 150
   {
151 151
     $build_level = mrc_get_level($user, $planet, $unit_id, true, true);
152
-    if($build_level > 0)
152
+    if ($build_level > 0)
153 153
     {
154 154
       $unit_cost = get_unit_param($unit_id, 'cost');
155 155
       $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor'];
156
-      foreach($sn_group_resources_loot as $resource_id)
156
+      foreach ($sn_group_resources_loot as $resource_id)
157 157
       {
158 158
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0;
159 159
       }
160 160
     }
161 161
   }
162 162
 
163
-  foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id)
163
+  foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id)
164 164
   {
165 165
     $unit_count = mrc_get_level($user, $planet, $unit_id, true, true);
166
-    if($unit_count > 0)
166
+    if ($unit_count > 0)
167 167
     {
168 168
       $unit_cost = get_unit_param($unit_id, 'cost');
169
-      foreach($sn_group_resources_loot as $resource_id)
169
+      foreach ($sn_group_resources_loot as $resource_id)
170 170
       {
171 171
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0;
172 172
       }
173 173
     }
174 174
   }
175 175
 
176
-  foreach($sn_group_resources_loot as $resource_id)
176
+  foreach ($sn_group_resources_loot as $resource_id)
177 177
   {
178 178
     $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true));
179 179
   }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
         'TEXT' => $error,
80 80
       ));
81 81
     }
82
-  }
83
-  else
82
+  } else
84 83
   {
85 84
     $template->assign_var('CHECK', 1);
86 85
 
@@ -159,8 +158,7 @@  discard block
 block discarded – undo
159 158
 
160 159
 display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true );
161 160
 
162
-function killer_add_planet($planet)
163
-{
161
+function killer_add_planet($planet) {
164 162
   global $final_cost;
165 163
 
166 164
   $final_cost = array();
Please login to merge, or discard this patch.
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/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.