@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | |
11 | 11 | $d = sys_get_param_id('d'); |
12 | 12 | |
13 | -if($d) { |
|
13 | +if ($d) { |
|
14 | 14 | db_ally_request_deny($d); |
15 | 15 | } |
16 | 16 | |
17 | 17 | $id_user = sys_get_param_id('id_user'); |
18 | 18 | |
19 | -if($id_user) { |
|
19 | +if ($id_user) { |
|
20 | 20 | $ally_name_safe = db_escape($ally['ally_name']); |
21 | 21 | $ally_tag_safe = db_escape($ally['ally_tag']); |
22 | - db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0"); |
|
22 | + db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = ".SN_TIME_NOW.", `ally_rank_id` = 0"); |
|
23 | 23 | db_ally_update_member_increase($ally); |
24 | 24 | db_ally_request_delete_by_user_id($id_user); |
25 | 25 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | return doquery( |
6 | 6 | "SELECT * FROM {{messages}} |
7 | 7 | WHERE |
8 | - `message_type` = '" . MSG_TYPE_PLAYER . "' AND |
|
8 | + `message_type` = '" . MSG_TYPE_PLAYER."' AND |
|
9 | 9 | ((`message_owner` = '{$user['id']}' AND `message_sender` = '{$recipient_id}') |
10 | 10 | OR |
11 | 11 | (`message_sender` = '{$user['id']}' AND `message_owner` = '{$recipient_id}')) ORDER BY `message_time` DESC LIMIT 20;"); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | FROM |
52 | 52 | {{messages}} AS m |
53 | 53 | LEFT JOIN {{users}} AS u ON u.id = m.message_owner " . |
54 | - ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : '') . |
|
54 | + ($int_type_selected >= 0 ? "WHERE `message_type` = {$int_type_selected} " : ''). |
|
55 | 55 | "ORDER BY |
56 | 56 | `message_id` DESC |
57 | 57 | LIMIT |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | function db_message_insert_all($message_type, $from, $subject, $text) { |
62 | - return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
62 | + return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
63 | 63 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
64 | 64 | } |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return array|bool|mysqli_result|null |
70 | 70 | */ |
71 | 71 | function db_message_count_by_type($int_type_selected) { |
72 | - $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}' . ($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
72 | + $page_max = doquery('SELECT COUNT(*) AS `max` FROM {{messages}}'.($int_type_selected >= 0 ? " WHERE `message_type` = {$int_type_selected};" : ''), true); |
|
73 | 73 | |
74 | 74 | return $page_max; |
75 | 75 | } |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * @param $int_type_selected |
87 | 87 | */ |
88 | 88 | function db_message_list_delete_by_date($delete_date, $int_type_selected) { |
89 | - doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
89 | + doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')".($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @param $insert_values |
94 | 94 | */ |
95 | 95 | function db_message_insert($insert_values) { |
96 | - doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
|
97 | - 'VALUES ' . implode(',', $insert_values)); |
|
96 | + doquery('INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) '. |
|
97 | + 'VALUES '.implode(',', $insert_values)); |
|
98 | 98 | } |
@@ -27,19 +27,19 @@ |
||
27 | 27 | */ |
28 | 28 | function db_set_make_safe_string($set, $delta = false) { |
29 | 29 | $set_safe = array(); |
30 | - foreach($set as $field => $value) { |
|
31 | - if(empty($field)) { |
|
30 | + foreach ($set as $field => $value) { |
|
31 | + if (empty($field)) { |
|
32 | 32 | continue; |
33 | 33 | } |
34 | 34 | |
35 | - $field = '`' . db_escape($field) . '`'; |
|
35 | + $field = '`'.db_escape($field).'`'; |
|
36 | 36 | $new_value = $value; |
37 | - if($value === null) { |
|
37 | + if ($value === null) { |
|
38 | 38 | $new_value = 'NULL'; |
39 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
39 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
40 | 40 | // non-float |
41 | - $new_value = '"' . db_escape($value) . '"'; |
|
42 | - } elseif($delta) { |
|
41 | + $new_value = '"'.db_escape($value).'"'; |
|
42 | + } elseif ($delta) { |
|
43 | 43 | // float and DELTA-set |
44 | 44 | $new_value = "{$field} + ({$new_value})"; |
45 | 45 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param $note_id_edit |
35 | 35 | */ |
36 | 36 | function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
37 | - doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
37 | + doquery("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
38 | 38 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
39 | 39 | WHERE `id` = {$note_id_edit} LIMIT 1;"); |
40 | 40 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param $note_sticky |
52 | 52 | */ |
53 | 53 | function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) { |
54 | - doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
54 | + doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
55 | 55 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};"); |
56 | 56 | } |
57 | 57 |
@@ -2,19 +2,19 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
6 | - include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
|
5 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
6 | + include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX); |
|
7 | 7 | } |
8 | 8 | |
9 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
10 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
|
9 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
10 | + require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX); |
|
11 | 11 | sn_user_birthday_celebrate(); |
12 | 12 | } |
13 | 13 | |
14 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
14 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
15 | 15 | classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
16 | 16 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
17 | - if(classSupernova::$config->server_log_online) { |
|
17 | + if (classSupernova::$config->server_log_online) { |
|
18 | 18 | db_log_online_insert(); |
19 | 19 | } |
20 | 20 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
42 | 42 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
43 | 43 | |
44 | -if(!empty($user['id'])) { |
|
44 | +if (!empty($user['id'])) { |
|
45 | 45 | classSupernova::$user_options->user_change($user['id']); |
46 | 46 | } |
47 | 47 | |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | : false |
55 | 55 | ); |
56 | 56 | |
57 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | - $prohibited_characters = array_map(function ($value) { |
|
59 | - return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
|
57 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
58 | + $prohibited_characters = array_map(function($value) { |
|
59 | + return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'"; |
|
60 | 60 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
61 | 61 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
65 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
66 | 66 | pdump("Отключи отладку перед продакшном!"); |
67 | 67 | } |
68 | 68 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
77 | 77 | : false; |
78 | 78 | |
79 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
79 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
80 | 80 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
81 | 81 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
82 | 82 | ? classSupernova::$config->game_disable_reason |
83 | 83 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
84 | 84 | ); |
85 | - if(defined('IN_API')) { |
|
85 | + if (defined('IN_API')) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if( |
|
89 | + if ( |
|
90 | 90 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
91 | 91 | && |
92 | 92 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | // TODO ban |
102 | 102 | // TODO $skip_ban_check |
103 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | - if(defined('IN_API')) { |
|
103 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
104 | + if (defined('IN_API')) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | // pdump($allow_anonymous, '$allow_anonymous'); |
120 | 120 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
121 | 121 | |
122 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
123 | - sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
|
124 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
122 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
123 | + sys_redirect(SN_ROOT_VIRTUAL.'overview.php'); |
|
124 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
125 | 125 | // pdump($sn_page_name); |
126 | 126 | // pdump(INITIAL_PAGE); |
127 | 127 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
128 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
128 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
129 | 129 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
130 | - sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
|
130 | + sys_redirect(SN_ROOT_VIRTUAL.'login.php'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | |
147 | 147 | global $skip_fleet_update; |
148 | 148 | $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); |
149 | -if( |
|
149 | +if ( |
|
150 | 150 | !$skip_fleet_update |
151 | 151 | && !(defined('IN_AJAX') && IN_AJAX === true) |
152 | 152 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
153 | 153 | ) { |
154 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX); |
|
154 | + require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX); |
|
155 | 155 | flt_flying_fleet_handler($skip_fleet_update); |
156 | 156 | } |
157 | 157 | |
158 | -if(!defined('IN_AJAX')) { |
|
158 | +if (!defined('IN_AJAX')) { |
|
159 | 159 | print("Scheduled processes is disabled<br />"); |
160 | 160 | } |
161 | 161 | // scheduler_process(); |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | 'LEVEL' => 'submenu', |
105 | 105 | 'TYPE' => 'lang', |
106 | 106 | 'ITEM' => 'tech[UNIT_STRUCTURES]', |
107 | - 'LINK' => 'buildings.php?mode=' . QUE_STRUCTURES, |
|
107 | + 'LINK' => 'buildings.php?mode='.QUE_STRUCTURES, |
|
108 | 108 | 'ICON' => true, |
109 | 109 | ), |
110 | 110 | 'menu_planet_shipyard' => array( |
111 | 111 | 'LEVEL' => 'submenu', |
112 | 112 | 'TYPE' => 'lang', |
113 | 113 | 'ITEM' => 'Shipyard', |
114 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_FLEET, |
|
114 | + 'LINK' => 'buildings.php?mode='.SUBQUE_FLEET, |
|
115 | 115 | 'ICON' => true, |
116 | 116 | ), |
117 | 117 | 'menu_planet_defense' => array( |
118 | 118 | 'LEVEL' => 'submenu', |
119 | 119 | 'TYPE' => 'lang', |
120 | 120 | 'ITEM' => 'Defense', |
121 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_DEFENSE, |
|
121 | + 'LINK' => 'buildings.php?mode='.SUBQUE_DEFENSE, |
|
122 | 122 | 'ICON' => true, |
123 | 123 | ), |
124 | 124 | 'menu_planet_resources' => array( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'LEVEL' => 'submenu', |
148 | 148 | 'TYPE' => 'lang', |
149 | 149 | 'ITEM' => 'Research', |
150 | - 'LINK' => 'buildings.php?mode=' . QUE_RESEARCH, |
|
150 | + 'LINK' => 'buildings.php?mode='.QUE_RESEARCH, |
|
151 | 151 | 'ICON' => true, |
152 | 152 | ), |
153 | 153 | 'menu_empire_techtree' => array( |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | 'LEVEL' => 'submenu', |
234 | 234 | 'TYPE' => 'lang', |
235 | 235 | 'ITEM' => 'tech[UNIT_MERCENARIES]', |
236 | - 'LINK' => 'officer.php?mode=' . UNIT_MERCENARIES, |
|
236 | + 'LINK' => 'officer.php?mode='.UNIT_MERCENARIES, |
|
237 | 237 | 'ICON' => true, |
238 | 238 | ), |
239 | 239 | 'menu_empire_schematics' => array( |
240 | 240 | 'LEVEL' => 'submenu', |
241 | 241 | 'TYPE' => 'lang', |
242 | 242 | 'ITEM' => 'tech[UNIT_PLANS]', |
243 | - 'LINK' => 'officer.php?mode=' . UNIT_PLANS, |
|
243 | + 'LINK' => 'officer.php?mode='.UNIT_PLANS, |
|
244 | 244 | 'ICON' => true, |
245 | 245 | ), |
246 | 246 | 'menu_empire_artifacts' => array( |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | 'LEVEL' => 'submenu', |
271 | 271 | 'TYPE' => 'lang', |
272 | 272 | 'ITEM' => 'Chat', |
273 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_COMMON, |
|
273 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_COMMON, |
|
274 | 274 | 'ICON' => true, |
275 | 275 | ), |
276 | 276 | 'menu_ally_chat' => array( |
277 | 277 | 'LEVEL' => 'submenu', |
278 | 278 | 'TYPE' => 'lang', |
279 | 279 | 'ITEM' => 'AllyChat', |
280 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_ALLY, |
|
280 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_ALLY, |
|
281 | 281 | 'ICON' => true, |
282 | 282 | 'DISABLED' => classSupernova::$config->game_mode == GAME_BLITZ, |
283 | 283 | ), |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | ), |
459 | 459 | 'menu_admin_version_info' => array( |
460 | 460 | 'TYPE' => 'text', |
461 | - 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '') . '<div class="' . |
|
462 | - $sn_version_check_class[classSupernova::$config->server_updater_check_result] . '">' . classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result] . '</div>', |
|
461 | + 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '').'<div class="'. |
|
462 | + $sn_version_check_class[classSupernova::$config->server_updater_check_result].'">'.classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result].'</div>', |
|
463 | 463 | ), |
464 | 464 | |
465 | 465 | 'USER_AUTHLEVEL_NAME' => array( |
@@ -547,13 +547,13 @@ discard block |
||
547 | 547 | 'menu_admin_planet_list_planets' => array( |
548 | 548 | 'TYPE' => 'lang', |
549 | 549 | 'ITEM' => 'adm_pltlst', |
550 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_PLANET, |
|
550 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_PLANET, |
|
551 | 551 | 'AUTH_LEVEL' => 3, |
552 | 552 | ), |
553 | 553 | 'menu_admin_planet_list_moons' => array( |
554 | 554 | 'TYPE' => 'lang', |
555 | 555 | 'ITEM' => 'adm_moonlst', |
556 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_MOON, |
|
556 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_MOON, |
|
557 | 557 | 'AUTH_LEVEL' => 3, |
558 | 558 | ), |
559 | 559 | 'menu_admin_planet_moon_add' => array( |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false; |
21 | 21 | |
22 | 22 | // Бенчмарк |
23 | -register_shutdown_function(function () { |
|
24 | - if(defined('IN_AJAX')) { |
|
23 | +register_shutdown_function(function() { |
|
24 | + if (defined('IN_AJAX')) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | global $user, $locale_cache_statistic; |
29 | 29 | |
30 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
31 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
32 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
30 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
31 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
32 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
33 | 33 | '</div>'); |
34 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
34 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
35 | 35 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
36 | 36 | } |
37 | 37 | |
38 | - if(!empty($locale_cache_statistic['misses'])) { |
|
38 | + if (!empty($locale_cache_statistic['misses'])) { |
|
39 | 39 | print('<!--'); |
40 | 40 | pdump($locale_cache_statistic); |
41 | 41 | print('-->'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
57 | 57 | |
58 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
59 | 59 | define('SN_GOOGLE', true); |
60 | 60 | } |
61 | 61 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
75 | 75 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
76 | 76 | |
77 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
77 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
78 | 78 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
79 | 79 | |
80 | 80 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
81 | 81 | define('PHP_EX', $phpEx); // PHP extension on this server |
82 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
82 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
83 | 83 | |
84 | 84 | |
85 | 85 | require_once('constants.php'); |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | |
101 | 101 | // required for db.php |
102 | 102 | // Initializing global 'debug' object |
103 | -require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX); |
|
103 | +require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX); |
|
104 | 104 | classSupernova::$debug = new debug(); |
105 | 105 | |
106 | -spl_autoload_register(function ($class) { |
|
107 | - if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php')) { |
|
108 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php'; |
|
106 | +spl_autoload_register(function($class) { |
|
107 | + if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php')) { |
|
108 | + require_once SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php'; |
|
109 | 109 | } |
110 | 110 | }); |
111 | 111 | |
112 | -spl_autoload_register(function ($class) { |
|
113 | - if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php')) { |
|
114 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php'; |
|
112 | +spl_autoload_register(function($class) { |
|
113 | + if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php')) { |
|
114 | + require_once SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php'; |
|
115 | 115 | } |
116 | 116 | }); |
117 | 117 | |
118 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
118 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
119 | 119 | require_once('classes/db_mysql_v4.php'); |
120 | 120 | require_once('classes/db_mysql_v5.php'); |
121 | 121 | require_once('classes/db_mysql.php'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | require_once('classes/module.php'); |
129 | 129 | |
130 | 130 | require_once('classes/user_options.php'); |
131 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
131 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * @var classConfig $config |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | // define('BE_DEBUG', true); // Отладка боевого движка |
143 | 143 | classSupernova::init_debug_state(); |
144 | 144 | |
145 | -require_once(SN_ROOT_PHYSICAL . "includes/vars" . DOT_PHP_EX); |
|
146 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
145 | +require_once(SN_ROOT_PHYSICAL."includes/vars".DOT_PHP_EX); |
|
146 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
147 | 147 | |
148 | 148 | init_update(); |
149 | 149 | |
@@ -152,34 +152,34 @@ discard block |
||
152 | 152 | ? trim(strip_tags($_GET['page'])) |
153 | 153 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
154 | 154 | define('INITIAL_PAGE', $sn_page_name_original); |
155 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
156 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
157 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
158 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
159 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
160 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
161 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
155 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
156 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
157 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
158 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
159 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
160 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
161 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
162 | 162 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
163 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
164 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
163 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
164 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
165 | 165 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
166 | 166 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
167 | 167 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
168 | 168 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
169 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
169 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
170 | 170 | |
171 | 171 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
172 | 172 | |
173 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
173 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
174 | 174 | $template_result = array('.' => array('result' => array())); |
175 | 175 | |
176 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
176 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
177 | 177 | |
178 | -spl_autoload_register(function ($class) { |
|
179 | - if(file_exists('includes/classes/' . $class . '.php')) { |
|
180 | - require_once 'includes/classes/' . $class . '.php'; |
|
181 | - } elseif(file_exists('includes/classes/UBE/' . $class . '.php')) { |
|
182 | - require_once 'includes/classes/UBE/' . $class . '.php'; |
|
178 | +spl_autoload_register(function($class) { |
|
179 | + if (file_exists('includes/classes/'.$class.'.php')) { |
|
180 | + require_once 'includes/classes/'.$class.'.php'; |
|
181 | + } elseif (file_exists('includes/classes/UBE/'.$class.'.php')) { |
|
182 | + require_once 'includes/classes/UBE/'.$class.'.php'; |
|
183 | 183 | } else { |
184 | 184 | // die("Can't find {$class} class"); |
185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Конфиг - часть манифеста? |
194 | 194 | classSupernova::$auth = new core_auth(); |
195 | 195 | |
196 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
196 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
197 | 197 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
198 | 198 | |
199 | 199 | // Подключаем дефолтную страницу |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
202 | 202 | // Но нужно, пока у нас есть не MVC-страницы |
203 | 203 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
204 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
205 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
204 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
205 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
206 | 206 | require_once($sn_page_name_file); |
207 | - if(is_array($sn_page_data['options'])) { |
|
207 | + if (is_array($sn_page_data['options'])) { |
|
208 | 208 | $supernova->options = array_merge($supernova->options, $sn_page_data['options']); |
209 | 209 | } |
210 | 210 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | $load_order = array(); |
220 | 220 | $sn_req = array(); |
221 | 221 | |
222 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
222 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
223 | 223 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
224 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
225 | - foreach($module_data->manifest['require'] as $require_name) { |
|
224 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
225 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
226 | 226 | $sn_req[$loaded_module_name][$require_name] = 0; |
227 | 227 | } |
228 | 228 | } |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | do { |
236 | 236 | $prev_order = $load_order; |
237 | 237 | |
238 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
238 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
239 | 239 | $level = 1; |
240 | - foreach($req_data as $req_name => &$req_level) { |
|
241 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
240 | + foreach ($req_data as $req_name => &$req_level) { |
|
241 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
242 | 242 | $level = $req_level = -1; |
243 | 243 | break; |
244 | 244 | } else { |
@@ -246,20 +246,20 @@ discard block |
||
246 | 246 | } |
247 | 247 | $req_level = $load_order[$req_name]; |
248 | 248 | } |
249 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
249 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
250 | 250 | $load_order[$loaded_module_name] = $level; |
251 | 251 | } |
252 | 252 | } |
253 | -} while($prev_order != $load_order); |
|
253 | +} while ($prev_order != $load_order); |
|
254 | 254 | |
255 | 255 | asort($load_order); |
256 | 256 | |
257 | 257 | // Инициализируем модули |
258 | 258 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
259 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
260 | - if($load_order_order >= 0) { |
|
259 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
260 | + if ($load_order_order >= 0) { |
|
261 | 261 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
262 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
262 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
263 | 263 | unset(sn_module::$sn_module[$loaded_module_name]); |
264 | 264 | continue; |
265 | 265 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | unset($sn_req); |
277 | 277 | |
278 | 278 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
279 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
279 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
280 | 280 | $sn_page_name = ''; |
281 | 281 | } |
282 | 282 | |
@@ -284,6 +284,6 @@ discard block |
||
284 | 284 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
285 | 285 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
286 | 286 | |
287 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
287 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
288 | 288 | require_once "init_secondary.php"; |
289 | 289 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | function pname_factory_production_field_name($factory_unit_id) |
6 | 6 | { |
7 | - return get_unit_param($factory_unit_id, P_NAME) . '_porcent'; |
|
7 | + return get_unit_param($factory_unit_id, P_NAME).'_porcent'; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | /** |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | function art_use(&$user, &$planetrow, $unit_id) { |
4 | 4 | $classLocale = classLocale::$lang; |
5 | 5 | |
6 | - if(!in_array($unit_id, sn_get_groups('artifacts'))) { |
|
6 | + if (!in_array($unit_id, sn_get_groups('artifacts'))) { |
|
7 | 7 | return; |
8 | 8 | } |
9 | 9 | |
@@ -11,21 +11,21 @@ discard block |
||
11 | 11 | $user = db_user_by_id($user['id'], true); |
12 | 12 | |
13 | 13 | $unit_level = $artifact_level_old = mrc_get_level($user, null, $unit_id, true); |
14 | - if($unit_level > 0) { |
|
14 | + if ($unit_level > 0) { |
|
15 | 15 | $db_changeset = array(); |
16 | - switch($unit_id) { |
|
16 | + switch ($unit_id) { |
|
17 | 17 | case ART_LHC: |
18 | 18 | case ART_HOOK_SMALL: |
19 | 19 | case ART_HOOK_MEDIUM: |
20 | 20 | case ART_HOOK_LARGE: |
21 | 21 | $has_moon = db_planet_by_parent($planetrow['id'], true, '`id`'); |
22 | - if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) { |
|
22 | + if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) { |
|
23 | 23 | $unit_level--; |
24 | 24 | $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : ( |
25 | 25 | $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999) |
26 | 26 | ); |
27 | 27 | $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance; |
28 | - if($random <= $moon_chance) { |
|
28 | + if ($random <= $moon_chance) { |
|
29 | 29 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance); |
30 | 30 | $message = sprintf(classLocale::$lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance)); |
31 | 31 | } else { |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | case ART_RCD_MEDIUM: |
42 | 42 | case ART_RCD_LARGE: |
43 | 43 | $planetrow = db_planet_by_id($planetrow['id'], true); |
44 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
44 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
45 | 45 | $message = classLocale::$lang['art_rcd_err_moon']; |
46 | 46 | break; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
50 | - if(!empty($que['items'])) { |
|
50 | + if (!empty($que['items'])) { |
|
51 | 51 | $message = classLocale::$lang['art_rcd_err_que']; |
52 | 52 | break; |
53 | 53 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | // $deployment_str = ''; |
58 | 58 | $sectors_used = 0; |
59 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) { |
|
60 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
59 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) { |
|
60 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
61 | 61 | continue; |
62 | 62 | } |
63 | 63 | $sectors_used += $levels_deployed; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})"; |
67 | 67 | } |
68 | 68 | |
69 | - if($sectors_used == 0) { |
|
69 | + if ($sectors_used == 0) { |
|
70 | 70 | $message = classLocale::$lang['art_rcd_err_no_sense']; |
71 | 71 | break; |
72 | 72 | } |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $que_item = null; |
81 | 81 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
82 | 82 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
83 | - if(!empty($current_que)) { |
|
83 | + if (!empty($current_que)) { |
|
84 | 84 | reset($current_que); |
85 | 85 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
86 | 86 | } |
87 | 87 | |
88 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) { |
|
88 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) { |
|
89 | 89 | $unit_level--; |
90 | 90 | $old_time = $que_item['que_time_left']; |
91 | 91 | $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0; |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
104 | 104 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
105 | 105 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
106 | - if(!empty($current_que)) { |
|
106 | + if (!empty($current_que)) { |
|
107 | 107 | reset($current_que); |
108 | 108 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
109 | 109 | } |
110 | 110 | |
111 | - if(isset($que_item) && $que_item['que_time_left'] > 60) { |
|
111 | + if (isset($que_item) && $que_item['que_time_left'] > 60) { |
|
112 | 112 | $unit_level--; |
113 | 113 | $old_time = $que_item['que_time_left']; |
114 | 114 | $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | break; |
124 | 124 | |
125 | 125 | } |
126 | - if($unit_level != $artifact_level_old) { |
|
126 | + if ($unit_level != $artifact_level_old) { |
|
127 | 127 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user); |
128 | 128 | db_changeset_apply($db_changeset); |
129 | 129 | } |
@@ -133,6 +133,6 @@ discard block |
||
133 | 133 | |
134 | 134 | sn_db_transaction_commit(); |
135 | 135 | message($message, "{$classLocale['tech'][UNIT_ARTIFACTS]} - {$classLocale['tech'][$unit_id]}", |
136 | - ($request_uri = sys_get_param_str_unsafe('REQUEST_URI')) ? $request_uri : ('artifacts' . DOT_PHP_EX . '#' . $unit_id), |
|
136 | + ($request_uri = sys_get_param_str_unsafe('REQUEST_URI')) ? $request_uri : ('artifacts'.DOT_PHP_EX.'#'.$unit_id), |
|
137 | 137 | 5); |
138 | 138 | } |