@@ -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; |
@@ -75,121 +75,121 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | switch ($fleet_page) { |
78 | - case 3: |
|
78 | + case 3: |
|
79 | 79 | |
80 | - case 2: |
|
81 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
82 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
83 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
80 | + case 2: |
|
81 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
82 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
83 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
84 | 84 | |
85 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
86 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
87 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
88 | - die(); |
|
89 | - } |
|
90 | - $ship_amount = floatval($ship_amount); |
|
91 | - } |
|
92 | - |
|
93 | - $UsedPlanet = false; |
|
94 | - $YourPlanet = false; |
|
95 | - $missiontype = array(); |
|
96 | - if ($planet > SN::$config->game_maxPlanet) { |
|
97 | - $target_mission = MT_EXPLORE; |
|
98 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
99 | - } elseif ($galaxy && $system && $planet) { |
|
100 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
101 | - |
|
102 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
103 | - |
|
104 | - if ($TargetPlanet['id_owner']) { |
|
105 | - $UsedPlanet = true; |
|
106 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
107 | - $YourPlanet = true; |
|
85 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
86 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
87 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
88 | + die(); |
|
108 | 89 | } |
90 | + $ship_amount = floatval($ship_amount); |
|
109 | 91 | } |
110 | 92 | |
111 | - if (!$UsedPlanet) { |
|
112 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
113 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
114 | - $target_mission = MT_COLONIZE; |
|
115 | - $planet_type = PT_PLANET; |
|
116 | - } else { |
|
117 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
118 | - } |
|
119 | - } else { |
|
120 | - $recyclers = 0; |
|
121 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
122 | - $recyclers += $fleetarray[$recycler_id]; |
|
93 | + $UsedPlanet = false; |
|
94 | + $YourPlanet = false; |
|
95 | + $missiontype = array(); |
|
96 | + if ($planet > SN::$config->game_maxPlanet) { |
|
97 | + $target_mission = MT_EXPLORE; |
|
98 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
99 | + } elseif ($galaxy && $system && $planet) { |
|
100 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
101 | + |
|
102 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
103 | + |
|
104 | + if ($TargetPlanet['id_owner']) { |
|
105 | + $UsedPlanet = true; |
|
106 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
107 | + $YourPlanet = true; |
|
108 | + } |
|
123 | 109 | } |
124 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
125 | - $target_mission = MT_RECYCLE; |
|
126 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
127 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
128 | - if ($YourPlanet) { |
|
129 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
130 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
110 | + |
|
111 | + if (!$UsedPlanet) { |
|
112 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
113 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
114 | + $target_mission = MT_COLONIZE; |
|
115 | + $planet_type = PT_PLANET; |
|
131 | 116 | } else { |
132 | - // Not Your Planet |
|
133 | - if ($fleetarray[SHIP_SPY]) { |
|
134 | - // Only spy missions if any spy |
|
135 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
117 | + messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
118 | + } |
|
119 | + } else { |
|
120 | + $recyclers = 0; |
|
121 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
122 | + $recyclers += $fleetarray[$recycler_id]; |
|
123 | + } |
|
124 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
125 | + $target_mission = MT_RECYCLE; |
|
126 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
127 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
128 | + if ($YourPlanet) { |
|
129 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
130 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
136 | 131 | } else { |
137 | - // If no spies... |
|
138 | - if ($fleet_group_mr) { |
|
139 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
132 | + // Not Your Planet |
|
133 | + if ($fleetarray[SHIP_SPY]) { |
|
134 | + // Only spy missions if any spy |
|
135 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
140 | 136 | } else { |
141 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
142 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
143 | - |
|
144 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
145 | - |
|
146 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
147 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
137 | + // If no spies... |
|
138 | + if ($fleet_group_mr) { |
|
139 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
140 | + } else { |
|
141 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
142 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
143 | + |
|
144 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
145 | + |
|
146 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
147 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
148 | + } |
|
148 | 149 | } |
149 | 150 | } |
150 | 151 | } |
151 | 152 | } |
152 | 153 | } |
153 | 154 | } |
154 | - } |
|
155 | - |
|
156 | - if (!$target_mission && is_array($missiontype)) { |
|
157 | - $target_mission = MT_ATTACK; |
|
158 | - } |
|
159 | - |
|
160 | -// $sn_group_missions = sn_get_groups('missions'); |
|
161 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
162 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
163 | -// } |
|
164 | -// |
|
165 | -// |
|
166 | - ksort($missiontype); |
|
167 | - |
|
168 | - $speed_percent = sys_get_param_int('speed', 10); |
|
169 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
170 | - |
|
171 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
172 | - $fleet_speed = $travel_data['fleet_speed']; |
|
173 | - $distance = $travel_data['distance']; |
|
174 | - $duration = $travel_data['duration']; |
|
175 | - $consumption = $travel_data['consumption']; |
|
176 | - // No Break |
|
177 | - |
|
178 | - case 1: |
|
179 | - if ($galaxy && $system && $planet) { |
|
180 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
181 | - |
|
182 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
183 | - } |
|
184 | - |
|
185 | - case 0: |
|
186 | - $template_result += array( |
|
187 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
188 | - 'thissystem' => $planetrow['system'], |
|
189 | - 'thisplanet' => $planetrow['planet'], |
|
190 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
191 | - ); |
|
192 | - // no break |
|
155 | + |
|
156 | + if (!$target_mission && is_array($missiontype)) { |
|
157 | + $target_mission = MT_ATTACK; |
|
158 | + } |
|
159 | + |
|
160 | + // $sn_group_missions = sn_get_groups('missions'); |
|
161 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
162 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
163 | + // } |
|
164 | + // |
|
165 | + // |
|
166 | + ksort($missiontype); |
|
167 | + |
|
168 | + $speed_percent = sys_get_param_int('speed', 10); |
|
169 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
170 | + |
|
171 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
172 | + $fleet_speed = $travel_data['fleet_speed']; |
|
173 | + $distance = $travel_data['distance']; |
|
174 | + $duration = $travel_data['duration']; |
|
175 | + $consumption = $travel_data['consumption']; |
|
176 | + // No Break |
|
177 | + |
|
178 | + case 1: |
|
179 | + if ($galaxy && $system && $planet) { |
|
180 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
181 | + |
|
182 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
183 | + } |
|
184 | + |
|
185 | + case 0: |
|
186 | + $template_result += array( |
|
187 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
188 | + 'thissystem' => $planetrow['system'], |
|
189 | + 'thisplanet' => $planetrow['planet'], |
|
190 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
191 | + ); |
|
192 | + // no break |
|
193 | 193 | |
194 | 194 | } |
195 | 195 | |
@@ -211,35 +211,35 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | switch($fleet_page) { |
214 | - case 1: |
|
215 | - require('includes/includes/flt_page1.inc'); |
|
216 | - break; |
|
217 | - |
|
218 | - case 2: |
|
219 | - require_once('includes/includes/flt_page2.inc'); |
|
220 | - sn_fleet_page2(); |
|
221 | - break; |
|
222 | - |
|
223 | - case 3: |
|
224 | - require_once('includes/includes/flt_page3.inc'); |
|
225 | - sn_fleet_page3(); |
|
226 | - break; |
|
227 | - |
|
228 | - case 4: |
|
229 | - require('includes/includes/flt_page4.inc'); |
|
230 | - break; |
|
231 | - |
|
232 | - case 5: |
|
233 | - $template = gettemplate('fleet5', true); |
|
234 | - $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering(); |
|
235 | - $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
236 | - // Building list of own planets & moons |
|
237 | - $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
238 | - break; |
|
239 | - |
|
240 | - default: |
|
241 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
242 | - |
|
243 | - require('includes/includes/flt_page0.inc'); |
|
244 | - break; |
|
214 | + case 1: |
|
215 | + require('includes/includes/flt_page1.inc'); |
|
216 | + break; |
|
217 | + |
|
218 | + case 2: |
|
219 | + require_once('includes/includes/flt_page2.inc'); |
|
220 | + sn_fleet_page2(); |
|
221 | + break; |
|
222 | + |
|
223 | + case 3: |
|
224 | + require_once('includes/includes/flt_page3.inc'); |
|
225 | + sn_fleet_page3(); |
|
226 | + break; |
|
227 | + |
|
228 | + case 4: |
|
229 | + require('includes/includes/flt_page4.inc'); |
|
230 | + break; |
|
231 | + |
|
232 | + case 5: |
|
233 | + $template = gettemplate('fleet5', true); |
|
234 | + $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering(); |
|
235 | + $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
236 | + // Building list of own planets & moons |
|
237 | + $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
238 | + break; |
|
239 | + |
|
240 | + default: |
|
241 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
242 | + |
|
243 | + require('includes/includes/flt_page0.inc'); |
|
244 | + break; |
|
245 | 245 | } |
@@ -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 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | if (!defined('IN_PHPBB')) |
18 | 18 | { |
19 | - exit; |
|
19 | + exit; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,227 +24,227 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class phpbb_hook |
26 | 26 | { |
27 | - /** |
|
28 | - * Registered hooks |
|
29 | - */ |
|
30 | - var $hooks = array(); |
|
31 | - |
|
32 | - /** |
|
33 | - * Results returned by functions called |
|
34 | - */ |
|
35 | - var $hook_result = array(); |
|
36 | - |
|
37 | - /** |
|
38 | - * internal pointer |
|
39 | - */ |
|
40 | - var $current_hook = NULL; |
|
41 | - |
|
42 | - /** |
|
43 | - * Initialize hook class. |
|
44 | - * |
|
45 | - * @param array $valid_hooks array containing the hookable functions/methods |
|
46 | - */ |
|
47 | - function phpbb_hook($valid_hooks) |
|
48 | - { |
|
49 | - foreach ($valid_hooks as $_null => $method) |
|
50 | - { |
|
51 | - $this->add_hook($method); |
|
52 | - } |
|
53 | - |
|
54 | - if (function_exists('phpbb_hook_register')) |
|
55 | - { |
|
56 | - phpbb_hook_register($this); |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Register function/method to be called within hook |
|
62 | - * This function is normally called by the modification/application to attach/register the functions. |
|
63 | - * |
|
64 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
65 | - * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
66 | - * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
67 | - */ |
|
68 | - function register($definition, $hook, $mode = 'normal') |
|
69 | - { |
|
70 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
71 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
72 | - |
|
73 | - // Method able to be hooked? |
|
74 | - if (isset($this->hooks[$class][$function])) |
|
75 | - { |
|
76 | - switch ($mode) |
|
77 | - { |
|
78 | - case 'standalone': |
|
79 | - if (!isset($this->hooks[$class][$function]['standalone'])) |
|
80 | - { |
|
81 | - $this->hooks[$class][$function] = array('standalone' => $hook); |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
86 | - } |
|
87 | - break; |
|
88 | - |
|
89 | - case 'first': |
|
90 | - case 'last': |
|
91 | - $this->hooks[$class][$function][$mode][] = $hook; |
|
92 | - break; |
|
93 | - |
|
94 | - case 'normal': |
|
95 | - default: |
|
96 | - $this->hooks[$class][$function]['normal'][] = $hook; |
|
97 | - break; |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Calling all functions/methods attached to a specified hook. |
|
104 | - * Called by the function allowing hooks... |
|
105 | - * |
|
106 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
107 | - * @return bool False if no hook got executed, true otherwise |
|
108 | - */ |
|
109 | - function call_hook($definition) |
|
110 | - { |
|
111 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
112 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
113 | - |
|
114 | - if (!empty($this->hooks[$class][$function])) |
|
115 | - { |
|
116 | - // Developer tries to call a hooked function within the hooked function... |
|
117 | - if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
118 | - { |
|
119 | - return false; |
|
120 | - } |
|
121 | - |
|
122 | - // Call the hook with the arguments attached and store result |
|
123 | - $arguments = func_get_args(); |
|
124 | - $this->current_hook = array('class' => $class, 'function' => $function); |
|
125 | - $arguments[0] = &$this; |
|
126 | - |
|
127 | - // Call the hook chain... |
|
128 | - if (isset($this->hooks[$class][$function]['standalone'])) |
|
129 | - { |
|
130 | - $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
131 | - } |
|
132 | - else |
|
133 | - { |
|
134 | - foreach (array('first', 'normal', 'last') as $mode) |
|
135 | - { |
|
136 | - if (!isset($this->hooks[$class][$function][$mode])) |
|
137 | - { |
|
138 | - continue; |
|
139 | - } |
|
140 | - |
|
141 | - foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
142 | - { |
|
143 | - $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - $this->current_hook = NULL; |
|
149 | - return true; |
|
150 | - } |
|
151 | - |
|
152 | - $this->current_hook = NULL; |
|
153 | - return false; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Get result from previously called functions/methods for the same hook |
|
158 | - * |
|
159 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
160 | - * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
161 | - */ |
|
162 | - function previous_hook_result($definition) |
|
163 | - { |
|
164 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
165 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
166 | - |
|
167 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
168 | - { |
|
169 | - return array('result' => $this->hook_result[$class][$function]); |
|
170 | - } |
|
171 | - |
|
172 | - return false; |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Check if the called functions/methods returned something. |
|
177 | - * |
|
178 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
179 | - * @return bool True if results are there, false if not |
|
180 | - */ |
|
181 | - function hook_return($definition) |
|
182 | - { |
|
183 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
184 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
185 | - |
|
186 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
187 | - { |
|
188 | - return true; |
|
189 | - } |
|
190 | - |
|
191 | - return false; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Give actual result from called functions/methods back. |
|
196 | - * |
|
197 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
198 | - * @return mixed The result |
|
199 | - */ |
|
200 | - function hook_return_result($definition) |
|
201 | - { |
|
202 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
203 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
204 | - |
|
205 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
206 | - { |
|
207 | - $result = $this->hook_result[$class][$function]; |
|
208 | - unset($this->hook_result[$class][$function]); |
|
209 | - return $result; |
|
210 | - } |
|
211 | - |
|
212 | - return; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Add new function to the allowed hooks. |
|
217 | - * |
|
218 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
219 | - */ |
|
220 | - function add_hook($definition) |
|
221 | - { |
|
222 | - if (!is_array($definition)) |
|
223 | - { |
|
224 | - $definition = array('__global', $definition); |
|
225 | - } |
|
226 | - |
|
227 | - $this->hooks[$definition[0]][$definition[1]] = array(); |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Remove function from the allowed hooks. |
|
232 | - * |
|
233 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
234 | - */ |
|
235 | - function remove_hook($definition) |
|
236 | - { |
|
237 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
238 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
239 | - |
|
240 | - if (isset($this->hooks[$class][$function])) |
|
241 | - { |
|
242 | - unset($this->hooks[$class][$function]); |
|
243 | - |
|
244 | - if (isset($this->hook_result[$class][$function])) |
|
245 | - { |
|
246 | - unset($this->hook_result[$class][$function]); |
|
247 | - } |
|
248 | - } |
|
249 | - } |
|
27 | + /** |
|
28 | + * Registered hooks |
|
29 | + */ |
|
30 | + var $hooks = array(); |
|
31 | + |
|
32 | + /** |
|
33 | + * Results returned by functions called |
|
34 | + */ |
|
35 | + var $hook_result = array(); |
|
36 | + |
|
37 | + /** |
|
38 | + * internal pointer |
|
39 | + */ |
|
40 | + var $current_hook = NULL; |
|
41 | + |
|
42 | + /** |
|
43 | + * Initialize hook class. |
|
44 | + * |
|
45 | + * @param array $valid_hooks array containing the hookable functions/methods |
|
46 | + */ |
|
47 | + function phpbb_hook($valid_hooks) |
|
48 | + { |
|
49 | + foreach ($valid_hooks as $_null => $method) |
|
50 | + { |
|
51 | + $this->add_hook($method); |
|
52 | + } |
|
53 | + |
|
54 | + if (function_exists('phpbb_hook_register')) |
|
55 | + { |
|
56 | + phpbb_hook_register($this); |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Register function/method to be called within hook |
|
62 | + * This function is normally called by the modification/application to attach/register the functions. |
|
63 | + * |
|
64 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
65 | + * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
66 | + * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
67 | + */ |
|
68 | + function register($definition, $hook, $mode = 'normal') |
|
69 | + { |
|
70 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
71 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
72 | + |
|
73 | + // Method able to be hooked? |
|
74 | + if (isset($this->hooks[$class][$function])) |
|
75 | + { |
|
76 | + switch ($mode) |
|
77 | + { |
|
78 | + case 'standalone': |
|
79 | + if (!isset($this->hooks[$class][$function]['standalone'])) |
|
80 | + { |
|
81 | + $this->hooks[$class][$function] = array('standalone' => $hook); |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
86 | + } |
|
87 | + break; |
|
88 | + |
|
89 | + case 'first': |
|
90 | + case 'last': |
|
91 | + $this->hooks[$class][$function][$mode][] = $hook; |
|
92 | + break; |
|
93 | + |
|
94 | + case 'normal': |
|
95 | + default: |
|
96 | + $this->hooks[$class][$function]['normal'][] = $hook; |
|
97 | + break; |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Calling all functions/methods attached to a specified hook. |
|
104 | + * Called by the function allowing hooks... |
|
105 | + * |
|
106 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
107 | + * @return bool False if no hook got executed, true otherwise |
|
108 | + */ |
|
109 | + function call_hook($definition) |
|
110 | + { |
|
111 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
112 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
113 | + |
|
114 | + if (!empty($this->hooks[$class][$function])) |
|
115 | + { |
|
116 | + // Developer tries to call a hooked function within the hooked function... |
|
117 | + if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
118 | + { |
|
119 | + return false; |
|
120 | + } |
|
121 | + |
|
122 | + // Call the hook with the arguments attached and store result |
|
123 | + $arguments = func_get_args(); |
|
124 | + $this->current_hook = array('class' => $class, 'function' => $function); |
|
125 | + $arguments[0] = &$this; |
|
126 | + |
|
127 | + // Call the hook chain... |
|
128 | + if (isset($this->hooks[$class][$function]['standalone'])) |
|
129 | + { |
|
130 | + $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
131 | + } |
|
132 | + else |
|
133 | + { |
|
134 | + foreach (array('first', 'normal', 'last') as $mode) |
|
135 | + { |
|
136 | + if (!isset($this->hooks[$class][$function][$mode])) |
|
137 | + { |
|
138 | + continue; |
|
139 | + } |
|
140 | + |
|
141 | + foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
142 | + { |
|
143 | + $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + $this->current_hook = NULL; |
|
149 | + return true; |
|
150 | + } |
|
151 | + |
|
152 | + $this->current_hook = NULL; |
|
153 | + return false; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Get result from previously called functions/methods for the same hook |
|
158 | + * |
|
159 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
160 | + * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
161 | + */ |
|
162 | + function previous_hook_result($definition) |
|
163 | + { |
|
164 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
165 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
166 | + |
|
167 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
168 | + { |
|
169 | + return array('result' => $this->hook_result[$class][$function]); |
|
170 | + } |
|
171 | + |
|
172 | + return false; |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Check if the called functions/methods returned something. |
|
177 | + * |
|
178 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
179 | + * @return bool True if results are there, false if not |
|
180 | + */ |
|
181 | + function hook_return($definition) |
|
182 | + { |
|
183 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
184 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
185 | + |
|
186 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
187 | + { |
|
188 | + return true; |
|
189 | + } |
|
190 | + |
|
191 | + return false; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Give actual result from called functions/methods back. |
|
196 | + * |
|
197 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
198 | + * @return mixed The result |
|
199 | + */ |
|
200 | + function hook_return_result($definition) |
|
201 | + { |
|
202 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
203 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
204 | + |
|
205 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
206 | + { |
|
207 | + $result = $this->hook_result[$class][$function]; |
|
208 | + unset($this->hook_result[$class][$function]); |
|
209 | + return $result; |
|
210 | + } |
|
211 | + |
|
212 | + return; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Add new function to the allowed hooks. |
|
217 | + * |
|
218 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
219 | + */ |
|
220 | + function add_hook($definition) |
|
221 | + { |
|
222 | + if (!is_array($definition)) |
|
223 | + { |
|
224 | + $definition = array('__global', $definition); |
|
225 | + } |
|
226 | + |
|
227 | + $this->hooks[$definition[0]][$definition[1]] = array(); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Remove function from the allowed hooks. |
|
232 | + * |
|
233 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
234 | + */ |
|
235 | + function remove_hook($definition) |
|
236 | + { |
|
237 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
238 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
239 | + |
|
240 | + if (isset($this->hooks[$class][$function])) |
|
241 | + { |
|
242 | + unset($this->hooks[$class][$function]); |
|
243 | + |
|
244 | + if (isset($this->hook_result[$class][$function])) |
|
245 | + { |
|
246 | + unset($this->hook_result[$class][$function]); |
|
247 | + } |
|
248 | + } |
|
249 | + } |
|
250 | 250 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * phpBB Hook Class |
24 | 24 | */ |
25 | -class phpbb_hook |
|
26 | -{ |
|
25 | +class phpbb_hook { |
|
27 | 26 | /** |
28 | 27 | * Registered hooks |
29 | 28 | */ |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @param array $valid_hooks array containing the hookable functions/methods |
46 | 45 | */ |
47 | - function phpbb_hook($valid_hooks) |
|
48 | - { |
|
46 | + function phpbb_hook($valid_hooks) { |
|
49 | 47 | foreach ($valid_hooks as $_null => $method) |
50 | 48 | { |
51 | 49 | $this->add_hook($method); |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
66 | 64 | * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
67 | 65 | */ |
68 | - function register($definition, $hook, $mode = 'normal') |
|
69 | - { |
|
66 | + function register($definition, $hook, $mode = 'normal') { |
|
70 | 67 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
71 | 68 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
72 | 69 | |
@@ -79,8 +76,7 @@ discard block |
||
79 | 76 | if (!isset($this->hooks[$class][$function]['standalone'])) |
80 | 77 | { |
81 | 78 | $this->hooks[$class][$function] = array('standalone' => $hook); |
82 | - } |
|
83 | - else |
|
79 | + } else |
|
84 | 80 | { |
85 | 81 | trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
86 | 82 | } |
@@ -106,8 +102,7 @@ discard block |
||
106 | 102 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
107 | 103 | * @return bool False if no hook got executed, true otherwise |
108 | 104 | */ |
109 | - function call_hook($definition) |
|
110 | - { |
|
105 | + function call_hook($definition) { |
|
111 | 106 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
112 | 107 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
113 | 108 | |
@@ -128,8 +123,7 @@ discard block |
||
128 | 123 | if (isset($this->hooks[$class][$function]['standalone'])) |
129 | 124 | { |
130 | 125 | $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
131 | - } |
|
132 | - else |
|
126 | + } else |
|
133 | 127 | { |
134 | 128 | foreach (array('first', 'normal', 'last') as $mode) |
135 | 129 | { |
@@ -159,8 +153,7 @@ discard block |
||
159 | 153 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
160 | 154 | * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
161 | 155 | */ |
162 | - function previous_hook_result($definition) |
|
163 | - { |
|
156 | + function previous_hook_result($definition) { |
|
164 | 157 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
165 | 158 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
166 | 159 | |
@@ -178,8 +171,7 @@ discard block |
||
178 | 171 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
179 | 172 | * @return bool True if results are there, false if not |
180 | 173 | */ |
181 | - function hook_return($definition) |
|
182 | - { |
|
174 | + function hook_return($definition) { |
|
183 | 175 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
184 | 176 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
185 | 177 | |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
198 | 190 | * @return mixed The result |
199 | 191 | */ |
200 | - function hook_return_result($definition) |
|
201 | - { |
|
192 | + function hook_return_result($definition) { |
|
202 | 193 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
203 | 194 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
204 | 195 | |
@@ -217,8 +208,7 @@ discard block |
||
217 | 208 | * |
218 | 209 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
219 | 210 | */ |
220 | - function add_hook($definition) |
|
221 | - { |
|
211 | + function add_hook($definition) { |
|
222 | 212 | if (!is_array($definition)) |
223 | 213 | { |
224 | 214 | $definition = array('__global', $definition); |
@@ -232,8 +222,7 @@ discard block |
||
232 | 222 | * |
233 | 223 | * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
234 | 224 | */ |
235 | - function remove_hook($definition) |
|
236 | - { |
|
225 | + function remove_hook($definition) { |
|
237 | 226 | $class = (!is_array($definition)) ? '__global' : $definition[0]; |
238 | 227 | $function = (!is_array($definition)) ? $definition : $definition[1]; |
239 | 228 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * internal pointer |
39 | 39 | */ |
40 | - var $current_hook = NULL; |
|
40 | + var $current_hook = null; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Initialize hook class. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if (!empty($this->hooks[$class][$function])) |
115 | 115 | { |
116 | 116 | // Developer tries to call a hooked function within the hooked function... |
117 | - if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
117 | + if ($this->current_hook !== null && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
118 | 118 | { |
119 | 119 | return false; |
120 | 120 | } |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - $this->current_hook = NULL; |
|
148 | + $this->current_hook = null; |
|
149 | 149 | return true; |
150 | 150 | } |
151 | 151 | |
152 | - $this->current_hook = NULL; |
|
152 | + $this->current_hook = null; |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 |
@@ -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--; |
@@ -109,33 +109,33 @@ discard block |
||
109 | 109 | `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "', |
110 | 110 | `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]}, |
111 | 111 | |
112 | - `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
112 | + `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
113 | 113 | `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]}, |
114 | 114 | |
115 | 115 | `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]}, |
116 | - `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] . ", |
|
116 | + `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ", |
|
117 | 117 | |
118 | - `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ", |
|
119 | - `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
118 | + `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ", |
|
119 | + `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
120 | 120 | `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ", |
121 | 121 | |
122 | - `ube_report_planet_id` = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ", |
|
122 | + `ube_report_planet_id` = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ", |
|
123 | 123 | `ube_report_planet_name` = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "', |
124 | - `ube_report_planet_size` = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
125 | - `ube_report_planet_galaxy` = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
126 | - `ube_report_planet_system` = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
127 | - `ube_report_planet_planet` = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
128 | - `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
124 | + `ube_report_planet_size` = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
125 | + `ube_report_planet_galaxy` = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
126 | + `ube_report_planet_system` = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
127 | + `ube_report_planet_planet` = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
128 | + `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
129 | 129 | |
130 | - `ube_report_moon` = " . (int)$outcome[UBE_MOON] . ", |
|
131 | - `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ", |
|
132 | - `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ", |
|
130 | + `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ", |
|
131 | + `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ", |
|
132 | + `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ", |
|
133 | 133 | |
134 | - `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ", |
|
135 | - `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
136 | - `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
134 | + `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ", |
|
135 | + `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
136 | + `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
137 | 137 | |
138 | - `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . " |
|
138 | + `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . " |
|
139 | 139 | "); |
140 | 140 | $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id(); |
141 | 141 | |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $player_id, |
147 | 147 | |
148 | 148 | "'" . db_escape($player_info[UBE_NAME]) . "'", |
149 | - (int)$player_info[UBE_ATTACKER], |
|
149 | + (int) $player_info[UBE_ATTACKER], |
|
150 | 150 | |
151 | - (float)$player_info[UBE_BONUSES][UBE_ATTACK], |
|
152 | - (float)$player_info[UBE_BONUSES][UBE_SHIELD], |
|
153 | - (float)$player_info[UBE_BONUSES][UBE_ARMOR], |
|
151 | + (float) $player_info[UBE_BONUSES][UBE_ATTACK], |
|
152 | + (float) $player_info[UBE_BONUSES][UBE_SHIELD], |
|
153 | + (float) $player_info[UBE_BONUSES][UBE_ARMOR], |
|
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
@@ -163,20 +163,20 @@ discard block |
||
163 | 163 | $fleet_info[UBE_OWNER], |
164 | 164 | $fleet_id, |
165 | 165 | |
166 | - (float)$fleet_info[UBE_PLANET][PLANET_ID], |
|
166 | + (float) $fleet_info[UBE_PLANET][PLANET_ID], |
|
167 | 167 | "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'", |
168 | - (int)$fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
169 | - (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
170 | - (int)$fleet_info[UBE_PLANET][PLANET_PLANET], |
|
171 | - (int)$fleet_info[UBE_PLANET][PLANET_TYPE], |
|
172 | - |
|
173 | - (float)$fleet_info[UBE_RESOURCES][RES_METAL], |
|
174 | - (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
175 | - (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
176 | - |
|
177 | - (float)$fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
178 | - (float)$fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
179 | - (float)$fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
168 | + (int) $fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
169 | + (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
170 | + (int) $fleet_info[UBE_PLANET][PLANET_PLANET], |
|
171 | + (int) $fleet_info[UBE_PLANET][PLANET_TYPE], |
|
172 | + |
|
173 | + (float) $fleet_info[UBE_RESOURCES][RES_METAL], |
|
174 | + (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
175 | + (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
176 | + |
|
177 | + (float) $fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
178 | + (float) $fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
179 | + (float) $fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
180 | 180 | ); |
181 | 181 | |
182 | 182 | // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | $ube_report_id, |
186 | 186 | $fleet_id, |
187 | 187 | |
188 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
189 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
190 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
188 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
189 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
190 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
191 | 191 | |
192 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
193 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
194 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
192 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
193 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
194 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
195 | 195 | |
196 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
197 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
198 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
196 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
197 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
198 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
199 | 199 | |
200 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
200 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
201 | 201 | ); |
202 | 202 | |
203 | 203 | // Сохраняем результаты по юнитам - потеряно и восстановлено |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $fleet_id, |
210 | 210 | |
211 | 211 | $unit_id, |
212 | - (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
213 | - (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
212 | + (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
213 | + (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
214 | 214 | |
215 | 215 | $unit_sort_order, |
216 | 216 | ); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | $unit_id, |
235 | 235 | $unit_count, |
236 | - (int)$fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
236 | + (int) $fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
237 | 237 | |
238 | 238 | $fleet_data[UBE_ATTACK][$unit_id], |
239 | 239 | $fleet_data[UBE_SHIELD][$unit_id], |
@@ -30,8 +30,7 @@ |
||
30 | 30 | * @param $resource_id |
31 | 31 | * @param ResourceCalculations $capsObj |
32 | 32 | */ |
33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
34 | -{ |
|
33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
35 | 34 | global $lang, $template, $planetrow, $user; |
36 | 35 | |
37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | for ($Option = 10; $Option >= 0; $Option--) |
98 | 98 | { |
99 | - $template->assign_block_vars('option', array( |
|
100 | - 'VALUE' => $Option * 10, |
|
101 | - )); |
|
99 | + $template->assign_block_vars('option', array( |
|
100 | + 'VALUE' => $Option * 10, |
|
101 | + )); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $capsObj = new ResourceCalculations(); |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | int_calc_storage_bar(RES_DEUTERIUM, $capsObj); |
166 | 166 | |
167 | 167 | $template->assign_vars(array( |
168 | - 'PLANET_NAME' => $planetrow['name'], |
|
169 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
168 | + 'PLANET_NAME' => $planetrow['name'], |
|
169 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
170 | 170 | |
171 | - 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
171 | + 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
172 | 172 | |
173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
174 | 174 | )); |
175 | 175 | |
176 | 176 | display($template, $lang['res_planet_production']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | ]); |
51 | 51 | }; |
52 | 52 | |
53 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
53 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
54 | 54 | $template = gettemplate('resources', true); |
55 | 55 | |
56 | 56 | $planet = new \Planet\Planet($planetrow['id']); |
57 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
57 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
58 | 58 | $template->assign_block_vars('result', $transmutation_result); |
59 | 59 | $planet = new \Planet\Planet($planetrow['id']); |
60 | 60 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | $production = $_POST['production']; |
64 | 64 | //$SubQry = ''; |
65 | 65 | $SubQry = array(); |
66 | -if(is_array($production)) { |
|
67 | - foreach($production as $prod_id => $percent) { |
|
68 | - if($percent > 100 || $percent < 0) { |
|
66 | +if (is_array($production)) { |
|
67 | + foreach ($production as $prod_id => $percent) { |
|
68 | + if ($percent > 100 || $percent < 0) { |
|
69 | 69 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
70 | 70 | die(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $prod_id = intval($prod_id); |
74 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
74 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
75 | 75 | $field_name = pname_factory_production_field_name($prod_id); |
76 | 76 | $percent = floor($percent / 10); |
77 | 77 | $planetrow[$field_name] = $percent; |
78 | 78 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
79 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
79 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
80 | 80 | } else { |
81 | 81 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
82 | 82 | continue; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
114 | 114 | )); |
115 | 115 | |
116 | -foreach($sn_group_factories as $unit_id) |
|
116 | +foreach ($sn_group_factories as $unit_id) |
|
117 | 117 | { |
118 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
118 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
119 | 119 | { |
120 | 120 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
121 | 121 | $template->assign_block_vars('production', array( |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $this->target_message = "{$lang['sys_mess_spy_enemy_fleet']} {$this->src_planet['name']} " . uni_render_coordinates_href($this->src_planet, '', 3); |
32 | 32 | $this->target_message .= " {$lang['sys_mess_spy_seen_at']} {$this->dst_planet['name']} " . uni_render_coordinates($this->dst_planet); |
33 | - if($this->missionReport->isSpyDetected()) { |
|
33 | + if ($this->missionReport->isSpyDetected()) { |
|
34 | 34 | $this->target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}"; |
35 | 35 | } |
36 | 36 |