@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function sys_user_vacation($user) { |
13 | 13 | global $config; |
14 | 14 | |
15 | - if(sys_get_param_str('vacation') == 'leave') { |
|
15 | + if (sys_get_param_str('vacation') == 'leave') { |
|
16 | 16 | if ($user['vacation'] < SN_TIME_NOW) { |
17 | 17 | $user['vacation'] = 0; |
18 | 18 | $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | - if($user['vacation']) { |
|
23 | + if ($user['vacation']) { |
|
24 | 24 | // sn_sys_logout(false, true); |
25 | 25 | // core_auth::logout(false, true); |
26 | 26 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert(); |
164 | 164 | $user_new = db_user_by_id(db_insert_id()); |
165 | 165 | |
166 | - if(!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
166 | + if (!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
167 | 167 | $options['galaxy'] = SN::$config->LastSettedGalaxyPos; |
168 | 168 | $options['system'] = SN::$config->LastSettedSystemPos; |
169 | 169 | $segment_size = floor(SN::$config->game_maxPlanet / 3); |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | $segment++; |
172 | 172 | $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size); |
173 | 173 | |
174 | - while(true) { |
|
175 | - if($options['planet'] > SN::$config->game_maxPlanet) { |
|
174 | + while (true) { |
|
175 | + if ($options['planet'] > SN::$config->game_maxPlanet) { |
|
176 | 176 | $options['planet'] = mt_rand(0, $segment_size - 1) + 1; |
177 | 177 | $options['system']++; |
178 | 178 | } |
179 | - if($options['system'] > SN::$config->game_maxSystem) { |
|
179 | + if ($options['system'] > SN::$config->game_maxSystem) { |
|
180 | 180 | $options['system'] = 1; |
181 | 181 | $options['galaxy']++; |
182 | 182 | } |
183 | 183 | $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false; |
184 | 184 | |
185 | 185 | $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id'); |
186 | - if(!$galaxy_row['id']) { |
|
186 | + if (!$galaxy_row['id']) { |
|
187 | 187 | SN::$config->db_saveItem(array( |
188 | 188 | 'LastSettedGalaxyPos' => $options['galaxy'], |
189 | 189 | 'LastSettedSystemPos' => $options['system'], |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $username_safe = db_escape($username_unsafe); |
205 | 205 | doquery("REPLACE INTO `{{player_name_history}}` SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'"); |
206 | 206 | |
207 | - if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
207 | + if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
208 | 208 | doquery("INSERT INTO `{{referrals}}` SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}"); |
209 | 209 | } |
210 | 210 |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | use Alliance\AllianceHelper; |
4 | 4 | use Alliance\DBStaticAlly; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | 7 | { |
8 | 8 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $template = gettemplate('ali_info', true); |
12 | 12 | |
13 | -if($mode == 'exit') |
|
13 | +if ($mode == 'exit') |
|
14 | 14 | { |
15 | 15 | if ($ally['ally_owner'] == $user['id']) |
16 | 16 | { |
@@ -27,25 +27,25 @@ discard block |
||
27 | 27 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
28 | 28 | } |
29 | 29 | } |
30 | -elseif($mode == 'ainfo') |
|
30 | +elseif ($mode == 'ainfo') |
|
31 | 31 | { |
32 | 32 | $tag = sys_get_param_str('tag'); |
33 | 33 | $id_ally = sys_get_param_id('a'); |
34 | - if($tag) |
|
34 | + if ($tag) |
|
35 | 35 | { |
36 | 36 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
37 | 37 | } |
38 | - elseif($id_ally) |
|
38 | + elseif ($id_ally) |
|
39 | 39 | { |
40 | 40 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
41 | 41 | } |
42 | 42 | |
43 | - if(!$ally) |
|
43 | + if (!$ally) |
|
44 | 44 | { |
45 | 45 | messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
46 | 46 | } |
47 | 47 | |
48 | - if(!$ally['ally_description']) |
|
48 | + if (!$ally['ally_description']) |
|
49 | 49 | { |
50 | 50 | $ally['ally_description'] = $lang['Ally_nodescription']; |
51 | 51 | } |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | 'EXTERNAL' => true, |
55 | 55 | 'USER_ALLY_ID' => $user['ally_id'], |
56 | 56 | )); |
57 | - $page_header = $lang['sys_alliance']; |
|
57 | + $page_header = $lang['sys_alliance']; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | 61 | $page_header = $lang['your_alliance']; |
62 | 62 | |
63 | - if($ally['ally_owner'] == $user['id']) |
|
63 | + if ($ally['ally_owner'] == $user['id']) |
|
64 | 64 | { |
65 | 65 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
66 | 66 | } |
67 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
67 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
68 | 68 | { |
69 | 69 | $range = $ranks[$user['ally_rank_id']]['name']; |
70 | 70 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | ]); |
100 | 100 | |
101 | 101 | $relations = ali_relations($ally['id']); |
102 | -foreach($relations as $relation) |
|
102 | +foreach ($relations as $relation) |
|
103 | 103 | { |
104 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
104 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
105 | 105 | { |
106 | 106 | $template->assign_block_vars('relation', array( |
107 | 107 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -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() { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
44 | - $query = doquery( |
|
44 | + $query = doquery( |
|
45 | 45 | "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
46 | 46 | ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
47 | 47 | ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } elseif (in_array($unitSnId, sn_get_groups(UNIT_ARTIFACTS_STR))) { |
167 | 167 | // Add artifacts to player |
168 | 168 | $result = self::dbAdd($playerId, 0, $unitSnId, $amount); |
169 | - } elseif (!empty($planetId) && in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR,]))) { |
|
169 | + } elseif (!empty($planetId) && in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, ]))) { |
|
170 | 170 | // Add fleet or defense to user's capital |
171 | 171 | $result = self::dbAdd($playerId, $planetId, $unitSnId, $amount); |
172 | 172 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) { |
193 | - if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR,]))) { |
|
193 | + if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, ]))) { |
|
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | // 'unit_level' => $level, |
224 | 224 | // ]); |
225 | 225 | |
226 | - $fields += [ |
|
226 | + $fields += [ |
|
227 | 227 | 'unit_type' => get_unit_param($unitSnId, P_UNIT_TYPE), |
228 | 228 | 'unit_level' => $amount, |
229 | 229 | ]; |
@@ -93,103 +93,103 @@ |
||
93 | 93 | |
94 | 94 | // Services -------------------------------------------------------------------------------------------------------- |
95 | 95 | // Default db |
96 | - $gc->db = function (GlobalContainer $c) { |
|
96 | + $gc->db = function(GlobalContainer $c) { |
|
97 | 97 | SN::$db = new \DBAL\db_mysql($c); |
98 | 98 | |
99 | 99 | return SN::$db; |
100 | 100 | }; |
101 | 101 | |
102 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
102 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
103 | 103 | GlobalContainer $c) { |
104 | 104 | return new \debug(); |
105 | 105 | }; |
106 | 106 | |
107 | - $gc->cache = function (GlobalContainer $gc) { |
|
107 | + $gc->cache = function(GlobalContainer $gc) { |
|
108 | 108 | return new \classCache($gc->cachePrefix); |
109 | 109 | }; |
110 | 110 | |
111 | - $gc->config = function (GlobalContainer $gc) { |
|
111 | + $gc->config = function(GlobalContainer $gc) { |
|
112 | 112 | return new \classConfig($gc->cachePrefix); |
113 | 113 | }; |
114 | 114 | |
115 | 115 | |
116 | - $gc->repository = function (GlobalContainer $gc) { |
|
116 | + $gc->repository = function(GlobalContainer $gc) { |
|
117 | 117 | return new Repository($gc); |
118 | 118 | }; |
119 | 119 | |
120 | - $gc->storage = function (GlobalContainer $gc) { |
|
120 | + $gc->storage = function(GlobalContainer $gc) { |
|
121 | 121 | return new \Storage($gc); |
122 | 122 | }; |
123 | 123 | |
124 | - $gc->repoV2 = function (GlobalContainer $gc) { |
|
124 | + $gc->repoV2 = function(GlobalContainer $gc) { |
|
125 | 125 | return new RepoV2($gc); |
126 | 126 | }; |
127 | 127 | |
128 | - $gc->storageV2 = function (GlobalContainer $gc) { |
|
128 | + $gc->storageV2 = function(GlobalContainer $gc) { |
|
129 | 129 | return new StorageV2($gc); |
130 | 130 | }; |
131 | 131 | |
132 | - $gc->storageSqlV2 = function (GlobalContainer $gc) { |
|
132 | + $gc->storageSqlV2 = function(GlobalContainer $gc) { |
|
133 | 133 | return new StorageSqlV2($gc); |
134 | 134 | }; |
135 | 135 | |
136 | - $gc->design = function (GlobalContainer $gc) { |
|
136 | + $gc->design = function(GlobalContainer $gc) { |
|
137 | 137 | return new \Design($gc); |
138 | 138 | }; |
139 | 139 | |
140 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
140 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
141 | 141 | return new \BBCodeParser($gc); |
142 | 142 | }; |
143 | 143 | |
144 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
144 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
145 | 145 | return new \Fleet\FleetDispatcher($gc); |
146 | 146 | }; |
147 | 147 | |
148 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
148 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
149 | 149 | return new Watchdog($gc); |
150 | 150 | }; |
151 | 151 | |
152 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
152 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
153 | 153 | return new ValueStorage([]); |
154 | 154 | }; |
155 | 155 | |
156 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
156 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
157 | 157 | return new BonusCatalog($gc); |
158 | 158 | }; |
159 | 159 | |
160 | - $gc->general = function (GlobalContainer $gc) { |
|
160 | + $gc->general = function(GlobalContainer $gc) { |
|
161 | 161 | return new General($gc); |
162 | 162 | }; |
163 | 163 | |
164 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
164 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
165 | 165 | return new EconomicHelper($gc); |
166 | 166 | }; |
167 | 167 | |
168 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
168 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
169 | 169 | return new PlayerLevelHelper($gc); |
170 | 170 | }; |
171 | 171 | |
172 | - $gc->pimp = function (GlobalContainer $gc) { |
|
172 | + $gc->pimp = function(GlobalContainer $gc) { |
|
173 | 173 | return new SnPimp($gc); |
174 | 174 | }; |
175 | 175 | |
176 | - $gc->modules = function (GlobalContainer $gc) { |
|
176 | + $gc->modules = function(GlobalContainer $gc) { |
|
177 | 177 | return new ModulesManager($gc); |
178 | 178 | }; |
179 | 179 | |
180 | 180 | // Dummy objects --------------------------------------------------------------------------------------------------- |
181 | - $gc->theUser = function (GlobalContainer $gc) { |
|
181 | + $gc->theUser = function(GlobalContainer $gc) { |
|
182 | 182 | return new \TheUser($gc); |
183 | 183 | }; |
184 | 184 | |
185 | 185 | |
186 | 186 | // Models ---------------------------------------------------------------------------------------------------------- |
187 | 187 | $gc->skinEntityClass = \SkinV2::class; |
188 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
188 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
189 | 189 | return new \SkinModel($gc); |
190 | 190 | }; |
191 | 191 | |
192 | - $gc->textModel = function (GlobalContainer $gc) { |
|
192 | + $gc->textModel = function(GlobalContainer $gc) { |
|
193 | 193 | return new \TextModel($gc); |
194 | 194 | }; |
195 | 195 |