@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @inheritdoc |
90 | 90 | */ |
91 | 91 | public function update() { |
92 | - if($this->getShipCount() < 1) { |
|
92 | + if ($this->getShipCount() < 1) { |
|
93 | 93 | return $this->delete(); |
94 | 94 | } else { |
95 | 95 | return parent::update(); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | |
154 | 154 | $shipCount = floor($shipCount); |
155 | 155 | |
156 | - if($this->shipList[$shipSnId] + $shipCount < 0) { |
|
156 | + if ($this->shipList[$shipSnId] + $shipCount < 0) { |
|
157 | 157 | throw new \Exception("Trying to deduct more ships [{$shipSnId}] '{$shipCount}' when fleet [{$this->id}] has only {$this->shipList[$shipSnId]}"); |
158 | 158 | } |
159 | 159 | |
160 | 160 | $this->shipList[$shipSnId] += $shipCount; |
161 | - if($this->shipList[$shipSnId] < 1) { |
|
161 | + if ($this->shipList[$shipSnId] < 1) { |
|
162 | 162 | unset($this->shipList[$shipSnId]); |
163 | 163 | } |
164 | 164 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $resourceCount = ceil($resourceCount); |
185 | 185 | |
186 | - if($this->resources[$resourceId] + $resourceCount < 0) { |
|
186 | + if ($this->resources[$resourceId] + $resourceCount < 0) { |
|
187 | 187 | throw new \Exception("FLEET ERROR! Trying to deduct more resources [{$resourceId}] '{$resourceCount}' when fleet [{$this->id}] has only {$this->resources[$resourceId]}"); |
188 | 188 | } |
189 | 189 |
@@ -379,7 +379,7 @@ |
||
379 | 379 | public function dbLoadRecord($id) { |
380 | 380 | $result = parent::dbLoadRecord($id); |
381 | 381 | |
382 | - if(!$this->isNew()) { |
|
382 | + if (!$this->isNew()) { |
|
383 | 383 | $this->resources[RES_METAL] = $this->_getContainer()->metal; |
384 | 384 | $this->resources[RES_CRYSTAL] = $this->_getContainer()->crystal; |
385 | 385 | $this->resources[RES_DEUTERIUM] = $this->_getContainer()->deuterium; |
@@ -426,8 +426,8 @@ |
||
426 | 426 | protected function getTravelData() { |
427 | 427 | $travel_data = flt_travel_data( |
428 | 428 | $this->getFleetOwnerRecord(), |
429 | - ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet,], |
|
430 | - ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet,], |
|
429 | + ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet, ], |
|
430 | + ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet, ], |
|
431 | 431 | $this->getShipListArray(), |
432 | 432 | $this->speedPercentTenth |
433 | 433 | ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $this->secret_word = SN::$sn_secret_word; |
93 | 93 | |
94 | 94 | $snTableNames = $this->db->schema()->getSnTables(); |
95 | - foreach($this->table_check as $table_name) { |
|
96 | - if(empty($snTableNames[$table_name])) { |
|
95 | + foreach ($this->table_check as $table_name) { |
|
96 | + if (empty($snTableNames[$table_name])) { |
|
97 | 97 | die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br /> |
98 | 98 | В противном случае - сообщите Администрации сервера об ошибке.<br/> |
99 | 99 | Не хватает таблицы для работы системы авторизации: ' . $table_name); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | // OK v4.6 |
119 | 119 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
120 | - if(!$this->password_check($old_password_unsafe)) { |
|
120 | + if (!$this->password_check($old_password_unsafe)) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // OK v4.5 |
139 | 139 | public function assign_from_db_row($row) { |
140 | 140 | $this->reset(); |
141 | - if(empty($row) || !is_array($row)) { |
|
141 | + if (empty($row) || !is_array($row)) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | $this->account_id = $row['account_id']; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->reset(); |
204 | 204 | |
205 | 205 | $email_safe = $this->db->db_escape($email_unsafe); |
206 | - if($email_safe) { |
|
206 | + if ($email_safe) { |
|
207 | 207 | $account_row = $this->db->doQueryAndFetch("SELECT * FROM `{{account}}` WHERE LOWER(`account_email`) = LOWER('{$email_safe}') FOR UPDATE;"); |
208 | 208 | |
209 | 209 | return $this->assign_from_db_row($account_row); |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | `account_email` = LOWER('{$email_safe}'), |
284 | 284 | `account_language` = '{$language_safe}'" |
285 | 285 | ); |
286 | - if(!$result) { |
|
286 | + if (!$result) { |
|
287 | 287 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
288 | 288 | } |
289 | 289 | |
290 | - if(!($account_id = $this->db->db_insert_id())) { |
|
290 | + if (!($account_id = $this->db->db_insert_id())) { |
|
291 | 291 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
292 | 292 | } |
293 | 293 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | WHERE `account_id` = '{$account_id_safe}'" |
318 | 318 | ) ? true : false; |
319 | 319 | |
320 | - if($result) { |
|
320 | + if ($result) { |
|
321 | 321 | $result = $this->db_get_by_id($this->account_id); |
322 | 322 | } |
323 | 323 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | public function metamatter_change($change_type, $metamatter, $comment = false, $already_changed = false) { |
410 | 410 | global $debug, $mm_change_legit, $config; |
411 | 411 | |
412 | - if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
412 | + if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
413 | 413 | $debug->error('Ошибка при попытке манипуляции с ММ'); |
414 | 414 | return false; |
415 | 415 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | $mm_change_legit = true; |
420 | 420 | // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER); |
421 | - if($already_changed) { |
|
421 | + if ($already_changed) { |
|
422 | 422 | $metamatter_total_delta = 0; |
423 | 423 | $result = -1; |
424 | 424 | } else { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$config->player_metamatter_immortal} AND `account_immortal` IS NULL, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') . |
432 | 432 | " WHERE `account_id` = {$account_id_safe}" |
433 | 433 | ); |
434 | - if(!$result) { |
|
434 | + if (!$result) { |
|
435 | 435 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
436 | 436 | } |
437 | 437 | $result = SN::$db->db_affected_rows(); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $this->awardImmortal($metamatter, $config); |
440 | 440 | } |
441 | 441 | |
442 | - if(empty(core_auth::$user['id'])) { |
|
442 | + if (empty(core_auth::$user['id'])) { |
|
443 | 443 | $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id); |
444 | 444 | reset($user_list); |
445 | 445 | $user_id_unsafe = key($user_list); |
@@ -448,30 +448,30 @@ discard block |
||
448 | 448 | } |
449 | 449 | $user_id_safe = $this->db->db_escape($user_id_unsafe); |
450 | 450 | |
451 | - if(!$result) { |
|
451 | + if (!$result) { |
|
452 | 452 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
453 | 453 | } |
454 | 454 | |
455 | - if(!$already_changed) { |
|
455 | + if (!$already_changed) { |
|
456 | 456 | $this->account_metamatter += $metamatter; |
457 | 457 | $this->account_metamatter_total += $metamatter_total_delta; |
458 | 458 | } |
459 | 459 | |
460 | - if(is_array($comment)) { |
|
460 | + if (is_array($comment)) { |
|
461 | 461 | $comment = call_user_func_array('sprintf', $comment); |
462 | 462 | } |
463 | 463 | |
464 | 464 | $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe); |
465 | 465 | |
466 | - if($metamatter > 0 && !empty($user_id_safe)) { |
|
466 | + if ($metamatter > 0 && !empty($user_id_safe)) { |
|
467 | 467 | $old_referral = doquery("SELECT * FROM `{{referrals}}` WHERE `id` = {$user_id_safe} LIMIT 1 FOR UPDATE;", '', true); |
468 | - if($old_referral['id']) { |
|
468 | + if ($old_referral['id']) { |
|
469 | 469 | $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM; |
470 | 470 | doquery("UPDATE `{{referrals}}` SET dark_matter = dark_matter + '{$dark_matter_from_metamatter}' WHERE `id` = {$user_id_safe} LIMIT 1;"); |
471 | 471 | $new_referral = doquery("SELECT * FROM `{{referrals}}` WHERE `id` = {$user_id_safe} LIMIT 1;", '', true); |
472 | 472 | |
473 | 473 | $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0); |
474 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
474 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
475 | 475 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}"); |
476 | 476 | } |
477 | 477 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @throws Exception |
488 | 488 | */ |
489 | 489 | public function cookieSet($rememberMe = false, $domain = null) { |
490 | - if(!$this->is_exists) { |
|
490 | + if (!$this->is_exists) { |
|
491 | 491 | throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR); |
492 | 492 | } |
493 | 493 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | // OK v4.1 |
507 | 507 | public function cookieClear($domain = null) { |
508 | 508 | // Автоматически вообще-то - если установлена кука имперсонатора - то чистим обычную, а куку имперсонатора - копируем в неё |
509 | - if(!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
509 | + if (!empty($_COOKIE[$this->cookie_name_impersonate])) { |
|
510 | 510 | sn_setcookie($this->cookie_name, $_COOKIE[$this->cookie_name_impersonate], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $domain); |
511 | 511 | sn_setcookie($this->cookie_name_impersonate, '', SN_TIME_NOW - PERIOD_WEEK, $this->sn_root_path, $domain); |
512 | 512 | } else { |
@@ -516,14 +516,14 @@ discard block |
||
516 | 516 | |
517 | 517 | public function cookieLogin(&$rememberMe = false) { |
518 | 518 | // Пытаемся войти по куке |
519 | - if(!empty($_COOKIE[$this->cookie_name])) { |
|
520 | - if(count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
519 | + if (!empty($_COOKIE[$this->cookie_name])) { |
|
520 | + if (count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) { |
|
521 | 521 | list($account_id_unsafe, $cookie_password_hash_salted, $user_remember_me) = explode(AUTH_COOKIE_DELIMETER, $_COOKIE[$this->cookie_name]); |
522 | 522 | } else { |
523 | 523 | list($account_id_unsafe, $user_name, $cookie_password_hash_salted, $user_remember_me) = explode("/%/", $_COOKIE[$this->cookie_name]); |
524 | 524 | } |
525 | 525 | |
526 | - if( |
|
526 | + if ( |
|
527 | 527 | $this->db_get_by_id($account_id_unsafe) |
528 | 528 | && ($this->password_encode_for_cookie($this->account_password) == $cookie_password_hash_salted) |
529 | 529 | ) { |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | * @param classConfig $config |
549 | 549 | */ |
550 | 550 | protected function awardImmortal($metamatter, $config) { |
551 | - if(!is_object($awardModule = moduleAward())) { |
|
551 | + if (!is_object($awardModule = moduleAward())) { |
|
552 | 552 | return; |
553 | 553 | } |
554 | - if ($this->account_metamatter + $metamatter >= $config->player_metamatter_immortal ) { |
|
554 | + if ($this->account_metamatter + $metamatter >= $config->player_metamatter_immortal) { |
|
555 | 555 | $account_translation = PlayerToAccountTranslate::db_translate_get_users_from_account_list(ACCOUNT_PROVIDER_LOCAL, $this->account_id); |
556 | 556 | if (!empty($account_translation)) { |
557 | 557 | reset($account_translation); |
@@ -573,10 +573,10 @@ discard block |
||
573 | 573 | * @return bool|mysqli_result|null |
574 | 574 | */ |
575 | 575 | public function getMetamatterSum($where = '', $group = '') { |
576 | - if(is_array($where) && !empty($where)) { |
|
576 | + if (is_array($where) && !empty($where)) { |
|
577 | 577 | $where = implode(' AND ', $where); |
578 | 578 | } |
579 | - if(is_array($group) && !empty($group)) { |
|
579 | + if (is_array($group) && !empty($group)) { |
|
580 | 580 | $group = implode(',', $group); |
581 | 581 | } |
582 | 582 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | // $logRecord->browserId . '_' . |
168 | 168 | // $logRecord->ip . '_' . |
169 | 169 | // $logRecord->proxies; |
170 | - return $logRecord->userId . '_' . $logRecord->playerEntryId; |
|
170 | + return $logRecord->userId . '_' . $logRecord->playerEntryId; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | protected static $is_init = false; |
22 | 22 | |
23 | 23 | protected static function init() { |
24 | - if(!empty(static::$db)) { |
|
24 | + if (!empty(static::$db)) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | static::$db = SN::$db; |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | $provider_id_safe = intval($provider_id_unsafe); |
69 | 69 | !is_array($account_list) ? $account_list = array($account_list) : false; |
70 | 70 | |
71 | - foreach($account_list as $provider_account_id_unsafe) { |
|
71 | + foreach ($account_list as $provider_account_id_unsafe) { |
|
72 | 72 | $provider_account_id_safe = intval($provider_account_id_unsafe); |
73 | 73 | |
74 | 74 | // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером |
75 | 75 | $query = static::$db->doquery( |
76 | 76 | "SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE" |
77 | 77 | ); |
78 | - while($row = static::$db->db_fetch($query)) { |
|
78 | + while ($row = static::$db->db_fetch($query)) { |
|
79 | 79 | $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true; |
80 | 80 | } |
81 | 81 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') . |
103 | 103 | "ORDER BY `timestamp` FOR UPDATE" |
104 | 104 | ); |
105 | - while($row = static::$db->db_fetch($query)) { |
|
105 | + while ($row = static::$db->db_fetch($query)) { |
|
106 | 106 | $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row; |
107 | 107 | } |
108 | 108 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $query = $this->db->doQueryAndFetch( |
54 | 54 | "SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE" |
55 | 55 | ); |
56 | - } while($query); |
|
56 | + } while ($query); |
|
57 | 57 | |
58 | 58 | $this->db->doquery( |
59 | 59 | "REPLACE INTO {{confirmations}} |
@@ -173,9 +173,9 @@ |
||
173 | 173 | */ |
174 | 174 | public function isChanged() { |
175 | 175 | return |
176 | - ! empty($this->_changes) |
|
176 | + !empty($this->_changes) |
|
177 | 177 | || |
178 | - ! empty($this->_deltas); |
|
178 | + !empty($this->_deltas); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | public function getChanges() { |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | } |
657 | 657 | |
658 | 658 | $invitedUserRecord = db_user_by_id($inv); |
659 | - if(!empty($invitedUserRecord)) { |
|
659 | + if (!empty($invitedUserRecord)) { |
|
660 | 660 | $acsPoints += $invitedUserRecord['total_points']; |
661 | 661 | } |
662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | |
674 | - if(self::acsIsAcsFull($aks['id'])) { |
|
674 | + if (self::acsIsAcsFull($aks['id'])) { |
|
675 | 675 | throw new Exception(SN::$lang['fl_aks_too_power']); |
676 | 676 | } |
677 | 677 |