@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | global $user; |
88 | 88 | |
89 | - if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template')) |
|
89 | + if (file_exists($this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template')) |
|
90 | 90 | { |
91 | 91 | $this->root = $this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template'; |
92 | 92 | $this->cachepath = $this->rootPhysical . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | // Re-position template blocks |
646 | 646 | for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) |
647 | 647 | { |
648 | - $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; |
|
648 | + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1]; |
|
649 | 649 | $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; |
650 | 650 | } |
651 | 651 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | */ |
726 | 726 | function assign_recursive($values, $name = '') |
727 | 727 | { |
728 | - if(isset($values['.'])) |
|
728 | + if (isset($values['.'])) |
|
729 | 729 | { |
730 | 730 | $values_extra = $values['.']; |
731 | 731 | unset($values['.']); |
732 | 732 | } |
733 | 733 | |
734 | - if(!$name) |
|
734 | + if (!$name) |
|
735 | 735 | { |
736 | 736 | $this->assign_vars($values); |
737 | 737 | } |
@@ -740,12 +740,12 @@ discard block |
||
740 | 740 | $this->assign_block_vars($name, $values); |
741 | 741 | } |
742 | 742 | |
743 | - if(isset($values_extra)) |
|
743 | + if (isset($values_extra)) |
|
744 | 744 | { |
745 | - foreach($values_extra as $sub_array_name => $sub_array) |
|
745 | + foreach ($values_extra as $sub_array_name => $sub_array) |
|
746 | 746 | { |
747 | 747 | $new_name = $name . ($name ? '.' : '') . $sub_array_name; |
748 | - foreach($sub_array as $sub_element) |
|
748 | + foreach ($sub_array as $sub_element) |
|
749 | 749 | { |
750 | 750 | $this->assign_recursive($sub_element, $new_name); |
751 | 751 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return string |
339 | 339 | */ |
340 | 340 | protected function stringValue($value) { |
341 | - return "'" . $this->escape((string)$value) . "'"; |
|
341 | + return "'" . $this->escape((string) $value) . "'"; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @return string |
350 | 350 | */ |
351 | 351 | public function quote($fieldName) { |
352 | - return "`" . $this->escape((string)$fieldName) . "`"; |
|
352 | + return "`" . $this->escape((string) $fieldName) . "`"; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @return string |
397 | 397 | */ |
398 | 398 | protected function quoteTable($tableName) { |
399 | - return "`{{" . $this->escape((string)$tableName) . "}}`"; |
|
399 | + return "`{{" . $this->escape((string) $tableName) . "}}`"; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
39 | 39 | |
40 | 40 | // Alliance bonus calculations |
41 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
41 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
42 | 42 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
43 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
43 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
44 | 44 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
45 | 45 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
46 | 46 | |
@@ -76,25 +76,25 @@ discard block |
||
76 | 76 | 'deuterium_basic_income' => 0, |
77 | 77 | 'eco_scale_storage' => 1, |
78 | 78 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
79 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
79 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
80 | 80 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
81 | 81 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
82 | 82 | 'energy_basic_income' => 0, |
83 | 83 | |
84 | 84 | // Bashing protection settings |
85 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
86 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
87 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
88 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
89 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
85 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
86 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
87 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
88 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
89 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
90 | 90 | |
91 | 91 | 'Fleet_Cdr' => 30, |
92 | 92 | 'fleet_speed' => 1, |
93 | 93 | |
94 | 94 | 'fleet_update_interval' => 4, |
95 | 95 | |
96 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
97 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
96 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
97 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
98 | 98 | // Defaults |
99 | 99 | 'game_default_language' => 'ru', |
100 | 100 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | 'game_maxSystem' => 199, |
109 | 109 | 'game_maxPlanet' => 15, |
110 | 110 | // Game global settings |
111 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
111 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
112 | 112 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
113 | 113 | |
114 | 114 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
115 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
116 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
115 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
116 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
117 | 117 | // Noob protection |
118 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
118 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
119 | 119 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
120 | 120 | |
121 | 121 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | 'payment_currency_exchange_wmu' => 30, |
165 | 165 | 'payment_currency_exchange_wmz' => 1, |
166 | 166 | |
167 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
168 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
167 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
168 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
169 | 169 | |
170 | 170 | 'planet_teleport_cost' => 50000, // |
171 | 171 | 'planet_teleport_timeout' => 86400, // |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'resource_multiplier' => 1, |
184 | 184 | |
185 | 185 | //Roleplay system |
186 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
186 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
187 | 187 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
188 | 188 | |
189 | 189 | // Black Market - General |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | public static function getInstance($gamePrefix = 'sn_', $table_name = 'config') { |
274 | - if(!isset(self::$cacheObject)) { |
|
274 | + if (!isset(self::$cacheObject)) { |
|
275 | 275 | $className = get_class(); |
276 | 276 | self::$cacheObject = new $className($gamePrefix, $table_name); |
277 | 277 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | $this->prepare(); |
97 | 97 | |
98 | 98 | $this->manifest['active'] = false; |
99 | - if(!empty($this->config) && is_array($this->config['db'])) { |
|
99 | + if (!empty($this->config) && is_array($this->config['db'])) { |
|
100 | 100 | // БД, отличная от стандартной |
101 | 101 | $this->db = new db_mysql(); |
102 | 102 | |
103 | 103 | $this->db->sn_db_connect($this->config['db']); |
104 | - if($this->manifest['active'] = $this->db->connected) { |
|
104 | + if ($this->manifest['active'] = $this->db->connected) { |
|
105 | 105 | $this->provider_id = ACCOUNT_PROVIDER_CENTRAL; |
106 | 106 | |
107 | 107 | $this->domain = $this->config['domain']; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // Fallback to local DB |
118 | - if(!$this->manifest['active']) { |
|
118 | + if (!$this->manifest['active']) { |
|
119 | 119 | $this->db = classSupernova::$db; |
120 | 120 | |
121 | 121 | $this->provider_id = ACCOUNT_PROVIDER_LOCAL; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
171 | 171 | $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe); |
172 | - if($result) { |
|
172 | + if ($result) { |
|
173 | 173 | $this->cookie_set(); |
174 | 174 | } |
175 | 175 | |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | protected function password_reset_send_code() { |
199 | 199 | global $lang, $config; |
200 | 200 | |
201 | - if(!$this->is_password_reset) { |
|
201 | + if (!$this->is_password_reset) { |
|
202 | 202 | return $this->account_login_status; |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Проверяем поддержку сброса пароля |
206 | - if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
206 | + if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
207 | 207 | return $this->account_login_status; |
208 | 208 | } |
209 | 209 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | unset($this->account); |
214 | 214 | $this->account = new Account($this->db); |
215 | 215 | |
216 | - if(!$this->account->db_get_by_email($email_unsafe)) { |
|
216 | + if (!$this->account->db_get_by_email($email_unsafe)) { |
|
217 | 217 | throw new Exception(PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS, ERR_ERROR); |
218 | 218 | // return $this->account_login_status; |
219 | 219 | } |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | |
224 | 224 | // TODO - Проверять уровень доступа аккаунта! |
225 | 225 | // Аккаунты с АУТЛЕВЕЛ больше 0 - НЕ СБРАСЫВАЮТ ПАРОЛИ! |
226 | - foreach($user_list as $user_id => $user_data) { |
|
227 | - if($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) { |
|
226 | + foreach ($user_list as $user_id => $user_data) { |
|
227 | + if ($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) { |
|
228 | 228 | throw new Exception(PASSWORD_RESTORE_ERROR_ADMIN_ACCOUNT, ERR_ERROR); |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | $confirmation = $this->confirmation->db_confirmation_get_latest_by_type_and_email(CONFIRM_PASSWORD_RESET, $email_unsafe); // OK 4.5 |
233 | - if(isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) { |
|
233 | + if (isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) { |
|
234 | 234 | throw new Exception(PASSWORD_RESTORE_ERROR_TOO_OFTEN, ERR_ERROR); |
235 | 235 | } |
236 | 236 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ); |
248 | 248 | |
249 | 249 | $result = $result ? PASSWORD_RESTORE_SUCCESS_CODE_SENT : PASSWORD_RESTORE_ERROR_SENDING; |
250 | - } catch(Exception $e) { |
|
250 | + } catch (Exception $e) { |
|
251 | 251 | sn_db_transaction_rollback(); |
252 | 252 | $result = $e->getMessage(); |
253 | 253 | } |
@@ -262,46 +262,46 @@ discard block |
||
262 | 262 | protected function password_reset_confirm() { |
263 | 263 | global $lang, $config; |
264 | 264 | |
265 | - if(!$this->is_password_reset_confirm) { |
|
265 | + if (!$this->is_password_reset_confirm) { |
|
266 | 266 | return $this->account_login_status; |
267 | 267 | } |
268 | 268 | |
269 | - if($this->account_login_status != LOGIN_UNDEFINED) { |
|
269 | + if ($this->account_login_status != LOGIN_UNDEFINED) { |
|
270 | 270 | return $this->account_login_status; |
271 | 271 | } |
272 | 272 | |
273 | 273 | // Проверяем поддержку сброса пароля |
274 | - if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
274 | + if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) { |
|
275 | 275 | return $this->account_login_status; |
276 | 276 | } |
277 | 277 | |
278 | 278 | try { |
279 | 279 | $code_unsafe = sys_get_param_str_unsafe('password_reset_code'); |
280 | - if(empty($code_unsafe)) { |
|
280 | + if (empty($code_unsafe)) { |
|
281 | 281 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_EMPTY, ERR_ERROR); |
282 | 282 | } |
283 | 283 | |
284 | 284 | sn_db_transaction_start(); |
285 | 285 | $confirmation = $this->confirmation->db_confirmation_get_by_type_and_code(CONFIRM_PASSWORD_RESET, $code_unsafe); // OK 4.5 |
286 | 286 | |
287 | - if(empty($confirmation)) { |
|
287 | + if (empty($confirmation)) { |
|
288 | 288 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_WRONG, ERR_ERROR); |
289 | 289 | } |
290 | 290 | |
291 | - if(SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) { |
|
291 | + if (SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) { |
|
292 | 292 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_TOO_OLD, ERR_ERROR); |
293 | 293 | } |
294 | 294 | |
295 | 295 | unset($this->account); |
296 | 296 | $this->account = new Account($this->db); |
297 | 297 | |
298 | - if(!$this->account->db_get_by_email($confirmation['email'])) { |
|
298 | + if (!$this->account->db_get_by_email($confirmation['email'])) { |
|
299 | 299 | throw new Exception(PASSWORD_RESTORE_ERROR_CODE_OK_BUT_NO_ACCOUNT_FOR_EMAIL, ERR_ERROR); |
300 | 300 | } |
301 | 301 | |
302 | 302 | $new_password_unsafe = $this->make_random_password(); |
303 | 303 | $salt_unsafe = $this->password_salt_generate(); |
304 | - if(!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) { |
|
304 | + if (!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) { |
|
305 | 305 | // Ошибка смены пароля |
306 | 306 | throw new Exception(AUTH_ERROR_INTERNAL_PASSWORD_CHANGE_ON_RESTORE, ERR_ERROR); |
307 | 307 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $this->cookie_set(); |
312 | 312 | $this->login_cookie(); |
313 | 313 | |
314 | - if($this->account_login_status == LOGIN_SUCCESS) { |
|
314 | + if ($this->account_login_status == LOGIN_SUCCESS) { |
|
315 | 315 | // TODO - НЕ ОБЯЗАТЕЛЬНО ОТПРАВЛЯТЬ ЧЕРЕЗ ЕМЕЙЛ! ЕСЛИ ЭТО ФЕЙСБУЧЕК ИЛИ ВКШЕЧКА - МОЖНО ЧЕРЕЗ ЛС ПИСАТЬ!! |
316 | 316 | $message_header = sprintf($lang['log_lost_email_title'], $config->game_name); |
317 | 317 | $message = sprintf($lang['log_lost_email_pass'], $config->game_name, $this->account->account_name, $new_password_unsafe); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | // $users_translated = classSupernova::$auth->db_translate_get_users_from_account_list($this->provider_id, $this->account->account_id); // OK 4.5 |
321 | 321 | $users_translated = PlayerToAccountTranslate::db_translate_get_users_from_account_list($this->provider_id, $this->account->account_id); // OK 4.5 |
322 | - if(!empty($users_translated)) { |
|
322 | + if (!empty($users_translated)) { |
|
323 | 323 | // Отправляем в лички письмо о сбросе пароля |
324 | 324 | |
325 | 325 | // ПО ОПРЕДЕЛЕНИЮ в $users_translated только |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $message = HelperString::nl2br($message) . '<br><br>'; |
332 | 332 | // msg_send_simple_message($found_provider->data[F_USER_ID], 0, SN_TIME_NOW, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['sys_login_register_message_title'], $message); |
333 | 333 | |
334 | - foreach($users_translated as $user_id => $providers_list) { |
|
334 | + foreach ($users_translated as $user_id => $providers_list) { |
|
335 | 335 | msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['sys_login_register_message_title'], $message); |
336 | 336 | } |
337 | 337 | } else { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->flog('Регистрация: начинаем. Провайдер ' . $this->provider_id); |
385 | 385 | |
386 | 386 | try { |
387 | - if(!$this->is_register) { |
|
387 | + if (!$this->is_register) { |
|
388 | 388 | $this->flog('Регистрация: не выставлен флаг регистрации - пропускаем'); |
389 | 389 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
390 | 390 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | // $this->account_check_duplicate_name_or_email($this->input_login_unsafe, $this->input_email_unsafe); |
397 | 397 | |
398 | 398 | $this->account->db_get_by_name_or_email($this->input_login_unsafe, $this->input_email_unsafe); |
399 | - if($this->account->is_exists) { |
|
400 | - if($this->account->account_email == $this->input_email_unsafe) { |
|
399 | + if ($this->account->is_exists) { |
|
400 | + if ($this->account->account_email == $this->input_email_unsafe) { |
|
401 | 401 | throw new Exception(REGISTER_ERROR_EMAIL_EXISTS, ERR_ERROR); |
402 | 402 | } else { |
403 | 403 | throw new Exception(REGISTER_ERROR_ACCOUNT_NAME_EXISTS, ERR_ERROR); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | // А вот это пока не нужно. Трансляцией аккаунтов в юзеров и созданием новых юзеров для новозашедших аккаунтов занимается Auth |
437 | 437 | // $this->register_account(); |
438 | 438 | sn_db_transaction_commit(); |
439 | - } catch(Exception $e) { |
|
439 | + } catch (Exception $e) { |
|
440 | 440 | sn_db_transaction_rollback(); |
441 | 441 | $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false; |
442 | 442 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @return int Результат попытки |
452 | 452 | */ |
453 | 453 | protected function login_cookie() { |
454 | - if($this->account_login_status != LOGIN_UNDEFINED) { |
|
454 | + if ($this->account_login_status != LOGIN_UNDEFINED) { |
|
455 | 455 | return $this->account_login_status; |
456 | 456 | } |
457 | 457 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | // $this->cookie_clear(); |
478 | 478 | // } |
479 | 479 | |
480 | - if($this->account->cookieLogin($rememberMe)) { |
|
480 | + if ($this->account->cookieLogin($rememberMe)) { |
|
481 | 481 | $this->account_login_status = LOGIN_SUCCESS; |
482 | 482 | $this->remember_me = intval($rememberMe); |
483 | 483 | } |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | protected function login_username() { |
495 | 495 | // TODO - Логин по старым именам |
496 | 496 | try { |
497 | - if(!$this->is_login) { |
|
497 | + if (!$this->is_login) { |
|
498 | 498 | $this->flog('Логин: не выставлен флаг входа в игру - это не логин'); |
499 | 499 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
500 | 500 | } |
501 | 501 | |
502 | 502 | // TODO Пустое имя аккаунта |
503 | - if(!$this->input_login_unsafe) { |
|
503 | + if (!$this->input_login_unsafe) { |
|
504 | 504 | throw new Exception(LOGIN_UNDEFINED, ERR_ERROR); |
505 | 505 | } |
506 | 506 | |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | // if(empty($account)) { |
511 | 511 | // throw new Exception(LOGIN_ERROR_USERNAME, ERR_ERROR); |
512 | 512 | // } |
513 | - if(!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) { |
|
513 | + if (!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) { |
|
514 | 514 | throw new Exception(LOGIN_ERROR_USERNAME, ERR_ERROR); |
515 | 515 | } |
516 | 516 | |
517 | - if(!$this->account->password_check($this->input_login_password_raw)) { |
|
517 | + if (!$this->account->password_check($this->input_login_password_raw)) { |
|
518 | 518 | throw new Exception(LOGIN_ERROR_PASSWORD, ERR_ERROR); |
519 | 519 | } |
520 | 520 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | $this->cookie_set(); |
524 | 524 | $this->account_login_status = LOGIN_SUCCESS; |
525 | - } catch(Exception $e) { |
|
525 | + } catch (Exception $e) { |
|
526 | 526 | $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false; |
527 | 527 | } |
528 | 528 | |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | protected function cookie_set($account_to_impersonate = null) { |
544 | 544 | $this_account = is_object($account_to_impersonate) ? $account_to_impersonate : $this->account; |
545 | 545 | |
546 | - if(!is_object($this_account) || !$this_account->is_exists) { |
|
546 | + if (!is_object($this_account) || !$this_account->is_exists) { |
|
547 | 547 | throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR); |
548 | 548 | } |
549 | 549 | |
550 | - if(is_object($account_to_impersonate) && $account_to_impersonate->is_exists) { |
|
550 | + if (is_object($account_to_impersonate) && $account_to_impersonate->is_exists) { |
|
551 | 551 | sn_setcookie($this->cookie_name_impersonate, $_COOKIE[$this->cookie_name], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain); |
552 | 552 | } |
553 | 553 | |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | protected function login_validate_input() { |
585 | 585 | // Проверяем, что бы в начале и конце не было пустых символов |
586 | 586 | // TODO - при копировании Эксель -> Опера - в конце образуются пустые места. Это не должно быть проблемой! Вынести проверку пароля в регистрацию! |
587 | - if($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
587 | + if ($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
588 | 588 | throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR); |
589 | 589 | } |
590 | - if(!$this->input_login_password_raw) { |
|
590 | + if (!$this->input_login_password_raw) { |
|
591 | 591 | throw new Exception(LOGIN_ERROR_PASSWORD_EMPTY, ERR_ERROR); |
592 | 592 | } |
593 | 593 | } |
@@ -602,37 +602,37 @@ discard block |
||
602 | 602 | $this->login_validate_input(); |
603 | 603 | |
604 | 604 | // Если нет имени пользователя - NO GO! |
605 | - if(!$this->input_login_unsafe) { |
|
605 | + if (!$this->input_login_unsafe) { |
|
606 | 606 | throw new Exception(LOGIN_ERROR_USERNAME_EMPTY, ERR_ERROR); |
607 | 607 | } |
608 | 608 | // Если логин имеет запрещенные символы - NO GO! |
609 | - if(strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
609 | + if (strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
610 | 610 | throw new Exception(LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS, ERR_ERROR); |
611 | 611 | } |
612 | 612 | // Если логин меньше минимальной длины - NO GO! |
613 | - if(strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) { |
|
613 | + if (strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) { |
|
614 | 614 | throw new Exception(REGISTER_ERROR_USERNAME_SHORT, ERR_ERROR); |
615 | 615 | } |
616 | 616 | // Если пароль меньше минимальной длины - NO GO! |
617 | - if(strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) { |
|
617 | + if (strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) { |
|
618 | 618 | throw new Exception(REGISTER_ERROR_PASSWORD_INSECURE, ERR_ERROR); |
619 | 619 | } |
620 | 620 | // Если пароль имеет пробельные символы в начале или конце - NO GO! |
621 | - if($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
621 | + if ($this->input_login_password_raw != trim($this->input_login_password_raw)) { |
|
622 | 622 | throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR); |
623 | 623 | } |
624 | 624 | // Если пароль не совпадает с подтверждением - NO GO! То, что у пароля нет пробельных символов в начале/конце - мы уже проверили выше |
625 | 625 | //Если они есть у повтора - значит пароль и повтор не совпадут |
626 | - if($this->input_login_password_raw <> $this->input_login_password_raw_repeat) { |
|
626 | + if ($this->input_login_password_raw <> $this->input_login_password_raw_repeat) { |
|
627 | 627 | throw new Exception(REGISTER_ERROR_PASSWORD_DIFFERENT, ERR_ERROR); |
628 | 628 | } |
629 | 629 | // Если нет емейла - NO GO! |
630 | 630 | // TODO - регистрация без емейла |
631 | - if(!$this->input_email_unsafe) { |
|
631 | + if (!$this->input_email_unsafe) { |
|
632 | 632 | throw new Exception(REGISTER_ERROR_EMAIL_EMPTY, ERR_ERROR); |
633 | 633 | } |
634 | 634 | // Если емейл не является емейлом - NO GO! |
635 | - if(!is_email($this->input_email_unsafe)) { |
|
635 | + if (!is_email($this->input_email_unsafe)) { |
|
636 | 636 | throw new Exception(REGISTER_ERROR_EMAIL_WRONG, ERR_ERROR); |
637 | 637 | } |
638 | 638 | } |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | return core_auth::make_random_password(); |
664 | 664 | } |
665 | 665 | protected function flog($message, $die = false) { |
666 | - if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
666 | + if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) { |
|
667 | 667 | return; |
668 | 668 | } |
669 | 669 | list($called, $caller) = debug_backtrace(false); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false; |
678 | 678 | |
679 | 679 | classSupernova::log_file("$message - $caller_name"); |
680 | - if($die) { |
|
680 | + if ($die) { |
|
681 | 681 | $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>"); |
682 | 682 | } |
683 | 683 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function toArray() { |
45 | 45 | $tutorial = array(); |
46 | - foreach($this->keys() as $key) { |
|
46 | + foreach ($this->keys() as $key) { |
|
47 | 47 | $tutorial[$key] = $this->$key; |
48 | 48 | } |
49 | 49 |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | public static function db_changeset_prepare_unit($unit_id, $unit_value, $user, $planet_id = null) |
18 | 18 | { |
19 | - if(!is_array($user)) |
|
19 | + if (!is_array($user)) |
|
20 | 20 | { |
21 | 21 | // TODO - remove later |
22 | 22 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER is not ARRAY</h1>'); |
23 | 23 | pdump(debug_backtrace()); |
24 | 24 | die('USER is not ARRAY'); |
25 | 25 | } |
26 | - if(!isset($user['id']) || !$user['id']) |
|
26 | + if (!isset($user['id']) || !$user['id']) |
|
27 | 27 | { |
28 | 28 | // TODO - remove later |
29 | 29 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: OldDbChangeSet::db_changeset_prepare_unit() - USER[id] пустой</h1>'); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $location_id = $location_id ? $location_id : 'NULL'; |
39 | 39 | |
40 | 40 | $temp = DBStaticUnit::db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id'); |
41 | - if($temp['unit_id']) |
|
41 | + if ($temp['unit_id']) |
|
42 | 42 | { |
43 | 43 | $db_changeset = array( |
44 | 44 | 'action' => SQL_OP_UPDATE, |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | public static function db_changeset_condition_compile(&$conditions, &$table_name = '') { |
87 | - if(!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) { |
|
87 | + if (!$conditions[P_LOCATION] || $conditions[P_LOCATION] == LOC_NONE) { |
|
88 | 88 | $conditions[P_LOCATION] = LOC_NONE; |
89 | - switch($table_name) { |
|
89 | + switch ($table_name) { |
|
90 | 90 | case 'users': |
91 | 91 | case LOC_USER: |
92 | 92 | $conditions[P_TABLE_NAME] = $table_name = 'users'; |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $conditions[P_FIELDS_STR] = ''; |
111 | - if($conditions['fields']) { |
|
111 | + if ($conditions['fields']) { |
|
112 | 112 | $fields = array(); |
113 | - foreach($conditions['fields'] as $field_name => $field_data) { |
|
113 | + foreach ($conditions['fields'] as $field_name => $field_data) { |
|
114 | 114 | $condition = "`{$field_name}` = "; |
115 | 115 | $value = ''; |
116 | - if($field_data['delta']) { |
|
116 | + if ($field_data['delta']) { |
|
117 | 117 | $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
118 | - } elseif($field_data['set']) { |
|
119 | - $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']); |
|
118 | + } elseif ($field_data['set']) { |
|
119 | + $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
|
120 | 120 | } |
121 | 121 | |
122 | - if($value) { |
|
122 | + if ($value) { |
|
123 | 123 | $fields[] = $condition . $value; |
124 | 124 | } |
125 | 125 | } |
@@ -127,16 +127,14 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $conditions[P_WHERE_STR] = ''; |
130 | - if(!empty($conditions['where'])) { |
|
131 | - if($conditions[P_VERSION] == 1) { |
|
130 | + if (!empty($conditions['where'])) { |
|
131 | + if ($conditions[P_VERSION] == 1) { |
|
132 | 132 | $the_conditions = array(); |
133 | - foreach($conditions['where'] as $field_id => $field_value) { |
|
133 | + foreach ($conditions['where'] as $field_id => $field_value) { |
|
134 | 134 | // Простое условие - $field_id = $field_value |
135 | - if(is_string($field_id)) { |
|
135 | + if (is_string($field_id)) { |
|
136 | 136 | $field_value = |
137 | - $field_value === null ? 'NULL' : |
|
138 | - (is_string($field_value) ? "'" . db_escape($field_value) . "'" : |
|
139 | - (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
137 | + $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
140 | 138 | $the_conditions[] = "`{$field_id}` = {$field_value}"; |
141 | 139 | } else { |
142 | 140 | die('Неподдерживаемый тип условия'); |
@@ -148,7 +146,7 @@ discard block |
||
148 | 146 | $conditions[P_WHERE_STR] = implode(' AND ', $the_conditions); |
149 | 147 | } |
150 | 148 | |
151 | - switch($conditions['action']) { |
|
149 | + switch ($conditions['action']) { |
|
152 | 150 | case SQL_OP_DELETE: $conditions[P_ACTION_STR] = ("DELETE FROM {{{$table_name}}}"); break; |
153 | 151 | case SQL_OP_UPDATE: $conditions[P_ACTION_STR] = ("UPDATE {{{$table_name}}} SET"); break; |
154 | 152 | case SQL_OP_INSERT: $conditions[P_ACTION_STR] = ("INSERT INTO {{{$table_name}}} SET"); break; |
@@ -161,17 +159,17 @@ discard block |
||
161 | 159 | |
162 | 160 | public static function db_changeset_apply($db_changeset) { |
163 | 161 | $result = true; |
164 | - if(!is_array($db_changeset) || empty($db_changeset)) return $result; |
|
162 | + if (!is_array($db_changeset) || empty($db_changeset)) return $result; |
|
165 | 163 | |
166 | - foreach($db_changeset as $table_name => &$table_data) { |
|
167 | - foreach($table_data as $record_id => &$conditions) { |
|
164 | + foreach ($db_changeset as $table_name => &$table_data) { |
|
165 | + foreach ($table_data as $record_id => &$conditions) { |
|
168 | 166 | OldDbChangeSet::db_changeset_condition_compile($conditions, $table_name); |
169 | 167 | |
170 | - if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue; |
|
171 | - if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице |
|
168 | + if ($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue; |
|
169 | + if ($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице |
|
172 | 170 | |
173 | - if($conditions[P_LOCATION] != LOC_NONE) { |
|
174 | - switch($conditions['action']) |
|
171 | + if ($conditions[P_LOCATION] != LOC_NONE) { |
|
172 | + switch ($conditions['action']) |
|
175 | 173 | { |
176 | 174 | case SQL_OP_DELETE: $result = classSupernova::db_del_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR]) && $result; break; |
177 | 175 | case SQL_OP_UPDATE: $result = classSupernova::db_upd_record_list($conditions[P_LOCATION], $conditions[P_WHERE_STR], $conditions[P_FIELDS_STR]) && $result; break; |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if(!empty($_POST['return']) && is_array($_POST['return'])) { |
|
6 | - foreach($_POST['return'] as $fleet_id) { |
|
7 | - if($fleet_id = idval($fleet_id)) { |
|
5 | +if (!empty($_POST['return']) && is_array($_POST['return'])) { |
|
6 | + foreach ($_POST['return'] as $fleet_id) { |
|
7 | + if ($fleet_id = idval($fleet_id)) { |
|
8 | 8 | sn_db_transaction_start(); |
9 | 9 | $FleetRow = db_fleet_get($fleet_id); |
10 | 10 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | lng_include('overview'); |
24 | 24 | lng_include('fleet'); |
25 | 25 | |
26 | -if(!$planetrow) { |
|
26 | +if (!$planetrow) { |
|
27 | 27 | message($lang['fl_noplanetrow'], $lang['fl_error']); |
28 | 28 | } |
29 | 29 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | $i = 0; |
33 | 33 | $fleet_list = fleet_list_by_owner_id($user['id']); |
34 | -foreach($fleet_list as $fleet_id => $fleet_row) { |
|
34 | +foreach ($fleet_list as $fleet_id => $fleet_row) { |
|
35 | 35 | $i++; |
36 | 36 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
37 | 37 | |
38 | 38 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
39 | 39 | |
40 | - foreach($fleet_data['ships'] as $ship_data) { |
|
40 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
41 | 41 | $template->assign_block_vars('fleets.ships', $ship_data); |
42 | 42 | } |
43 | 43 | } |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
8 | 8 | |
9 | 9 | $unit_id = sys_get_param_id('gid'); |
10 | -if($unit_id == RES_DARK_MATTER) { |
|
10 | +if ($unit_id == RES_DARK_MATTER) { |
|
11 | 11 | sys_redirect('dark_matter.php'); |
12 | 12 | } |
13 | 13 | |
14 | -if($unit_id == RES_METAMATTER) { |
|
14 | +if ($unit_id == RES_METAMATTER) { |
|
15 | 15 | sys_redirect('metamatter.php'); |
16 | 16 | } |
17 | 17 | |
18 | 18 | lng_include('infos'); |
19 | -if(!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
19 | +if (!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
20 | 20 | sys_redirect('index.php?page=techtree'); |
21 | 21 | } |
22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $unit_data = get_unit_param($unit_id); |
26 | 26 | $unit_type = $unit_data['type']; |
27 | 27 | |
28 | -if($unit_type == UNIT_SHIPS) { |
|
28 | +if ($unit_type == UNIT_SHIPS) { |
|
29 | 29 | $template_result['UNIT_IS_SHIP'] = true; |
30 | 30 | |
31 | 31 | $ship_data = get_ship_data($unit_id, $user); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | |
43 | 43 | $engine_template_info = array(); |
44 | - foreach($unit_data['engine'] as $unit_engine_data) { |
|
44 | + foreach ($unit_data['engine'] as $unit_engine_data) { |
|
45 | 45 | $unit_engine_data = get_engine_data($user, $unit_engine_data); |
46 | 46 | |
47 | 47 | $engine_template_info[] = array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | |
62 | 62 | $sn_data_group_combat = sn_get_groups('combat'); |
63 | -if(in_array($unit_id, $sn_data_group_combat)) { |
|
63 | +if (in_array($unit_id, $sn_data_group_combat)) { |
|
64 | 64 | $template_result['UNIT_IS_COMBAT'] = true; |
65 | 65 | |
66 | 66 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | $volley_arr = $rapid_to = $rapid_from = array(); |
69 | 69 | $str_rapid_from = ''; |
70 | 70 | $str_rapid_to = ''; |
71 | - foreach($sn_data_group_combat as $enemy_id) { |
|
71 | + foreach ($sn_data_group_combat as $enemy_id) { |
|
72 | 72 | $enemy_data = get_unit_param($enemy_id); |
73 | 73 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
74 | 74 | |
75 | 75 | $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability; |
76 | - if($rapid >= 1) { |
|
76 | + if ($rapid >= 1) { |
|
77 | 77 | $volley_arr[$enemy_id]['TO'] = floor($rapid); |
78 | 78 | } |
79 | 79 | |
80 | 80 | $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability; |
81 | - if($rapid >= 1) { |
|
81 | + if ($rapid >= 1) { |
|
82 | 82 | $volley_arr[$enemy_id]['FROM'] = floor($rapid); |
83 | 83 | } |
84 | 84 | } |
85 | - foreach($volley_arr as $enemy_id => &$rapid) { |
|
85 | + foreach ($volley_arr as $enemy_id => &$rapid) { |
|
86 | 86 | $rapid['ENEMY_ID'] = $enemy_id; |
87 | 87 | $rapid['ENEMY_NAME'] = $lang['tech'][$enemy_id]; |
88 | 88 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | -if($lang['info'][$unit_id]['effect']) { |
|
103 | +if ($lang['info'][$unit_id]['effect']) { |
|
104 | 104 | $template_result['UNIT_EFFECT'] = $lang['info'][$unit_id]['effect']; |
105 | 105 | } |
106 | 106 | |
107 | -if($unit_data['bonus']) { |
|
107 | +if ($unit_data['bonus']) { |
|
108 | 108 | $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : ( |
109 | 109 | ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '') |
110 | 110 | ); |
@@ -14,39 +14,39 @@ discard block |
||
14 | 14 | |
15 | 15 | lng_include('fleet'); |
16 | 16 | |
17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
18 | 18 | { |
19 | 19 | sn_db_transaction_start(); |
20 | 20 | db_user_by_id($user['id'], true, 'id'); |
21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
23 | 23 | { |
24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
26 | 26 | { |
27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
28 | - if(!$NextDestTime) |
|
27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
28 | + if (!$NextDestTime) |
|
29 | 29 | { |
30 | 30 | // $SubQueryOri = ""; |
31 | 31 | // $SubQueryDes = ""; |
32 | 32 | $ship_list = sys_get_param('ships'); |
33 | 33 | $db_changeset = array(); |
34 | - foreach($ship_list as $ship_id => $ship_count) |
|
34 | + foreach ($ship_list as $ship_id => $ship_count) |
|
35 | 35 | { |
36 | - if(!in_array($ship_id, sn_get_groups('fleet'))) |
|
36 | + if (!in_array($ship_id, sn_get_groups('fleet'))) |
|
37 | 37 | { |
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | 41 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
42 | - if($ship_count) |
|
42 | + if ($ship_count) |
|
43 | 43 | { |
44 | 44 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']); |
45 | 45 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | // Dit monsieur, y avait quelque chose a envoyer ??? |
49 | - if(!empty($db_changeset)) |
|
49 | + if (!empty($db_changeset)) |
|
50 | 50 | { |
51 | 51 | DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
52 | 52 | DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'"); |
56 | 56 | |
57 | 57 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
58 | - $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
58 | + $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow)); |
|
59 | 59 | } else { |
60 | 60 | $RetMessage = $lang['gate_wait_data']; |
61 | 61 | } |
62 | 62 | } else { |
63 | - $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
63 | + $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | 66 | $RetMessage = $lang['gate_no_dest_g']; |
67 | 67 | } |
68 | 68 | } else { |
69 | - $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
69 | + $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime); |
|
70 | 70 | } |
71 | 71 | sn_db_transaction_commit(); |
72 | 72 | message($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
73 | 73 | } else { |
74 | 74 | $template = gettemplate('jumpgate', true); |
75 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
75 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
76 | 76 | { |
77 | 77 | $Combo = ''; |
78 | 78 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
79 | 79 | // while($CurMoon = db_fetch($MoonList)) |
80 | - foreach($MoonList as $CurMoon) |
|
80 | + foreach ($MoonList as $CurMoon) |
|
81 | 81 | { |
82 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
82 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
83 | 83 | { |
84 | 84 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
85 | 85 | $template->assign_block_vars('moon', array( |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - foreach(sn_get_groups('fleet') as $Ship) |
|
96 | + foreach (sn_get_groups('fleet') as $Ship) |
|
97 | 97 | { |
98 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
98 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
99 | 99 | { |
100 | 100 | continue; |
101 | 101 | } |