@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function sn_ube_report_save($ube) { |
15 | 15 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
16 | - if($ube->get_cypher()) { |
|
16 | + if ($ube->get_cypher()) { |
|
17 | 17 | return false; |
18 | 18 | } |
19 | 19 | |
20 | 20 | // Генерируем уникальный секретный ключ и проверяем наличие в базе |
21 | 21 | do { |
22 | 22 | $ube->report_cypher = sys_random_string(32); |
23 | - } while(classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE")); |
|
23 | + } while (classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE")); |
|
24 | 24 | |
25 | 25 | // Инициализация таблицы для пакетной вставки информации |
26 | 26 | $sql_perform = array( |
@@ -106,21 +106,21 @@ discard block |
||
106 | 106 | |
107 | 107 | // Сохраняем общую информацию о бое |
108 | 108 | classSupernova::$db->doInsertSet(TABLE_UBE_REPORT, array( |
109 | - 'ube_report_cypher' => (string)$ube->report_cypher, |
|
110 | - 'ube_report_time_combat' => (string)date(FMT_DATE_TIME_SQL, $ube->combat_timestamp), |
|
111 | - 'ube_report_time_spent' => (float)$ube->time_spent, |
|
112 | - 'ube_report_combat_admin' => (int)$ube->is_admin_in_combat, |
|
113 | - 'ube_report_mission_type' => (int)$ube->mission_type_id, |
|
114 | - 'ube_report_combat_result' => (int)$ube->combat_result, |
|
115 | - 'ube_report_combat_sfr' => (int)$ube->is_small_fleet_recce, |
|
116 | - 'ube_report_planet_id' => (int)$ube->ube_planet_info[PLANET_ID], |
|
117 | - 'ube_report_planet_name' => (string)$ube->ube_planet_info[PLANET_NAME], |
|
118 | - 'ube_report_planet_size' => (int)$ube->ube_planet_info[PLANET_SIZE], |
|
119 | - 'ube_report_planet_galaxy' => (int)$ube->ube_planet_info[PLANET_GALAXY], |
|
120 | - 'ube_report_planet_system' => (int)$ube->ube_planet_info[PLANET_SYSTEM], |
|
121 | - 'ube_report_planet_planet' => (int)$ube->ube_planet_info[PLANET_PLANET], |
|
122 | - 'ube_report_planet_planet_type' => (int)$ube->ube_planet_info[PLANET_TYPE], |
|
123 | - 'ube_report_capture_result' => (int)$ube->capture_result, |
|
109 | + 'ube_report_cypher' => (string) $ube->report_cypher, |
|
110 | + 'ube_report_time_combat' => (string) date(FMT_DATE_TIME_SQL, $ube->combat_timestamp), |
|
111 | + 'ube_report_time_spent' => (float) $ube->time_spent, |
|
112 | + 'ube_report_combat_admin' => (int) $ube->is_admin_in_combat, |
|
113 | + 'ube_report_mission_type' => (int) $ube->mission_type_id, |
|
114 | + 'ube_report_combat_result' => (int) $ube->combat_result, |
|
115 | + 'ube_report_combat_sfr' => (int) $ube->is_small_fleet_recce, |
|
116 | + 'ube_report_planet_id' => (int) $ube->ube_planet_info[PLANET_ID], |
|
117 | + 'ube_report_planet_name' => (string) $ube->ube_planet_info[PLANET_NAME], |
|
118 | + 'ube_report_planet_size' => (int) $ube->ube_planet_info[PLANET_SIZE], |
|
119 | + 'ube_report_planet_galaxy' => (int) $ube->ube_planet_info[PLANET_GALAXY], |
|
120 | + 'ube_report_planet_system' => (int) $ube->ube_planet_info[PLANET_SYSTEM], |
|
121 | + 'ube_report_planet_planet' => (int) $ube->ube_planet_info[PLANET_PLANET], |
|
122 | + 'ube_report_planet_planet_type' => (int) $ube->ube_planet_info[PLANET_TYPE], |
|
123 | + 'ube_report_capture_result' => (int) $ube->capture_result, |
|
124 | 124 | ) |
125 | 125 | + $ube->debris->report_generate_array() |
126 | 126 | + $ube->moon_calculator->report_generate_array() |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // Сохраняем общую информацию по игрокам |
131 | 131 | $player_sides = $ube->players->get_player_sides(); |
132 | - foreach($player_sides as $player_id => $player_side) { |
|
132 | + foreach ($player_sides as $player_id => $player_side) { |
|
133 | 133 | $sql_perform['ube_report_player'][] = array( |
134 | 134 | $ube_report_id, |
135 | 135 | $player_id, |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | "'" . db_escape($ube->players[$player_id]->name) . "'", |
138 | 138 | $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0, |
139 | 139 | |
140 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
141 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
142 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
140 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
141 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
142 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Всякая информация по флотам |
147 | - foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
147 | + foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
148 | 148 | // Сохраняем общую информацию по флотам |
149 | 149 | $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id); |
150 | 150 | |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | |
161 | 161 | // Пакетная вставка данных |
162 | 162 | // First row is a list of field names |
163 | - foreach($sql_perform as $table_name => &$table_data) { |
|
163 | + foreach ($sql_perform as $table_name => &$table_data) { |
|
164 | 164 | // If only field names in this table - doing nothing |
165 | - if(count($table_data) < 2) { |
|
165 | + if (count($table_data) < 2) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 | // Picking up field names |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $report_cypher = db_escape($report_cypher); |
186 | 186 | |
187 | 187 | $report_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1"); |
188 | - if(!$report_row) { |
|
188 | + if (!$report_row) { |
|
189 | 189 | return UBE_REPORT_NOT_FOUND; |
190 | 190 | } |
191 | 191 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param $template_result |
202 | 202 | */ |
203 | 203 | public function sn_ube_report_generate(UBE $ube, &$template_result) { |
204 | - if(!is_object($ube)) { |
|
204 | + if (!is_object($ube)) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
@@ -216,15 +216,15 @@ discard block |
||
216 | 216 | |
217 | 217 | // Координаты, тип и название планеты - если есть |
218 | 218 | //R $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER]; |
219 | - if(isset($ube->ube_planet_info)) { |
|
219 | + if (isset($ube->ube_planet_info)) { |
|
220 | 220 | $template_result += $ube->ube_planet_info; |
221 | 221 | $template_result[PLANET_NAME] = str_replace(' ', ' ', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8')); |
222 | 222 | } |
223 | 223 | |
224 | 224 | // Обломки |
225 | 225 | $debris = array(); |
226 | - foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
227 | - if($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
226 | + foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
227 | + if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
228 | 228 | $debris[] = array( |
229 | 229 | 'NAME' => classLocale::$lang['tech'][$resource_id], |
230 | 230 | 'AMOUNT' => pretty_number($resource_amount), |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $debris_for_moon = $debris->debris_total(); |
74 | 74 | |
75 | - if(!$debris_for_moon) { |
|
75 | + if (!$debris_for_moon) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $moon_chance = min($debris_for_moon / UBE_MOON_DEBRIS_PER_PERCENT, UBE_MOON_PERCENT_MAX); // TODO Configure |
81 | 81 | $moon_chance = $moon_chance >= UBE_MOON_PERCENT_MIN ? $moon_chance : 0; |
82 | 82 | $this->create_chance = $moon_chance; |
83 | - if($moon_chance) { |
|
84 | - if($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
83 | + if ($moon_chance) { |
|
84 | + if ($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
85 | 85 | $this->status = UBE_MOON_CREATE_SUCCESS; |
86 | 86 | $this->moon_diameter = round($is_simulator ? $moon_chance * 150 + 1999 : mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999)); |
87 | 87 | |
88 | - if($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
88 | + if ($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
89 | 89 | $debris->_reset(); |
90 | 90 | } else { |
91 | 91 | $moon_debris_left_percent = ($debris_for_moon - UBE_MOON_DEBRIS_MAX_SPENT) / $debris_for_moon; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function moon_destroy_try($reapers) { |
106 | 106 | // TODO: $is_simulator |
107 | - if($reapers <= 0) { |
|
107 | + if ($reapers <= 0) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @version 2016-02-25 23:42:45 41a4.68 |
123 | 123 | */ |
124 | 124 | public function calculate_moon(UBE $ube) { |
125 | - if(UBE_MOON_EXISTS == $this->status) { |
|
126 | - if($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
125 | + if (UBE_MOON_EXISTS == $this->status) { |
|
126 | + if ($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
127 | 127 | $reapers = $ube->fleet_list->ube_calculate_attack_reapers(); |
128 | 128 | $this->moon_destroy_try($reapers); |
129 | 129 | } |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function report_generate_array() { |
139 | 139 | return array( |
140 | - 'ube_report_moon' => (int)$this->status, |
|
141 | - 'ube_report_moon_chance' => (int)$this->create_chance, |
|
142 | - 'ube_report_moon_size' => (float)$this->moon_diameter, |
|
143 | - 'ube_report_moon_reapers' => (int)$this->reapers_status, |
|
144 | - 'ube_report_moon_destroy_chance' => (int)$this->destroy_chance, |
|
145 | - 'ube_report_moon_reapers_die_chance' => (int)$this->reaper_die_chance, |
|
140 | + 'ube_report_moon' => (int) $this->status, |
|
141 | + 'ube_report_moon_chance' => (int) $this->create_chance, |
|
142 | + 'ube_report_moon_size' => (float) $this->moon_diameter, |
|
143 | + 'ube_report_moon_reapers' => (int) $this->reapers_status, |
|
144 | + 'ube_report_moon_destroy_chance' => (int) $this->destroy_chance, |
|
145 | + 'ube_report_moon_reapers_die_chance' => (int) $this->reaper_die_chance, |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param $planet_id |
174 | 174 | */ |
175 | 175 | public function db_apply_result($planet_info, $destination_user_id) { |
176 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
176 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
177 | 177 | $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $this->moon_diameter, '', false); |
178 | 178 | $this->moon_name = $moon_row['name']; |
179 | 179 | unset($moon_row); |
180 | - } elseif($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
180 | + } elseif ($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
181 | 181 | DBStaticPlanet::db_planet_delete_by_id($planet_info[PLANET_ID]); |
182 | 182 | } |
183 | 183 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $classLocale = classLocale::$lang; |
187 | 187 | |
188 | 188 | $text_defender = ''; |
189 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
189 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
190 | 190 | $text_defender .= "{$classLocale['ube_report_moon_created']} {$this->moon_diameter} {$classLocale['sys_kilometers_short']}<br /><br />"; |
191 | - } elseif($this->status == UBE_MOON_CREATE_FAILED) { |
|
191 | + } elseif ($this->status == UBE_MOON_CREATE_FAILED) { |
|
192 | 192 | $text_defender .= "{$classLocale['ube_report_moon_chance']} {$this->create_chance}%<br /><br />"; |
193 | 193 | } |
194 | 194 | |
195 | - if($ube->mission_type_id == MT_DESTROY) { |
|
196 | - if($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
195 | + if ($ube->mission_type_id == MT_DESTROY) { |
|
196 | + if ($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
197 | 197 | $text_defender .= classLocale::$lang['ube_report_moon_reapers_none']; |
198 | 198 | } else { |
199 | 199 | $text_defender .= "{$classLocale['ube_report_moon_reapers_wave']}. {$classLocale['ube_report_moon_reapers_chance']} {$this->destroy_chance}%. "; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @version 2016-02-25 23:42:45 41a4.68 |
223 | 223 | */ |
224 | 224 | public function ubeInitLoadStatis($destination_planet) { |
225 | - if($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
225 | + if ($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
226 | 226 | $this->status = UBE_MOON_EXISTS; |
227 | 227 | $this->moon_diameter = !empty($moon['planet_type']) && $moon['planet_type'] == PT_MOON ? $moon['diameter'] : $destination_planet['diameter']; |
228 | 228 | $this->reapers_status = UBE_MOON_REAPERS_NONE; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER); |
151 | 151 | |
152 | 152 | $player_db_row = $this->players[$player_id]->getDbRow(); |
153 | - if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
153 | + if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
154 | 154 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level); |
155 | 155 | } |
156 | 156 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->rounds[0] = new UBERound(0); |
182 | 182 | $this->rounds[0]->make_snapshot($this->fleet_list); |
183 | 183 | |
184 | - for($round = 1; $round <= 10; $round++) { |
|
184 | + for ($round = 1; $round <= 10; $round++) { |
|
185 | 185 | // Проводим раунд |
186 | 186 | defined('DEBUG_UBE') ? print("Round {$round}<br>") : false; |
187 | 187 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | // Анализируем итоги текущего раунда и готовим данные для следующего |
196 | 196 | $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round); |
197 | - if($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
197 | + if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
198 | 198 | break; |
199 | 199 | } |
200 | 200 | |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | // Генерируем результат боя |
224 | 224 | $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates); |
225 | 225 | |
226 | - if(!$this->is_ube_loaded) { |
|
226 | + if (!$this->is_ube_loaded) { |
|
227 | 227 | $this->moon_calculator->calculate_moon($this); |
228 | 228 | |
229 | 229 | // Лутаем ресурсы - если аттакер выиграл |
230 | - if($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
230 | + if ($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
231 | 231 | $this->sn_ube_combat_analyze_loot(); |
232 | 232 | } |
233 | 233 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | RES_DEUTERIUM => 0, |
248 | 248 | ); |
249 | 249 | |
250 | - if( |
|
250 | + if ( |
|
251 | 251 | (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0) |
252 | 252 | && |
253 | 253 | (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0) |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | $planet_lootable_percent = $planet_lootable / $planet_resource_total; |
260 | 260 | |
261 | 261 | // Вычисляем сколько ресурсов вывезено |
262 | - foreach($this->fleet_list->_container as $fleet_id => $fleet) { |
|
262 | + foreach ($this->fleet_list->_container as $fleet_id => $fleet) { |
|
263 | 263 | $looted_in_metal = 0; |
264 | - foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
264 | + foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
265 | 265 | // Вычисляем какой процент общей емкости трюмов атакующих будет задействован |
266 | 266 | $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity; |
267 | 267 | $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $destination_user_id = $this->fleet_list[0]->owner_id; |
327 | 327 | |
328 | 328 | // Обновляем поле обломков на планете |
329 | - if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
329 | + if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
330 | 330 | DBStaticPlanet::db_planet_update_by_gspt( |
331 | 331 | $this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET, |
332 | 332 | array(), |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | ); |
338 | 338 | } |
339 | 339 | |
340 | - foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
340 | + foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
341 | 341 | $ship_count_lost = $UBEFleet->unit_list->unitCountLost(); |
342 | 342 | |
343 | - if($fleet_id) { |
|
343 | + if ($fleet_id) { |
|
344 | 344 | // Флот |
345 | 345 | $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status()); |
346 | 346 | } else { |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | |
349 | 349 | // Сохраняем изменения ресурсов - если они есть |
350 | 350 | $resource_delta = $UBEFleet->ube_combat_result_calculate_resources(); |
351 | - if(!empty($resource_delta)) { |
|
351 | + if (!empty($resource_delta)) { |
|
352 | 352 | $temp = array(); |
353 | - foreach($resource_delta as $resource_id => $resource_amount) { |
|
353 | + foreach ($resource_delta as $resource_id => $resource_amount) { |
|
354 | 354 | $resource_db_name = pname_resource_name($resource_id); |
355 | 355 | $temp[$resource_db_name] = $resource_amount; |
356 | 356 | } |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | ); |
361 | 361 | } |
362 | 362 | |
363 | - if($ship_count_lost) { |
|
363 | + if ($ship_count_lost) { |
|
364 | 364 | $planet_row_cache = $this->players[$destination_user_id]->getDbRow(); |
365 | - foreach($UBEFleet->unit_list->_container as $UBEUnit) { |
|
365 | + foreach ($UBEFleet->unit_list->_container as $UBEUnit) { |
|
366 | 366 | DBStaticUnit::dbUpdateOrInsertUnit($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]); |
367 | 367 | } |
368 | 368 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL |
373 | 373 | // Для САБов |
374 | 374 | $fleet_group_id_list = $this->fleet_list->ube_get_groups(); |
375 | - if(!empty($fleet_group_id_list)) { |
|
375 | + if (!empty($fleet_group_id_list)) { |
|
376 | 376 | $fleet_group_id_list = implode(',', $fleet_group_id_list); |
377 | 377 | DBStaticFleetACS::db_acs_delete_by_list($fleet_group_id_list); |
378 | 378 | } |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | $this->moon_calculator->db_apply_result($this->ube_planet_info, $destination_user_id); |
381 | 381 | |
382 | 382 | $bashing_list = array(); |
383 | - foreach($this->players->get_player_sides() as $player_id => $player_side) { |
|
384 | - if($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
383 | + foreach ($this->players->get_player_sides() as $player_id => $player_side) { |
|
384 | + if ($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
385 | 385 | continue; |
386 | 386 | } |
387 | - if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
387 | + if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
388 | 388 | $bashing_list[] = array($player_id, $this->ube_planet_info[PLANET_ID], $this->combat_timestamp); |
389 | 389 | } |
390 | - if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
390 | + if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
391 | 391 | $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose'; |
392 | 392 | DBStaticUser::db_user_adjust_by_id( |
393 | 393 | $player_id, |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | ); |
400 | 400 | } |
401 | 401 | } |
402 | - if(!empty($bashing_list)) { |
|
402 | + if (!empty($bashing_list)) { |
|
403 | 403 | DBStaticFleetBashing::db_bashing_insert($bashing_list); |
404 | 404 | } |
405 | 405 | |
@@ -425,20 +425,19 @@ discard block |
||
425 | 425 | $planet_info[PLANET_SYSTEM], |
426 | 426 | $planet_info[PLANET_PLANET], |
427 | 427 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
428 | - classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
429 | - ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
428 | + classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
430 | 429 | ); |
431 | 430 | |
432 | 431 | $text_defender = ''; |
433 | 432 | $debris = $this->debris->get_debris(); |
434 | - foreach($debris as $resource_id => $resource_amount) { |
|
435 | - if($resource_id == RES_DEUTERIUM) { |
|
433 | + foreach ($debris as $resource_id => $resource_amount) { |
|
434 | + if ($resource_id == RES_DEUTERIUM) { |
|
436 | 435 | continue; |
437 | 436 | } |
438 | 437 | |
439 | 438 | $text_defender .= "{$classLocale['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />'; |
440 | 439 | } |
441 | - if($text_defender) { |
|
440 | + if ($text_defender) { |
|
442 | 441 | $text_defender = "{$classLocale['ube_report_msg_body_debris']}{$text_defender}<br />"; |
443 | 442 | } |
444 | 443 | |
@@ -448,7 +447,7 @@ discard block |
||
448 | 447 | |
449 | 448 | // TODO: Оптимизировать отсылку сообщений - отсылать пакетами |
450 | 449 | $player_sides = $this->players->get_player_sides(); |
451 | - foreach($player_sides as $player_id => $player_side) { |
|
450 | + foreach ($player_sides as $player_id => $player_side) { |
|
452 | 451 | $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender); |
453 | 452 | DBStaticMessages::msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_attack_report'], $message); |
454 | 453 | } |
@@ -484,11 +483,11 @@ discard block |
||
484 | 483 | $player_id = $player_id == -1 ? $this->players->count() : $player_id; |
485 | 484 | $fleet_id = $player_id; // FOR SIMULATOR! |
486 | 485 | |
487 | - if(empty($this->players[$player_id])) { |
|
486 | + if (empty($this->players[$player_id])) { |
|
488 | 487 | $this->players[$player_id] = new UBEPlayer(); |
489 | 488 | } |
490 | 489 | |
491 | - foreach($side_info as $fleet_data) { |
|
490 | + foreach ($side_info as $fleet_data) { |
|
492 | 491 | $this->players[$player_id]->name = $player_id; |
493 | 492 | $this->players[$player_id]->setSide($attacker); |
494 | 493 | |
@@ -496,32 +495,32 @@ discard block |
||
496 | 495 | $this->fleet_list[$fleet_id] = $objFleet; |
497 | 496 | |
498 | 497 | $this->fleet_list[$fleet_id]->owner_id = $player_id; |
499 | - foreach($fleet_data as $unit_id => $unit_count) { |
|
500 | - if(!$unit_count) { |
|
498 | + foreach ($fleet_data as $unit_id => $unit_count) { |
|
499 | + if (!$unit_count) { |
|
501 | 500 | continue; |
502 | 501 | } |
503 | 502 | |
504 | 503 | $unit_type = get_unit_param($unit_id, P_UNIT_TYPE); |
505 | 504 | |
506 | - if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
505 | + if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
507 | 506 | $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count); |
508 | - } elseif($unit_type == UNIT_RESOURCES) { |
|
507 | + } elseif ($unit_type == UNIT_RESOURCES) { |
|
509 | 508 | $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count; |
510 | - } elseif($unit_type == UNIT_TECHNOLOGIES) { |
|
511 | - if($unit_id == TECH_WEAPON) { |
|
509 | + } elseif ($unit_type == UNIT_TECHNOLOGIES) { |
|
510 | + if ($unit_id == TECH_WEAPON) { |
|
512 | 511 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count); |
513 | - } elseif($unit_id == TECH_SHIELD) { |
|
512 | + } elseif ($unit_id == TECH_SHIELD) { |
|
514 | 513 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count); |
515 | - } elseif($unit_id == TECH_ARMOR) { |
|
514 | + } elseif ($unit_id == TECH_ARMOR) { |
|
516 | 515 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count); |
517 | 516 | } |
518 | - } elseif($unit_type == UNIT_GOVERNORS) { |
|
519 | - if($unit_id == MRC_FORTIFIER) { |
|
517 | + } elseif ($unit_type == UNIT_GOVERNORS) { |
|
518 | + if ($unit_id == MRC_FORTIFIER) { |
|
520 | 519 | // Фортифаер даёт бонус ко всему |
521 | 520 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count); |
522 | 521 | } |
523 | - } elseif($unit_type == UNIT_MERCENARIES) { |
|
524 | - if($unit_id == MRC_ADMIRAL) { |
|
522 | + } elseif ($unit_type == UNIT_MERCENARIES) { |
|
523 | + if ($unit_id == MRC_ADMIRAL) { |
|
525 | 524 | $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count); |
526 | 525 | } |
527 | 526 | } |
@@ -590,7 +589,7 @@ discard block |
||
590 | 589 | |
591 | 590 | $ube_report = new UBEReport(); |
592 | 591 | $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher')); |
593 | - if($ube != UBE_REPORT_NOT_FOUND) { |
|
592 | + if ($ube != UBE_REPORT_NOT_FOUND) { |
|
594 | 593 | $ube_report->sn_ube_report_generate($ube, $template_result); |
595 | 594 | |
596 | 595 | $template = gettemplate('ube_combat_report', $template); |
@@ -618,9 +617,9 @@ discard block |
||
618 | 617 | $ube->sn_ube_combat(); |
619 | 618 | $ube_report = new UBEReport(); |
620 | 619 | |
621 | - if(sys_get_param_str('reload')) { |
|
620 | + if (sys_get_param_str('reload')) { |
|
622 | 621 | $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]); |
623 | - if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
622 | + if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
624 | 623 | $ube = $ube_new; |
625 | 624 | } |
626 | 625 | } |
@@ -668,7 +667,7 @@ discard block |
||
668 | 667 | $this->debris->load_from_report_row($report_row); |
669 | 668 | |
670 | 669 | $query = classSupernova::$db->doSelect("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
671 | - while($player_row = db_fetch($query)) { |
|
670 | + while ($player_row = db_fetch($query)) { |
|
672 | 671 | $this->players->init_player_from_report_info($player_row); |
673 | 672 | } |
674 | 673 |
@@ -1325,14 +1325,14 @@ |
||
1325 | 1325 | if (FLIGHT_ALLOWED == $validateResult[$missionType]) { |
1326 | 1326 | $this->allowed_missions[$missionType] = $mission; |
1327 | 1327 | } else { |
1328 | - if($missionType == $this->mission_type) { |
|
1328 | + if ($missionType == $this->mission_type) { |
|
1329 | 1329 | } |
1330 | 1330 | unset($this->allowed_missions[$missionType]); |
1331 | 1331 | } |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - if(empty($this->allowed_missions)) { |
|
1335 | - if($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
1334 | + if (empty($this->allowed_missions)) { |
|
1335 | + if ($this->mission_type != MT_NONE && isset($validateResult[$this->mission_type])) { |
|
1336 | 1336 | throw new ExceptionFleetInvalid($validateResult[$this->mission_type], $validateResult[$this->mission_type]); |
1337 | 1337 | } else { |
1338 | 1338 | throw new ExceptionFleetInvalid(FLIGHT_MISSION_IMPOSSIBLE, FLIGHT_MISSION_IMPOSSIBLE); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $this->reset(); |
80 | 80 | $this->db = is_object($db) ? $db : classSupernova::$db; |
81 | 81 | |
82 | - foreach($this->table_check as $table_name) { |
|
83 | - if(empty($this->db->table_list[$table_name])) { |
|
82 | + foreach ($this->table_check as $table_name) { |
|
83 | + if (empty($this->db->table_list[$table_name])) { |
|
84 | 84 | die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br /> |
85 | 85 | В противном случае - сообщите Администрации сервера об ошибке.<br/> |
86 | 86 | Не хватает таблицы для работы системы авторизации: ' . $table_name); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | // OK v4.6 |
106 | 106 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
107 | - if(!$this->password_check($old_password_unsafe)) { |
|
107 | + if (!$this->password_check($old_password_unsafe)) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // OK v4.5 |
126 | 126 | public function assign_from_db_row($row) { |
127 | 127 | $this->reset(); |
128 | - if(empty($row) || !is_array($row)) { |
|
128 | + if (empty($row) || !is_array($row)) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | $this->account_id = $row['account_id']; |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | `account_email` = LOWER('{$email_safe}'), |
243 | 243 | `account_language` = '{$language_safe}'" |
244 | 244 | ); |
245 | - if(!$result) { |
|
245 | + if (!$result) { |
|
246 | 246 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
247 | 247 | } |
248 | 248 | |
249 | - if(!($account_id = $this->db->db_insert_id())) { |
|
249 | + if (!($account_id = $this->db->db_insert_id())) { |
|
250 | 250 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
251 | 251 | } |
252 | 252 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | WHERE `account_id` = '{$account_id_safe}'" |
277 | 277 | ) ? true : false; |
278 | 278 | |
279 | - if($result) { |
|
279 | + if ($result) { |
|
280 | 280 | $result = $this->db_get_by_id($this->account_id); |
281 | 281 | } |
282 | 282 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function metamatter_change($change_type, $metamatter, $comment = '', $already_changed = false) { |
364 | 364 | global $debug, $mm_change_legit; |
365 | 365 | |
366 | - if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
366 | + if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
367 | 367 | $debug->error('Ошибка при попытке манипуляции с ММ'); |
368 | 368 | |
369 | 369 | return false; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | $mm_change_legit = true; |
375 | 375 | // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER); |
376 | - if($already_changed) { |
|
376 | + if ($already_changed) { |
|
377 | 377 | $metamatter_total_delta = 0; |
378 | 378 | $result = -1; |
379 | 379 | } else { |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') . |
388 | 388 | " WHERE `account_id` = {$account_id_safe}" |
389 | 389 | ); |
390 | - if(!$result) { |
|
390 | + if (!$result) { |
|
391 | 391 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
392 | 392 | } |
393 | 393 | $result = classSupernova::$db->db_affected_rows(); |
394 | 394 | } |
395 | 395 | |
396 | - if(empty(core_auth::$user['id'])) { |
|
396 | + if (empty(core_auth::$user['id'])) { |
|
397 | 397 | $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id); |
398 | 398 | reset($user_list); |
399 | 399 | $user_id_unsafe = key($user_list); |
@@ -402,30 +402,30 @@ discard block |
||
402 | 402 | } |
403 | 403 | $user_id_safe = $this->db->db_escape($user_id_unsafe); |
404 | 404 | |
405 | - if(!$result) { |
|
405 | + if (!$result) { |
|
406 | 406 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
407 | 407 | } |
408 | 408 | |
409 | - if(!$already_changed) { |
|
409 | + if (!$already_changed) { |
|
410 | 410 | $this->account_metamatter += $metamatter; |
411 | 411 | $this->account_metamatter_total += $metamatter_total_delta; |
412 | 412 | } |
413 | 413 | |
414 | - if(is_array($comment)) { |
|
414 | + if (is_array($comment)) { |
|
415 | 415 | $comment = call_user_func_array('sprintf', $comment); |
416 | 416 | } |
417 | 417 | |
418 | 418 | $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe); |
419 | 419 | |
420 | - if($metamatter > 0 && !empty($user_id_safe)) { |
|
420 | + if ($metamatter > 0 && !empty($user_id_safe)) { |
|
421 | 421 | $old_referral = db_referral_get_by_id($user_id_safe); |
422 | - if($old_referral['id']) { |
|
422 | + if ($old_referral['id']) { |
|
423 | 423 | $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM; |
424 | 424 | db_referral_update_dm($user_id_safe, $dark_matter_from_metamatter); |
425 | 425 | $new_referral = db_referral_get_by_id($user_id_safe); |
426 | 426 | |
427 | 427 | $partner_bonus = floor($new_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) : 0); |
428 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) { |
|
428 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) { |
|
429 | 429 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}"); |
430 | 430 | } |
431 | 431 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param db_mysql|null $db |
87 | 87 | */ |
88 | 88 | public static function setDb($db = null) { |
89 | - if(empty($db) || !($db instanceof db_mysql)) { |
|
89 | + if (empty($db) || !($db instanceof db_mysql)) { |
|
90 | 90 | $db = null; |
91 | 91 | } |
92 | 92 | static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | - if(empty($set)) { |
|
455 | + if (empty($set)) { |
|
456 | 456 | $theResult = true; |
457 | 457 | } else { |
458 | 458 | $theResult = classSupernova::$db->doUpdateRowAdjust( |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
140 | 140 | $include_blocks = $matches[1]; |
141 | - if($include_blocks) |
|
141 | + if ($include_blocks) |
|
142 | 142 | { |
143 | - foreach($include_blocks as &$included_file) |
|
143 | + foreach ($include_blocks as &$included_file) |
|
144 | 144 | { |
145 | 145 | $included_file .= '.tpl.html'; |
146 | 146 | } |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | |
447 | 447 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
448 | 448 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
449 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
450 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
449 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
450 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
451 | 451 | |
452 | 452 | return $tag_template_php; |
453 | 453 | } |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | break; |
552 | 552 | |
553 | 553 | case 'is': |
554 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
554 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
555 | 555 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
556 | 556 | |
557 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
557 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
558 | 558 | |
559 | 559 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
560 | 560 | |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | } |
815 | 815 | else if ($include_last_iterator) |
816 | 816 | { |
817 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
817 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
818 | 818 | } |
819 | 819 | else |
820 | 820 | { |
821 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
821 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | if ($fp = @fopen($filename, 'wb')) |
836 | 836 | { |
837 | 837 | @flock($fp, LOCK_EX); |
838 | - @fwrite ($fp, $data); |
|
838 | + @fwrite($fp, $data); |
|
839 | 839 | @flock($fp, LOCK_UN); |
840 | 840 | @fclose($fp); |
841 | 841 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | */ |
853 | 853 | private function minify($html) |
854 | 854 | { |
855 | - if(!classSupernova::$config->tpl_minifier) |
|
855 | + if (!classSupernova::$config->tpl_minifier) |
|
856 | 856 | { |
857 | 857 | return $html; |
858 | 858 | } |
@@ -862,14 +862,14 @@ discard block |
||
862 | 862 | $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html); |
863 | 863 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
864 | 864 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
865 | - if(!empty($pre[0])) |
|
865 | + if (!empty($pre[0])) |
|
866 | 866 | { |
867 | - foreach($pre[0] as $tag) |
|
867 | + foreach ($pre[0] as $tag) |
|
868 | 868 | { |
869 | 869 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
870 | 870 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
871 | 871 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
872 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
872 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
873 | 873 | } |
874 | 874 | } |
875 | 875 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, |
17 | 17 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
18 | 18 | 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, |
19 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
19 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
20 | 20 | 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, |
21 | 21 | 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, |
22 | 22 | // 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->checkMissionRestrictions($action); |
159 | 159 | } else { |
160 | 160 | // No - then just performing action |
161 | - if($exception) { |
|
161 | + if ($exception) { |
|
162 | 162 | throw new ExceptionFleetInvalid($action, $action); |
163 | 163 | } else { |
164 | 164 | return $action; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | global $user, $dm_change_legit, $mm_change_legit; |
591 | 591 | |
592 | - switch(true) { |
|
592 | + switch (true) { |
|
593 | 593 | case stripos($query, 'RUNCATE TABL') != false: |
594 | 594 | case stripos($query, 'ROP TABL') != false: |
595 | 595 | case stripos($query, 'ENAME TABL') != false: |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $prefix_length = strlen($this->db_prefix); |
652 | 652 | |
653 | 653 | $tl = array(); |
654 | - while($row = $this->db_fetch($query)) { |
|
654 | + while ($row = $this->db_fetch($query)) { |
|
655 | 655 | foreach ($row as $table_name) { |
656 | 656 | if (strpos($table_name, $this->db_prefix) === 0) { |
657 | 657 | $table_name = substr($table_name, $prefix_length); |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | if (is_bool($query)) { |
786 | 786 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
787 | 787 | } |
788 | - while($row = db_fetch($query)) { |
|
788 | + while ($row = db_fetch($query)) { |
|
789 | 789 | $result[$row['Variable_name']] = $row['Value']; |
790 | 790 | } |
791 | 791 |