Completed
Branch trunk (78000f)
by SuperNova.WS
25:55 queued 09:00
created
includes/includes/market_fleeter.inc 1 patch
Spacing   +26 added lines, -26 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) {
3
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
4 4
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
   'rpg_cost' => $rpg_cost,
13 13
 ));
14 14
 
15
-if(is_array($shipList)) {
16
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
15
+if (is_array($shipList)) {
16
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
17 17
     $intError = MARKET_NO_DM;
18 18
   }
19 19
 
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
   $qry = array();
31 31
   $total = array();
32 32
   $db_changeset = array();
33
-  foreach($shipList as $shipID => &$shipCount) {
33
+  foreach ($shipList as $shipID => &$shipCount) {
34 34
     $shipCount = ceil(floatval($shipCount));
35
-    if(!$shipCount) {
35
+    if (!$shipCount) {
36 36
       continue;
37 37
     }
38 38
 
39
-    if($shipCount < 0) {
39
+    if ($shipCount < 0) {
40 40
       $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
41 41
       $intError = MARKET_NEGATIVE_SHIPS;
42 42
       break;
43 43
     }
44 44
 
45
-    if($mode == MARKET_SCRAPPER) {
45
+    if ($mode == MARKET_SCRAPPER) {
46 46
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
47
-    } elseif($mode == MARKET_STOCKMAN) {
47
+    } elseif ($mode == MARKET_STOCKMAN) {
48 48
       $amount = $stock[$shipID];
49 49
     }
50 50
 
51
-    if($amount < $shipCount) {
51
+    if ($amount < $shipCount) {
52 52
       $intError = $error_no_stock;
53 53
       break;
54 54
     }
55 55
 
56
-    if(!in_array($shipID, sn_get_groups('fleet'))) {
56
+    if (!in_array($shipID, sn_get_groups('fleet'))) {
57 57
       $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
58 58
       $intError = MARKET_NOT_A_SHIP;
59 59
       break;
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
70 70
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
71 71
 
72
-    foreach($resTemp as $resID => $resCount) {
72
+    foreach ($resTemp as $resID => $resCount) {
73 73
       $total[$resID] += $resCount;
74 74
     }
75 75
 
76 76
     $message .= "<li>{$lang['tech'][$shipID]}: " . pretty_number($shipCount);
77 77
   }
78 78
 
79
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
80
-    foreach($total as $resID => $resCount) {
81
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
79
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
80
+    foreach ($total as $resID => $resCount) {
81
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82 82
         $intError = MARKET_NO_RESOURCES;
83 83
         $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
84 84
         break;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 
89 89
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
90 90
 
91
-  if($intError == MARKET_DEAL) {
91
+  if ($intError == MARKET_DEAL) {
92 92
     $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>';
93
-    foreach($total as $resID => $resCount) {
94
-      if(!$resCount) {
93
+    foreach ($total as $resID => $resCount) {
94
+      if (!$resCount) {
95 95
         continue;
96 96
       }
97 97
 
@@ -125,38 +125,38 @@  discard block
 block discarded – undo
125 125
       'MESSAGE' => $lang['eco_mrk_errors'][$intError],
126 126
     ));
127 127
 
128
-    foreach($shipList as $shipID => $shipCount) {
128
+    foreach ($shipList as $shipID => $shipCount) {
129 129
       $data['ships'][$shipID] = max(0, intval($shipCount));
130 130
     }
131 131
   }
132 132
 }
133 133
 $message = '';
134 134
 
135
-if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
136
-  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet'))));
135
+if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) {
136
+  $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet'))));
137 137
 }
138 138
 
139 139
 tpl_set_resource_info($template, $planetrow, array());
140 140
 
141
-if(!$array) {
141
+if (!$array) {
142 142
   $array = array();
143 143
 }
144 144
 
145 145
 $group_fleet = sn_get_groups('fleet');
146
-foreach($array as $key => $value) {
147
-  if($mode == MARKET_SCRAPPER) {
146
+foreach ($array as $key => $value) {
147
+  if ($mode == MARKET_SCRAPPER) {
148 148
     $shipID = $value;
149 149
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
150
-  } elseif($mode == MARKET_STOCKMAN) {
150
+  } elseif ($mode == MARKET_STOCKMAN) {
151 151
     $shipID = $key;
152 152
     $amount = $value;
153 153
   }
154 154
 
155
-  if(!in_array($shipID, $group_fleet)) {
155
+  if (!in_array($shipID, $group_fleet)) {
156 156
     continue;
157 157
   }
158 158
 
159
-  if($amount > 0) {
159
+  if ($amount > 0) {
160 160
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
161 161
     $template->assign_block_vars('ships', array(
162 162
       'ID'        => $shipID,
Please login to merge, or discard this patch.
includes/includes/flt_page3.inc 2 patches
Braces   +41 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,18 +18,24 @@  discard block
 block discarded – undo
18 18
 
19 19
   // Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu
20 20
   $errorlist = '';
21
-  if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1)
22
-    $errorlist .= $lang['fl_limit_galaxy'];
23
-  if (!$system || $system > $config->game_maxSystem || $system < 1)
24
-    $errorlist .= $lang['fl_limit_system'];
25
-  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE ))
26
-    $errorlist .= $lang['fl_limit_planet'];
27
-  if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type)
28
-    $errorlist .= $lang['fl_ownpl_err'];
29
-  if (!$planet_type)
30
-    $errorlist .= $lang['fl_no_planettype'];
31
-  if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON)
32
-    $errorlist .= $lang['fl_fleet_err_pl'];
21
+  if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) {
22
+      $errorlist .= $lang['fl_limit_galaxy'];
23
+  }
24
+  if (!$system || $system > $config->game_maxSystem || $system < 1) {
25
+      $errorlist .= $lang['fl_limit_system'];
26
+  }
27
+  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) {
28
+      $errorlist .= $lang['fl_limit_planet'];
29
+  }
30
+  if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) {
31
+      $errorlist .= $lang['fl_ownpl_err'];
32
+  }
33
+  if (!$planet_type) {
34
+      $errorlist .= $lang['fl_no_planettype'];
35
+  }
36
+  if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) {
37
+      $errorlist .= $lang['fl_fleet_err_pl'];
38
+  }
33 39
   if (empty($missiontype[$target_mission])) {
34 40
     $errorlist .= $lang['fl_bad_mission'];
35 41
   }
@@ -56,29 +62,35 @@  discard block
 block discarded – undo
56 62
     }
57 63
   } else {
58 64
     if ($TargetPlanet['id_owner']){
59
-      if ($target_mission == MT_COLONIZE)
60
-        $errorlist .= $lang['fl_colonized'];
65
+      if ($target_mission == MT_COLONIZE) {
66
+              $errorlist .= $lang['fl_colonized'];
67
+      }
61 68
 
62 69
       if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){
63
-        if ($target_mission == MT_ATTACK)
64
-          $errorlist .= $lang['fl_no_self_attack'];
65
-
66
-        if ($target_mission == MT_SPY)
67
-          $errorlist .= $lang['fl_no_self_spy'];
68
-      }else{
69
-        if ($target_mission == MT_RELOCATE)
70
-          $errorlist .= $lang['fl_only_stay_at_home'];
70
+        if ($target_mission == MT_ATTACK) {
71
+                  $errorlist .= $lang['fl_no_self_attack'];
72
+        }
73
+
74
+        if ($target_mission == MT_SPY) {
75
+                  $errorlist .= $lang['fl_no_self_spy'];
76
+        }
77
+      } else{
78
+        if ($target_mission == MT_RELOCATE) {
79
+                  $errorlist .= $lang['fl_only_stay_at_home'];
80
+        }
71 81
       }
72
-    }else{
82
+    } else{
73 83
       if ($target_mission < MT_COLONIZE){
74 84
         $errorlist .= $lang['fl_unknow_target'];
75
-      }else{
76
-        if ($target_mission == MT_DESTROY)
77
-          $errorlist .= $lang['fl_nomoon'];
85
+      } else{
86
+        if ($target_mission == MT_DESTROY) {
87
+                  $errorlist .= $lang['fl_nomoon'];
88
+        }
78 89
 
79 90
         if ($target_mission == MT_RECYCLE){
80
-          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
81
-            $errorlist .= $lang['fl_nodebris'];
91
+          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) {
92
+                      $errorlist .= $lang['fl_nodebris'];
93
+          }
82 94
         }
83 95
       }
84 96
     }
@@ -126,8 +138,7 @@  discard block
 block discarded – undo
126 138
       $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true);
127 139
       if (!$aks) {
128 140
         $fleet_group = 0;
129
-      }
130
-      else
141
+      } else
131 142
       {
132 143
         $galaxy = $aks['galaxy'];
133 144
         $system = $aks['system'];
Please login to merge, or discard this patch.
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 // @version 1.0
4 4
 // @copyright 2008 by Chlorel for XNova
5 5
 
6
-if(SN_IN_FLEET !== true) {
6
+if (SN_IN_FLEET !== true) {
7 7
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
8 8
 }
9 9
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     $errorlist .= $lang['fl_limit_galaxy'];
23 23
   if (!$system || $system > $config->game_maxSystem || $system < 1)
24 24
     $errorlist .= $lang['fl_limit_system'];
25
-  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE ))
25
+  if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE))
26 26
     $errorlist .= $lang['fl_limit_planet'];
27 27
   if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type)
28 28
     $errorlist .= $lang['fl_ownpl_err'];
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
50 50
 
51 51
   if ($target_mission == MT_EXPLORE) {
52
-    if ($MaxExpeditions == 0 ) {
52
+    if ($MaxExpeditions == 0) {
53 53
       $errorlist .= $lang['fl_expe_notech'];
54
-    } elseif ($FlyingExpeditions >= $MaxExpeditions ) {
54
+    } elseif ($FlyingExpeditions >= $MaxExpeditions) {
55 55
       $errorlist .= $lang['fl_expe_max'];
56 56
     }
57 57
   } else {
58
-    if ($TargetPlanet['id_owner']){
58
+    if ($TargetPlanet['id_owner']) {
59 59
       if ($target_mission == MT_COLONIZE)
60 60
         $errorlist .= $lang['fl_colonized'];
61 61
 
62
-      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){
62
+      if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) {
63 63
         if ($target_mission == MT_ATTACK)
64 64
           $errorlist .= $lang['fl_no_self_attack'];
65 65
 
66 66
         if ($target_mission == MT_SPY)
67 67
           $errorlist .= $lang['fl_no_self_spy'];
68
-      }else{
68
+      } else {
69 69
         if ($target_mission == MT_RELOCATE)
70 70
           $errorlist .= $lang['fl_only_stay_at_home'];
71 71
       }
72
-    }else{
73
-      if ($target_mission < MT_COLONIZE){
72
+    } else {
73
+      if ($target_mission < MT_COLONIZE) {
74 74
         $errorlist .= $lang['fl_unknow_target'];
75
-      }else{
75
+      } else {
76 76
         if ($target_mission == MT_DESTROY)
77 77
           $errorlist .= $lang['fl_nomoon'];
78 78
 
79
-        if ($target_mission == MT_RECYCLE){
80
-          if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
79
+        if ($target_mission == MT_RECYCLE) {
80
+          if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0)
81 81
             $errorlist .= $lang['fl_nodebris'];
82 82
         }
83 83
       }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
   }
86 86
 
87 87
 
88
-  if($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) {
88
+  if ($sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) {
89 89
     $captain = $sn_module['unit_captain']->unit_captain_get($planetrow['id']);
90 90
 //      mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true);
91
-    if(!$captain) {
91
+    if (!$captain) {
92 92
       $errorlist .= $lang['module_unit_captain_error_no_captain'];
93
-    } elseif($captain['unit_location_type'] == LOC_PLANET) {
94
-      if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
93
+    } elseif ($captain['unit_location_type'] == LOC_PLANET) {
94
+      if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) {
95 95
         $errorlist .= $lang['module_unit_captain_error_captain_already_bound'];
96 96
       }
97 97
     } else {
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
   if ($errorlist) {
103 103
     sn_db_transaction_rollback();
104
-    messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
104
+    messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
105 105
   }
106 106
 
107 107
   // On verifie s'il y a assez de vaisseaux sur la planete !
108 108
   foreach ($fleetarray as $Ship => $Count) {
109 109
     if ($Count > mrc_get_level($user, $planetrow, $Ship)) {
110
-      messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
110
+      messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
111 111
     }
112 112
   }
113 113
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
   $fleet_group = max(0, intval($_POST['fleet_group']));
116 116
   //But is it acs??
117 117
   //Well all acs fleets must have a fleet code.
118
-  if($fleet_group) {
118
+  if ($fleet_group) {
119 119
     //Also it must be mission type 2
120 120
     $target_mission = MT_AKS;
121 121
 
122 122
     //The co-ords must be the same as where the acs fleet is going.
123 123
     $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}";
124
-    if($_POST['acs_target_mr'] == $target) {
124
+    if ($_POST['acs_target_mr'] == $target) {
125 125
       //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!)
126 126
       $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true);
127 127
       if (!$aks) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     }
138 138
   }
139 139
   //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet.
140
-  if(!$fleet_group && $target_mission == MT_AKS) {
140
+  if (!$fleet_group && $target_mission == MT_AKS) {
141 141
     $target_mission = MT_ATTACK;
142 142
   }
143 143
 
@@ -147,22 +147,21 @@  discard block
 block discarded – undo
147 147
   $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded);
148 148
   $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options);
149 149
 
150
-  if($cant_attack !== ATTACK_ALLOWED) {
150
+  if ($cant_attack !== ATTACK_ALLOWED) {
151 151
     messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99);
152 152
   }
153 153
 
154 154
   $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
155 155
   if (!in_array($speed_percent, $speed_possible)) {
156
-    messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
156
+    messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
157 157
   }
158 158
 
159 159
   $fleet['start_time'] = $duration + SN_TIME_NOW;
160 160
 
161
-  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) :
162
-    ($target_mission == MT_HOLD ? 12 : 0);
163
-  if($max_duration) {
161
+  $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0);
162
+  if ($max_duration) {
164 163
     $StayDuration = sys_get_param_id('missiontime');
165
-    if($StayDuration > $max_duration || $StayDuration < 1) {
164
+    if ($StayDuration > $max_duration || $StayDuration < 1) {
166 165
       $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true));
167 166
       die();
168 167
     }
@@ -172,11 +171,11 @@  discard block
 block discarded – undo
172 171
     $StayDuration = 0;
173 172
     $StayTime     = 0;
174 173
   }
175
-  $fleet['end_time']   = $StayDuration + (2 * $duration) + SN_TIME_NOW;
174
+  $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW;
176 175
 
177
-  if($aks && $target_mission == MT_AKS) {
178
-    if ($fleet['start_time']>$aks['ankunft']) {
179
-      messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']);
176
+  if ($aks && $target_mission == MT_AKS) {
177
+    if ($fleet['start_time'] > $aks['ankunft']) {
178
+      messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']);
180 179
     }
181 180
     $fleet['start_time'] = $aks['ankunft'];
182 181
     $fleet['end_time'] = $aks['ankunft'] + $duration;
@@ -186,21 +185,21 @@  discard block
 block discarded – undo
186 185
   $FleetShipCount      = 0;
187 186
   $db_changeset = array();
188 187
   foreach ($fleetarray as $Ship => $Count) {
189
-    $FleetStorage    += get_unit_param($Ship, P_CAPACITY) * $Count;
188
+    $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count;
190 189
     $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']);
191 190
   }
192 191
   $fleet_array = sys_unit_arr2str($fleetarray);
193
-  $FleetShipCount  += array_sum($fleetarray);
194
-  $FleetStorage        -= $consumption;
192
+  $FleetShipCount += array_sum($fleetarray);
193
+  $FleetStorage -= $consumption;
195 194
 
196
-  if ( $StorageNeeded > $FleetStorage) {
197
-    messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
195
+  if ($StorageNeeded > $FleetStorage) {
196
+    messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
198 197
   }
199 198
   if ($planetrow['deuterium'] < $TransDeuterium + $consumption) {
200
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . pretty_number($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
199
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . pretty_number($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
201 200
   }
202 201
   if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) {
203
-    messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
202
+    messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2);
204 203
   }
205 204
 
206 205
   $fleet_set = array(
@@ -242,7 +241,7 @@  discard block
 block discarded – undo
242 241
 //    ));
243 242
 //  }
244 243
 
245
-  if(is_array($captain)) {
244
+  if (is_array($captain)) {
246 245
     DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}");
247 246
   }
248 247
 
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
     'START_LEFT'         => floor($fleet['end_time'] + 1 - SN_TIME_NOW),
256 255
   );
257 256
 
258
-  if(!empty($TargetPlanet)) {
257
+  if (!empty($TargetPlanet)) {
259 258
     $template_route += array(
260 259
       'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']],
261 260
       'END_COORDS'       => uni_render_coordinates($TargetPlanet),
@@ -268,8 +267,8 @@  discard block
 block discarded – undo
268 267
   $template->assign_block_vars('fleets', $template_route);
269 268
 
270 269
   $sn_groups_fleet = sn_get_groups('fleet');
271
-  foreach($fleetarray as $ship_id => $ship_count) {
272
-    if(in_array($ship_id, $sn_groups_fleet) && $ship_count) {
270
+  foreach ($fleetarray as $ship_id => $ship_count) {
271
+    if (in_array($ship_id, $sn_groups_fleet) && $ship_count) {
273 272
 //      $ship_base_data = get_ship_data($ship_id, $user);
274 273
       $template->assign_block_vars('fleets.ships', array(
275 274
         'ID'          => $ship_id,
Please login to merge, or discard this patch.
includes/includes/market_info.inc 2 patches
Spacing   +12 added lines, -12 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)
3
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true)
4 4
 {
5 5
   $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
6 6
 }
@@ -15,50 +15,50 @@  discard block
 block discarded – undo
15 15
 ));
16 16
 
17 17
 $info_action = sys_get_param_int('action');
18
-if($info_action)
18
+if ($info_action)
19 19
 {
20 20
   try
21 21
   {
22 22
     sn_db_transaction_start();
23 23
 
24 24
     $user = db_user_by_id($user['id'], true);
25
-    if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info)
25
+    if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info)
26 26
     {
27 27
       throw new Exception(MARKET_NO_DM, ERR_ERROR);
28 28
     }
29 29
 
30
-    switch($info_action)
30
+    switch ($info_action)
31 31
     {
32 32
       case MARKET_INFO_PLAYER:
33 33
         $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name');
34
-        if(!$user_info_name_unsafe)
34
+        if (!$user_info_name_unsafe)
35 35
         {
36 36
           throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR);
37 37
         }
38 38
 
39
-        if(is_id($user_info_name_unsafe))
39
+        if (is_id($user_info_name_unsafe))
40 40
         {
41 41
           $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true);
42 42
         }
43
-        if(!is_array($user_info))
43
+        if (!is_array($user_info))
44 44
         {
45 45
           $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true);
46 46
         }
47
-        if(!is_array($user_info))
47
+        if (!is_array($user_info))
48 48
         {
49 49
           throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR);
50 50
         }
51
-        if($user_info['id'] == $user['id'])
51
+        if ($user_info['id'] == $user['id'])
52 52
         {
53 53
           throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
54 54
         }
55 55
 
56 56
         $msg_text = array();
57
-        foreach(sn_get_groups('mercenaries') as $mercenary_id)
57
+        foreach (sn_get_groups('mercenaries') as $mercenary_id)
58 58
         {
59 59
           $msg_text[] = "{$lang['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$lang['sys_level']} {$mercenary_level}" : $lang['eco_mrk_info_not_hired']);
60 60
         }
61
-        if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM))
61
+        if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM))
62 62
         {
63 63
           $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}";
64 64
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
       break;
73 73
     }
74 74
 
75
-    if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
75
+    if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}"))
76 76
     {
77 77
       // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR);
78 78
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 
80 80
     sn_db_transaction_commit();
81 81
     throw new Exception($info_action, ERR_NONE);
82
-  }
83
-  catch (Exception $e)
82
+  } catch (Exception $e)
84 83
   {
85 84
     sn_db_transaction_rollback();
86 85
 
Please login to merge, or discard this patch.
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_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.