Passed
Push — master ( bc874f...230097 )
by SuperNova.WS
04:01
created
includes/includes/market_trader.inc 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
3
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
4 4
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
29 29
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
30
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
30
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
31 31
     $value = 0;
32 32
     $qry = array();
33 33
 
34 34
     sn_db_transaction_start();
35
-    if($planetrow['id_owner']) {
35
+    if ($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38 38
     }
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
       $user = db_user_by_id($user['id'], true);
42 42
     }
43 43
 
44
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
44
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
45 45
       $amount = floatval($tradeList[$resource_id]);
46
-      if($amount < 0) {
46
+      if ($amount < 0) {
47 47
         $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
48 48
       }
49 49
 
50
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
50
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
51 51
         continue;
52 52
       }
53 53
 
54 54
       $resource_db_name = pname_resource_name($resource_id);
55
-      if($exchangeTo == RES_DARK_MATTER) {
55
+      if ($exchangeTo == RES_DARK_MATTER) {
56 56
         $sign = '+';
57 57
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
58 58
         $value += $amount;
59 59
       } else {
60 60
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
61
-        if($resource_id == RES_DARK_MATTER) {
61
+        if ($resource_id == RES_DARK_MATTER) {
62 62
           $amount = 0;
63 63
         } else {
64
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
64
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
65 65
             $intError = MARKET_NO_RESOURCES;
66 66
             break;
67 67
           }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         }
71 71
       }
72 72
 
73
-      if($amount) {
73
+      if ($amount) {
74 74
         $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}";
75 75
       }
76 76
     }
77 77
 
