@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | protected $_repository; |
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * @var ContainerPlus $_oldRepo |
34 | 34 | */ |
35 | 35 | protected $_oldRepo; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | |
87 | 87 | public function get($entityClass, $id) { |
88 | 88 | $entityIndex = get_class($entityClass) . '\\' . $id; |
89 | - if(!isset($this->_repository[$entityIndex])) { |
|
89 | + if (!isset($this->_repository[$entityIndex])) { |
|
90 | 90 | |
91 | 91 | } |
92 | 92 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | class SnBootstrap { |
12 | 12 | |
13 | 13 | public static function install_benchmark() { |
14 | - register_shutdown_function(function () { |
|
14 | + register_shutdown_function(function() { |
|
15 | 15 | if (defined('IN_AJAX')) { |
16 | 16 | return; |
17 | 17 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $config->pass()->game_disable = GAME_DISABLE_STAT; |
59 | 59 | |
60 | 60 | $statMinimalInterval = intval($config->pass()->stats_minimal_interval); |
61 | - $config->pass()->var_stat_update_end= date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
61 | + $config->pass()->var_stat_update_end = date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
62 | 62 | $config->pass()->var_stat_update_msg = 'Update started'; |
63 | 63 | sn_db_transaction_commit(); |
64 | 64 |
@@ -22,11 +22,11 @@ |
||
22 | 22 | |
23 | 23 | define('IN_AJAX', true); |
24 | 24 | |
25 | -if(($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) { |
|
25 | +if (($result = StatUpdateLauncher::scheduler_process()) && !defined('IN_ADMIN')) { |
|
26 | 26 | $result = htmlspecialchars($result, ENT_QUOTES, 'UTF-8'); |
27 | 27 | print(json_encode($result)); |
28 | 28 | } |
29 | 29 | |
30 | -if(!defined('IN_ADMIN')) { |
|
30 | +if (!defined('IN_ADMIN')) { |
|
31 | 31 | die(); |
32 | 32 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
40 | 40 | |
41 | 41 | $target_mission = sys_get_param_int('target_mission'); |
42 | -if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
42 | +if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
43 | 43 | $planet_type = PT_PLANET; |
44 | -} elseif($target_mission == MT_RECYCLE) { |
|
44 | +} elseif ($target_mission == MT_RECYCLE) { |
|
45 | 45 | $planet_type = PT_DEBRIS; |
46 | -} elseif($target_mission == MT_DESTROY) { |
|
46 | +} elseif ($target_mission == MT_DESTROY) { |
|
47 | 47 | $planet_type = PT_MOON; |
48 | 48 | } else { |
49 | 49 | $planet_type = sys_get_param_int('planet_type'); |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true); |
60 | 60 | //$FlyingFleets = $FlyingFleets['Number']; |
61 | 61 | $FlyingFleets = fleet_count_flying($user['id']); |
62 | -if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
62 | +if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
63 | 63 | messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5); |
64 | 64 | } |
65 | 65 | |
66 | 66 | $MaxExpeditions = get_player_max_expeditons($user); |
67 | -if($MaxExpeditions) { |
|
67 | +if ($MaxExpeditions) { |
|
68 | 68 | // $FlyingExpeditions = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true); |
69 | 69 | // $FlyingExpeditions = $FlyingExpeditions['expedi']; |
70 | - $FlyingExpeditions = fleet_count_flying($user['id'], MT_EXPLORE); |
|
70 | + $FlyingExpeditions = fleet_count_flying($user['id'], MT_EXPLORE); |
|
71 | 71 | } else { |
72 | 72 | $FlyingExpeditions = 0; |
73 | 73 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
81 | 81 | $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
82 | 82 | |
83 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
84 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
83 | + foreach ($fleetarray as $ship_id => &$ship_amount) { |
|
84 | + if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
85 | 85 | $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
86 | 86 | die(); |
87 | 87 | } |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $target_mission = MT_COLONIZE; |
113 | 113 | $planet_type = PT_PLANET; |
114 | 114 | } else { |
115 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
115 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']); |
|
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | $recyclers = 0; |
119 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
119 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
120 | 120 | $recyclers += $fleetarray[$recycler_id]; |
121 | 121 | } |
122 | 122 | if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
143 | 143 | |
144 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
144 | + if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
145 | 145 | $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
146 | 146 | } |
147 | 147 | } |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | ); |
202 | 202 | |
203 | 203 | $is_transport_missions = false; |
204 | -if($missiontype) { |
|
204 | +if ($missiontype) { |
|
205 | 205 | $sn_group_missions = sn_get_groups('missions'); |
206 | - foreach($missiontype as $mission_data_id => $mission_data) { |
|
206 | + foreach ($missiontype as $mission_data_id => $mission_data) { |
|
207 | 207 | $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']); |
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
211 | -switch($fleet_page) { |
|
211 | +switch ($fleet_page) { |
|
212 | 212 | case 1: |
213 | 213 | require('includes/includes/flt_page1.inc'); |
214 | 214 | break; |
@@ -77,121 +77,121 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | switch ($fleet_page) { |
80 | - case 3: |
|
80 | + case 3: |
|
81 | 81 | |
82 | - case 2: |
|
83 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
84 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
85 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
82 | + case 2: |
|
83 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
84 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
85 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
86 | 86 | |
87 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
88 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
89 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
90 | - die(); |
|
91 | - } |
|
92 | - $ship_amount = floatval($ship_amount); |
|
93 | - } |
|
94 | - |
|
95 | - $UsedPlanet = false; |
|
96 | - $YourPlanet = false; |
|
97 | - $missiontype = array(); |
|
98 | - if ($planet > SN::$config->game_maxPlanet) { |
|
99 | - $target_mission = MT_EXPLORE; |
|
100 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
101 | - } elseif ($galaxy && $system && $planet) { |
|
102 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
103 | - |
|
104 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
105 | - |
|
106 | - if ($TargetPlanet['id_owner']) { |
|
107 | - $UsedPlanet = true; |
|
108 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
109 | - $YourPlanet = true; |
|
87 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
88 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
89 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
90 | + die(); |
|
110 | 91 | } |
92 | + $ship_amount = floatval($ship_amount); |
|
111 | 93 | } |
112 | 94 | |
113 | - if (!$UsedPlanet) { |
|
114 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
115 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
116 | - $target_mission = MT_COLONIZE; |
|
117 | - $planet_type = PT_PLANET; |
|
118 | - } else { |
|
119 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
120 | - } |
|
121 | - } else { |
|
122 | - $recyclers = 0; |
|
123 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
124 | - $recyclers += $fleetarray[$recycler_id]; |
|
95 | + $UsedPlanet = false; |
|
96 | + $YourPlanet = false; |
|
97 | + $missiontype = array(); |
|
98 | + if ($planet > SN::$config->game_maxPlanet) { |
|
99 | + $target_mission = MT_EXPLORE; |
|
100 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
101 | + } elseif ($galaxy && $system && $planet) { |
|
102 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
103 | + |
|
104 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
105 | + |
|
106 | + if ($TargetPlanet['id_owner']) { |
|
107 | + $UsedPlanet = true; |
|
108 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
109 | + $YourPlanet = true; |
|
110 | + } |
|
125 | 111 | } |
126 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
127 | - $target_mission = MT_RECYCLE; |
|
128 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
129 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
130 | - if ($YourPlanet) { |
|
131 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
132 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
112 | + |
|
113 | + if (!$UsedPlanet) { |
|
114 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
115 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
116 | + $target_mission = MT_COLONIZE; |
|
117 | + $planet_type = PT_PLANET; |
|
133 | 118 | } else { |
134 | - // Not Your Planet |
|
135 | - if ($fleetarray[SHIP_SPY]) { |
|
136 | - // Only spy missions if any spy |
|
137 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
119 | + messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
120 | + } |
|
121 | + } else { |
|
122 | + $recyclers = 0; |
|
123 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
124 | + $recyclers += $fleetarray[$recycler_id]; |
|
125 | + } |
|
126 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
127 | + $target_mission = MT_RECYCLE; |
|
128 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
129 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
130 | + if ($YourPlanet) { |
|
131 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
132 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
138 | 133 | } else { |
139 | - // If no spies... |
|
140 | - if ($fleet_group_mr) { |
|
141 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
134 | + // Not Your Planet |
|
135 | + if ($fleetarray[SHIP_SPY]) { |
|
136 | + // Only spy missions if any spy |
|
137 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
142 | 138 | } else { |
143 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
144 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
145 | - |
|
146 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
147 | - |
|
148 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
149 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
139 | + // If no spies... |
|
140 | + if ($fleet_group_mr) { |
|
141 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
142 | + } else { |
|
143 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
144 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
145 | + |
|
146 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
147 | + |
|
148 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
149 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
150 | + } |
|
150 | 151 | } |
151 | 152 | } |
152 | 153 | } |
153 | 154 | } |
154 | 155 | } |
155 | 156 | } |
156 | - } |
|
157 | - |
|
158 | - if (!$target_mission && is_array($missiontype)) { |
|
159 | - $target_mission = MT_ATTACK; |
|
160 | - } |
|
161 | - |
|
162 | -// $sn_group_missions = sn_get_groups('missions'); |
|
163 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
164 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
165 | -// } |
|
166 | -// |
|
167 | -// |
|
168 | - ksort($missiontype); |
|
169 | - |
|
170 | - $speed_percent = sys_get_param_int('speed', 10); |
|
171 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
172 | - |
|
173 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
174 | - $fleet_speed = $travel_data['fleet_speed']; |
|
175 | - $distance = $travel_data['distance']; |
|
176 | - $duration = $travel_data['duration']; |
|
177 | - $consumption = $travel_data['consumption']; |
|
178 | - // No Break |
|
179 | - |
|
180 | - case 1: |
|
181 | - if ($galaxy && $system && $planet) { |
|
182 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
183 | - |
|
184 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
185 | - } |
|
186 | - |
|
187 | - case 0: |
|
188 | - $template_result += array( |
|
189 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
190 | - 'thissystem' => $planetrow['system'], |
|
191 | - 'thisplanet' => $planetrow['planet'], |
|
192 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
193 | - ); |
|
194 | - // no break |
|
157 | + |
|
158 | + if (!$target_mission && is_array($missiontype)) { |
|
159 | + $target_mission = MT_ATTACK; |
|
160 | + } |
|
161 | + |
|
162 | + // $sn_group_missions = sn_get_groups('missions'); |
|
163 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
164 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
165 | + // } |
|
166 | + // |
|
167 | + // |
|
168 | + ksort($missiontype); |
|
169 | + |
|
170 | + $speed_percent = sys_get_param_int('speed', 10); |
|
171 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
172 | + |
|
173 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
174 | + $fleet_speed = $travel_data['fleet_speed']; |
|
175 | + $distance = $travel_data['distance']; |
|
176 | + $duration = $travel_data['duration']; |
|
177 | + $consumption = $travel_data['consumption']; |
|
178 | + // No Break |
|
179 | + |
|
180 | + case 1: |
|
181 | + if ($galaxy && $system && $planet) { |
|
182 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
183 | + |
|
184 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
185 | + } |
|
186 | + |
|
187 | + case 0: |
|
188 | + $template_result += array( |
|
189 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
190 | + 'thissystem' => $planetrow['system'], |
|
191 | + 'thisplanet' => $planetrow['planet'], |
|
192 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
193 | + ); |
|
194 | + // no break |
|
195 | 195 | |
196 | 196 | } |
197 | 197 | |
@@ -213,35 +213,35 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | switch($fleet_page) { |
216 | - case 1: |
|
217 | - require('includes/includes/flt_page1.inc'); |
|
218 | - break; |
|
219 | - |
|
220 | - case 2: |
|
221 | - require_once('includes/includes/flt_page2.inc'); |
|
222 | - sn_fleet_page2(); |
|
223 | - break; |
|
224 | - |
|
225 | - case 3: |
|
226 | - require_once('includes/includes/flt_page3.inc'); |
|
227 | - sn_fleet_page3(); |
|
228 | - break; |
|
229 | - |
|
230 | - case 4: |
|
231 | - require('includes/includes/flt_page4.inc'); |
|
232 | - break; |
|
233 | - |
|
234 | - case 5: |
|
235 | - $template = gettemplate('fleet5', true); |
|
236 | - $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
237 | - $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
238 | - // Building list of own planets & moons |
|
239 | - $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
240 | - break; |
|
241 | - |
|
242 | - default: |
|
243 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
244 | - |
|
245 | - require('includes/includes/flt_page0.inc'); |
|
246 | - break; |
|
216 | + case 1: |
|
217 | + require('includes/includes/flt_page1.inc'); |
|
218 | + break; |
|
219 | + |
|
220 | + case 2: |
|
221 | + require_once('includes/includes/flt_page2.inc'); |
|
222 | + sn_fleet_page2(); |
|
223 | + break; |
|
224 | + |
|
225 | + case 3: |
|
226 | + require_once('includes/includes/flt_page3.inc'); |
|
227 | + sn_fleet_page3(); |
|
228 | + break; |
|
229 | + |
|
230 | + case 4: |
|
231 | + require('includes/includes/flt_page4.inc'); |
|
232 | + break; |
|
233 | + |
|
234 | + case 5: |
|
235 | + $template = gettemplate('fleet5', true); |
|
236 | + $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
237 | + $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
238 | + // Building list of own planets & moons |
|
239 | + $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
240 | + break; |
|
241 | + |
|
242 | + default: |
|
243 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
244 | + |
|
245 | + require('includes/includes/flt_page0.inc'); |
|
246 | + break; |
|
247 | 247 | } |
@@ -75,11 +75,11 @@ |
||
75 | 75 | * @return float[] - [int resourceId] -> [float ratesNormalizedToResourceCost] |
76 | 76 | */ |
77 | 77 | public function getResourceExchangeIn($resourceId) { |
78 | - if(empty($this->resourceExchangeRates[$resourceId])) { |
|
78 | + if (empty($this->resourceExchangeRates[$resourceId])) { |
|
79 | 79 | $defaultRates = $this->getResourcesExchange(); |
80 | 80 | |
81 | 81 | $this->resourceExchangeRates[$resourceId] = []; |
82 | - foreach($defaultRates as $defaultResourceId => $defaultRate) { |
|
82 | + foreach ($defaultRates as $defaultResourceId => $defaultRate) { |
|
83 | 83 | $this->resourceExchangeRates[$resourceId][$defaultResourceId] = $defaultRate / $defaultRates[$resourceId]; |
84 | 84 | } |
85 | 85 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
|
3 | +function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); } |
|
4 | 4 | function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
5 | 5 | { |
6 | 6 | global $lang; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | return $mode; |
20 | 20 | } |
21 | 21 | |
22 | -function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
|
22 | +function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); } |
|
23 | 23 | /** |
24 | 24 | * @param template $template |
25 | 25 | * @param $edit_planet_row |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | global $lang; |
31 | 31 | |
32 | 32 | $unit_list = sn_get_groups($mode); |
33 | - if(empty($unit_list)) |
|
33 | + if (empty($unit_list)) |
|
34 | 34 | { |
35 | 35 | return; |
36 | 36 | } |
37 | 37 | $name_list = $lang['tech']; |
38 | 38 | |
39 | - foreach($unit_list as $unit_id) |
|
39 | + foreach ($unit_list as $unit_id) |
|
40 | 40 | { |
41 | 41 | $template->assign_block_vars('unit', array( |
42 | 42 | 'ID' => $unit_id, |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | -function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
|
50 | +function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); } |
|
51 | 51 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
52 | 52 | { |
53 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
53 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
54 | 54 | { |
55 | 55 | $unit_amount = round($unit_amount); |
56 | 56 | $unit_name = get_unit_param($unit_id, P_NAME); |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
5 | -{ |
|
4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
6 | 5 | global $lang; |
7 | 6 | |
8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * @param $edit_planet_row |
26 | 25 | * @param $mode |
27 | 26 | */ |
28 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
29 | -{ |
|
27 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
30 | 28 | global $lang; |
31 | 29 | |
32 | 30 | $unit_list = sn_get_groups($mode); |
@@ -48,15 +46,13 @@ discard block |
||
48 | 46 | } |
49 | 47 | |
50 | 48 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
51 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
52 | -{ |
|
49 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
53 | 50 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
54 | 51 | { |
55 | 52 | $unit_amount = round($unit_amount); |
56 | 53 | $unit_name = get_unit_param($unit_id, P_NAME); |
57 | 54 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $result = ''; |
62 | 58 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $this->Field = isset($mySqlDescription['Field']) ? $mySqlDescription['Field'] : null; |
30 | 30 | $this->Type = isset($mySqlDescription['Type']) ? $mySqlDescription['Type'] : null; |
31 | 31 | $this->Collation = isset($mySqlDescription['Collation']) ? $mySqlDescription['Collation'] : null; |
32 | - $this->Null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null; |
|
32 | + $this->null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null; |
|
33 | 33 | $this->Key = isset($mySqlDescription['Key']) ? $mySqlDescription['Key'] : null; |
34 | 34 | $this->Default = isset($mySqlDescription['Default']) ? $mySqlDescription['Default'] : null; |
35 | 35 | $this->Extra = isset($mySqlDescription['Extra']) ? $mySqlDescription['Extra'] : null; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | public function unset_by_prefix($prefix_unset = '') { |
152 | 152 | static $array_clear; |
153 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
153 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
154 | 154 | strpos($k, $p) === 0 ? $v = null : false; |
155 | 155 | } : false; |
156 | 156 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | if ($this->$name[0] === null) { |
206 | 206 | for ($i = count($name) - 1; $i > 0; $i--) { |
207 | 207 | $cName = "{$name[$i]}_COUNT"; |
208 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
208 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
209 | 209 | if ($this->$cName1 == null || $i == 1) { |
210 | 210 | $this->$cName++; |
211 | 211 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $count = count($name); |
252 | 252 | for ($i = 1; $i < $count; $i++) { |
253 | 253 | $cName = "{$name[$i]}_COUNT"; |
254 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
254 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
255 | 255 | |
256 | 256 | if ($i == 1 || $this->$cName1 === null) { |
257 | 257 | $this->$cName--; |