78
-    if($exchangeTo != RES_DARK_MATTER) {
78
+    if ($exchangeTo != RES_DARK_MATTER) {
79 79
       $amount = floor($value);
80 80
       $exchange_to_db_name = pname_resource_name($exchangeTo);
81 81
       $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}";
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
87 87
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
88 88
 
89
-    if($intError == MARKET_DEAL) {
89
+    if ($intError == MARKET_DEAL) {
90 90
       $qry = implode(', ', $qry);
91 91
       $table = $planetrow['id_owner'] ? 'planets' : 'users';
92 92
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
112 112
   ));
113 113
 
114
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
115
-    if($resource_id == RES_DARK_MATTER) {
114
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
115
+    if ($resource_id == RES_DARK_MATTER) {
116 116
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader);
117 117
     } else {
118 118
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
     if($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38
-    }
39
-    else {
38
+    } else {
40 39
       // Locking user record
41 40
       $user = db_user_by_id($user['id'], true);
42 41
     }
Please login to merge, or discard this patch.
includes/includes/user_birthday_celebrate.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
   $query = db_user_list_to_celebrate($config->user_birthday_range);
10 10
 
11
-  while($row = db_fetch($query))
11
+  while ($row = db_fetch($query))
12 12
   {
13 13
     $row['username'] = db_escape($row['username']);
14 14
     rpg_points_change($row['id'], RPG_BIRTHDAY, $config->user_birthday_gift, "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}");
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sn_user_birthday_celebrate()
4
-{
3
+function sn_user_birthday_celebrate() {
5 4
   global $config, $lang;
6 5
 
7 6
   sn_db_transaction_start();
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($debug_unit_crossfire_result as $key => $value)
64
+  foreach ($debug_unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sn_ube_combat_helper_round_header($round)
4
-{
3
+function sn_ube_combat_helper_round_header($round) {
5 4
   $header = array(
6 5
     'ИД1',
7 6
     'ИД2',
@@ -40,13 +39,11 @@  discard block
 block discarded – undo
40 39
   print('</tr>');
41 40
 }
42 41
 
43
-function sn_ube_combat_helper_round_footer($round = 0)
44
-{
42
+function sn_ube_combat_helper_round_footer($round = 0) {
45 43
   print('</table>');
46 44
 }
47 45
 
48
-function sn_ube_combat_helper_round_row(&$debug_unit_crossfire_result)
49
-{
46
+function sn_ube_combat_helper_round_row(&$debug_unit_crossfire_result) {
50 47
   $SN = array(
51 48
     SHIP_CARGO_SMALL => 'МаТр', SHIP_CARGO_BIG => 'БоТр', SHIP_CARGO_SUPER => 'СуТр', SHIP_CARGO_HYPER => 'ГпТр',
52 49
     SHIP_SATTELITE_SOLAR => 'СоСп', 
Please login to merge, or discard this patch.
includes/includes/flt_page2.inc 1 patch
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     'START_NAME'         => $planetrow['name'],
28 28
   );
29 29
 
30
-  if(!empty($TargetPlanet)) {
30
+  if (!empty($TargetPlanet)) {
31 31
     $template_route += array(
32 32
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
33 33
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
   $template->assign_block_vars('fleets', $template_route);
39 39
 
40 40
   $sn_groups_fleet = sn_get_groups('fleet');
41
-  foreach($fleetarray as $ship_id => $ship_count) {
42
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
41
+  foreach ($fleetarray as $ship_id => $ship_count) {
42
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
43 43
 //      $ship_base_data = get_ship_data($ship_id, $user);
44 44
       $template->assign_block_vars('fleets.ships', array(
45 45
         'ID'          => $ship_id,
@@ -57,11 +57,10 @@  discard block
 block discarded – undo
57 57
     $fleet_capacity += get_unit_param($Ship, P_CAPACITY) * $Count;
58 58
   }
59 59
 
60
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
61
-    (isset($missiontype[MT_HOLD]) ? 12 : 0);
62
-  if($max_duration) {
60
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : (isset($missiontype[MT_HOLD]) ? 12 : 0);
61
+  if ($max_duration) {
63 62
     $config_game_speed_expedition = ($target_mission == MT_EXPLORE && $config->game_speed_expedition ? $config->game_speed_expedition : 1);
64
-    for($i = 1; $i <= $max_duration; $i++) {
63
+    for ($i = 1; $i <= $max_duration; $i++) {
65 64
       $template->assign_block_vars('duration', array(
66 65
         'ID' => $i,
67 66
         'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)),
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
   // $TableTitle = uni_render_planet_full($planetrow) . '&nbsp;=&gt;&nbsp;' . uni_render_planet_full($temp);
81 80
 
82 81
   $sn_group_resources = sn_get_groups('resources');
83
-  for($i = 0; $i<3; $i++) {
82
+  for ($i = 0; $i < 3; $i++) {
84 83
     $amount = $planetrow[$sn_group_resources[$i]] - ($i == 2 ? $consumption : 0);
85 84
     $template->assign_block_vars('resources', array(
86 85
       'ID' => $i,
@@ -90,7 +89,7 @@  discard block
 block discarded – undo
90 89
     ));
91 90
   }
92 91
 
93
-  if($sn_module['unit_captain']->manifest['active'] && ($captain = $sn_module['unit_captain']->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) {
92
+  if ($sn_module['unit_captain']->manifest['active'] && ($captain = $sn_module['unit_captain']->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) {
94 93
     $template->assign_vars(array(
95 94
       'CAPTAIN_ID' => $captain['unit_id'],
96 95
       'CAPTAIN_LEVEL' => $captain['captain_level'],
@@ -111,9 +110,9 @@  discard block
 block discarded – undo
111 110
     // 'TableTitle' => $TableTitle,
112 111
 
113 112
     'speedallsmin' => sys_get_param_float('speedallsmin'),
114
-    'speed' => sys_get_param_int('speed') ,
113
+    'speed' => sys_get_param_int('speed'),
115 114
 
116
-    'fleet_group' => sys_get_param_id('fleet_group') ,
115
+    'fleet_group' => sys_get_param_id('fleet_group'),
117 116
     'acs_target_mr' => sys_get_param_str('acs_target_mr'),
118 117
 
119 118
     'MAX_DURATION' => $max_duration,
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 function sn_eco_build($que_type, &$auser, &$planet) {
19 19
   global $lang, $config, $template_result;
20 20
 
21
-  if($ally_id = sys_get_param_id('ally_id')) {
21
+  if ($ally_id = sys_get_param_id('ally_id')) {
22 22
     define('SN_IN_ALLY', true);
23 23
     $ranks = ally_get_ranks($auser['ally']);
24
-    if($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
24
+    if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
25 25
       $user = &$auser['ally']['player'];
26 26
       $planet = array(
27 27
         'metal'     => $user['metal'],
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
     }
32 32
   }
33 33
 
34
-  if(!$user) {
34
+  if (!$user) {
35 35
     $user = &$auser;
36 36
   }
37 37
 
38
-  switch($action = sys_get_param_escaped('action')) {
38
+  switch ($action = sys_get_param_escaped('action')) {
39 39
     case 'create': // Add unit to que for build
40 40
     case 'create_autoconvert': // Add unit to que for build
41 41
     case 'destroy': // Add unit to que for remove
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
   $group_missile = sn_get_groups('missile');
54 54
   $silo_capacity_free = 0;
55
-  if($que_type == QUE_STRUCTURES) {
55
+  if ($que_type == QUE_STRUCTURES) {
56 56
     $build_unit_list = sn_get_groups('build_allow');
57 57
     $build_unit_list = $build_unit_list[$planet['planet_type']];
58 58
     $artifact_id = ART_NANO_BUILDER;
59 59
     $page_header = $lang['tech'][UNIT_STRUCTURES];
60
-  } elseif($que_type == QUE_RESEARCH) {
61
-    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
60
+  } elseif ($que_type == QUE_RESEARCH) {
61
+    if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
62 62
       message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
63 63
     }
64 64
 
65
-    if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
65
+    if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
66 66
       message($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]);
67 67
     }
68 68
     $build_unit_list = sn_get_groups('tech');
69 69
     $artifact_id = ART_HEURISTIC_CHIP;
70 70
     $page_header = $lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
71
-  } elseif($que_type == QUE_MERCENARY) {
71
+  } elseif ($que_type == QUE_MERCENARY) {
72 72
 //    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
73 73
 //      message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
74 74
 //    }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $artifact_id = 0;
81 81
     $page_header = $lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
82 82
   } else {
83
-    if(mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
83
+    if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
84 84
       message($lang['need_hangar'], $lang['tech'][STRUC_FACTORY_HANGAR]);
85 85
     }
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $artifact_id = 0;
90 90
 
91 91
     $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY);
92
-    foreach($group_missile as $unit_id) {
92
+    foreach ($group_missile as $unit_id) {
93 93
       $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE);
94 94
     }
95 95
     $silo_capacity_free = max(0, $silo_capacity_free);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
   */
107 107
 
108 108
   $template = gettemplate('buildings_builds', true);
109
-  if(!empty($operation_result)) {
109
+  if (!empty($operation_result)) {
110 110
     $template_result['.']['result'][] = $operation_result;
111 111
   }
112 112
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
   $record_index = 0;
138 138
 
139
-  foreach($build_unit_list as $unit_id) {
139
+  foreach ($build_unit_list as $unit_id) {
140 140
     $level_base = mrc_get_level($user, $planet, $unit_id, false, true);
141 141
     $level_effective = mrc_get_level($user, $planet, $unit_id);
142 142
     $level_in_que = $in_que[$unit_id];
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
     $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE];
160 160
     // Restricting $can_build by free silo capacity
161 161
     $can_build = ($unit_is_missile = in_array($unit_id, $group_missile)) ? min($can_build, floor($silo_capacity_free / $unit_info[P_UNIT_SIZE])) : $can_build;
162
-    if(!$can_build) {
163
-      if(!$build_data['CAN'][BUILD_CREATE]) {
162
+    if (!$can_build) {
163
+      if (!$build_data['CAN'][BUILD_CREATE]) {
164 164
         $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES;
165
-      } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
165
+      } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
166 166
         $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL;
167
-      } elseif($unit_info[P_MAX_STACK]) {
167
+      } elseif ($unit_info[P_MAX_STACK]) {
168 168
         $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED;
169 169
       }
170 170
     }
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
       'MAP_IS_RESOURCE' => !empty($unit_info[P_UNIT_PRODUCTION]),
232 232
     );
233 233
 
234
-    if($unit_stackable) {
234
+    if ($unit_stackable) {
235 235
       $level_production_base = array(
236 236
         'ACTUAL_SHIELD' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])),
237 237
         'ACTUAL_ARMOR'  => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])),
238 238
         'ACTUAL_WEAPON' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])),
239 239
       );
240 240
 
241
-      if($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
241
+      if ($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
242 242
         $ship_data = get_ship_data($unit_id, $user);
243 243
 
244 244
         $level_production_base += array(
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
         );
249 249
       }
250 250
 
251
-      if($unit_info[P_UNIT_PRODUCTION]) {
252
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
253
-          if($resource_income =
251
+      if ($unit_info[P_UNIT_PRODUCTION]) {
252
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
253
+          if ($resource_income =
254 254
             floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc(1, 10, $user, $planet)
255 255
               * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
256 256
               * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
         }
261 261
       }
262 262
       $production['.']['resource'][] = $level_production_base;
263
-    } elseif($unit_info[P_UNIT_PRODUCTION]) {
263
+    } elseif ($unit_info[P_UNIT_PRODUCTION]) {
264 264
       $level_production_base = array();
265 265
       $element_level_start = $level_effective + $in_que[$unit_id];
266
-      foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
267
-        if($resource_income =
266
+      foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
267
+        if ($resource_income =
268 268
           floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($element_level_start, 10, $user, $planet)
269 269
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
270 270
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
       }
275 275
 
276 276
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
277
-      for($i = 0; $i < 6; $i++) {
277
+      for ($i = 0; $i < 6; $i++) {
278 278
         $level_production = array('LEVEL' => $level_start + $i);
279
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
280
-          if(
279
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
280
+          if (
281 281
           $resource_income = floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($level_start + $i, 10, $user, $planet)
282 282
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
283 283
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         }
289 289
         $production['.']['resource'][] = $level_production;
290 290
       }
291
-    } elseif($unit_id == TECH_ASTROTECH) {
291
+    } elseif ($unit_id == TECH_ASTROTECH) {
292 292
       $element_level_start = $level_effective + $in_que[$unit_id];
293 293
       $level_production_base = array(
294 294
         UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start),
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
       );
297 297
 
298 298
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
299
-      for($i = 0; $i < 6; $i++) {
299
+      for ($i = 0; $i < 6; $i++) {
300 300
         $level_production = array('LEVEL' => $level_start + $i);
301 301
         $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
302 302
         $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     $template_result['.']['production'][] = $production;
318 318
   }
319 319
 
320
-  foreach($lang['player_option_building_sort'] as $sort_id => $sort_text) {
320
+  foreach ($lang['player_option_building_sort'] as $sort_id => $sort_text) {
321 321
     $template->assign_block_vars('sort_values', array(
322 322
       'VALUE' => $sort_id,
323 323
       'TEXT'  => $sort_text,
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 
327 327
   $sort_option = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)];
328 328
   $sort_option_inverse = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)];
329
-  if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
330
-    switch($sort_option) {
329
+  if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
330
+    switch ($sort_option) {
331 331
       case PLAYER_OPTION_SORT_NAME:
332 332
         $sort_option_field = 'NAME';
333 333
       break;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
       break;
343 343
     }
344 344
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
345
-    usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
345
+    usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
346 346
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
347 347
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
348 348
       );
Please login to merge, or discard this patch.
includes/includes/flt_mission_colonize.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 
18 18
   global $lang;
19 19
 
20
-  $TargetAdress = sprintf ($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
20
+  $TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
21 21
 
22 22
   $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
23 23
 
24 24
   $TheMessage = $lang['sys_colo_no_colonizer'];
25
-  if($fleet_array[SHIP_COLONIZER] >= 1)
25
+  if ($fleet_array[SHIP_COLONIZER] >= 1)
26 26
   {
27 27
     $TheMessage = $lang['sys_colo_notfree'];
28 28
     if (!$mission_data['dst_planet'] || empty($mission_data['dst_planet']))
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
       // Can we colonize more planets?
33 33
       $TheMessage = $lang['sys_colo_maxcolo'];
34
-      if($iPlanetCount < get_player_max_colonies($src_user_row))
34
+      if ($iPlanetCount < get_player_max_colonies($src_user_row))
35 35
       {
36 36
         // Yes, we can colonize
37 37
         $TheMessage = $lang['sys_colo_badpos'];
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         if ($NewOwnerPlanet)
43 43
         {
44 44
           $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
45
-          msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
45
+          msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
46 46
 
47 47
           $fleet_array[SHIP_COLONIZER]--;
48 48
           $fleet_row['fleet_amount']--;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 // ----------------------------------------------------------------------------------------------------------------
11 11
 // Mission Case 9: -> Coloniser
12 12
 //
13
-function flt_mission_colonize(&$mission_data)
14
-{
13
+function flt_mission_colonize(&$mission_data) {
15 14
   $fleet_row          = &$mission_data['fleet'];
16 15
   $src_user_row       = &$mission_data['src_user'];
17 16
 
Please login to merge, or discard this patch.
includes/includes/sys_avatar.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
     $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id;
10 10
     $avatar_filename .= '.png';
11 11
     $fullsize_filename .= '_full.png';
12
-    if(sys_get_param_int('avatar_remove'))
12
+    if (sys_get_param_int('avatar_remove'))
13 13
     {
14
-      if(file_exists($avatar_filename) && !unlink($avatar_filename))
14
+      if (file_exists($avatar_filename) && !unlink($avatar_filename))
15 15
       {
16 16
         throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
17 17
       }
18 18
       $avatar_field = 0;
19 19
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20 20
     }
21
-    elseif($_FILES['avatar']['size'])
21
+    elseif ($_FILES['avatar']['size'])
22 22
     {
23
-      if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
23
+      if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 24
       {
25 25
         throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
26 26
       }
27 27
 
28
-      if($_FILES['avatar']['error'])
28
+      if ($_FILES['avatar']['error'])
29 29
       {
30 30
         throw new Exception(sprintf($lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR);
31 31
       }
32 32
 
33
-      if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name']))))
33
+      if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name']))))
34 34
       {
35 35
         throw new Exception($lang['opt_msg_avatar_error_unsupported'], ERR_WARNING);
36 36
       }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
       $avatar_size = getimagesize($_FILES['avatar']['tmp_name']);
39 39
       $avatar_max_width  = $config-> avatar_max_width;
40 40
       $avatar_max_height = $config-> avatar_max_height;
41
-      if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height)
41
+      if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height)
42 42
       {
43 43
         $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]);
44 44
         $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio);
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
         $avatar_image = $avatar_image_new;
48 48
       }
49 49
 
50
-      if(file_exists($avatar_filename) && !unlink($avatar_filename))
50
+      if (file_exists($avatar_filename) && !unlink($avatar_filename))
51 51
       {
52 52
         throw new Exception($lang['opt_msg_avatar_error_delete'], ERR_ERROR);
53 53
       }
54 54
 
55
-      if(!imagepng($avatar_image, $avatar_filename, 9))
55
+      if (!imagepng($avatar_image, $avatar_filename, 9))
56 56
       {
57 57
         throw new Exception($lang['opt_msg_avatar_error_writing'], ERR_ERROR);
58 58
       }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar')
4
-{
3
+function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') {
5 4
   global $config, $lang, $user;
6 5
 
7 6
   try
@@ -17,8 +16,7 @@  discard block
 block discarded – undo
17 16
       }
18 17
       $avatar_field = 0;
19 18
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20
-    }
21
-    elseif($_FILES['avatar']['size'])
19
+    } elseif($_FILES['avatar']['size'])
22 20
     {
23 21
       if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 22
       {
@@ -61,8 +59,7 @@  discard block
 block discarded – undo
61 59
       imagedestroy($avatar_image);
62 60
       throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE);
63 61
     }
64
-  }
65
-  catch (Exception $e)
62
+  } catch (Exception $e)
66 63
   {
67 64
     return array(
68 65
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
Please login to merge, or discard this patch.
includes/includes/flt_mission_attack.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 */
8 8
 
9 9
 
10
-function flt_planet_capture(&$fleet_row, &$combat_data) {return sn_function_call('flt_planet_capture', array(&$fleet_row, &$combat_data, &$result));}
10
+function flt_planet_capture(&$fleet_row, &$combat_data) {return sn_function_call('flt_planet_capture', array(&$fleet_row, &$combat_data, &$result)); }
11 11
 function sn_flt_planet_capture(&$fleet_row, &$combat_data, &$result) {
12 12
   return $result;
13 13
 }
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
   $destination_user = $mission_data['dst_user'];
18 18
   $destination_planet = $mission_data['dst_planet'];
19 19
 
20
-  if(!$fleet_row) {
20
+  if (!$fleet_row) {
21 21
     return null;
22 22
   }
23 23
 
24
-  if(
24
+  if (
25 25
     // Нет данных о планете назначения или её владельце
26 26
     empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet)
27 27
     ||
Please login to merge, or discard this patch.
includes/pages/battle_report.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
   $combat_data = sn_ube_report_load(sys_get_param_str('cypher'));
17 17
 
18
-  if($combat_data != UBE_REPORT_NOT_FOUND) {
18
+  if ($combat_data != UBE_REPORT_NOT_FOUND) {
19 19
     sn_ube_report_generate($combat_data, $template_result);
20 20
     $template = gettemplate('ube_combat_report', $template);
21 21
     $template->assign_vars(array(
Please login to merge, or discard this patch.