@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
6 | 6 | |
7 | -if($user['authlevel'] < 3) |
|
7 | +if ($user['authlevel'] < 3) |
|
8 | 8 | { |
9 | 9 | messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']); |
10 | 10 | die(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | // [#] info_best_battles 1b0 |
21 | 21 | $best_reports = array(); |
22 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
22 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
23 | 23 | $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY); |
24 | - while($row = db_fetch($query)) { |
|
24 | + while ($row = db_fetch($query)) { |
|
25 | 25 | $best_reports[] = $row['ube_report_id']; |
26 | 26 | } |
27 | 27 | } |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | |
186 | 186 | function sn_maintenance_pack_user_list($user_list) { |
187 | 187 | $user_list = explode(',', $user_list); |
188 | - foreach($user_list as $key => $user_id) { |
|
189 | - if(!ceil(floatval($user_id))) { |
|
188 | + foreach ($user_list as $key => $user_id) { |
|
189 | + if (!ceil(floatval($user_id))) { |
|
190 | 190 | unset($user_list[$key]); |
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | 194 | $result = array(); |
195 | - if(!empty($user_list)) { |
|
195 | + if (!empty($user_list)) { |
|
196 | 196 | $query = doquery("SELECT `id` FROM {{users}} WHERE `id` in (" . implode(',', $user_list) . ")"); |
197 | - while($row = db_fetch($query)) { |
|
197 | + while ($row = db_fetch($query)) { |
|
198 | 198 | $result[] = $row['id']; |
199 | 199 | } |
200 | 200 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
210 | 210 | sn_db_transaction_commit(); |
211 | 211 | |
212 | -foreach($ques as $que_transaction) { |
|
212 | +foreach ($ques as $que_transaction) { |
|
213 | 213 | sn_db_transaction_start(); |
214 | 214 | |
215 | 215 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
216 | - foreach($que_transaction as $que) { |
|
216 | + foreach ($que_transaction as $que) { |
|
217 | 217 | set_time_limit(120); |
218 | 218 | $QryResult = doquery($que); |
219 | 219 | //$msg .= '<hr>' . $que . '<hr>'; |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | 11 | |
12 | -define('INSIDE' , true); |
|
13 | -define('INSTALL' , false); |
|
12 | +define('INSIDE', true); |
|
13 | +define('INSTALL', false); |
|
14 | 14 | define('IN_ADMIN', true); |
15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
20 | 20 | |
21 | -if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end')) |
|
21 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end')) |
|
22 | 22 | { |
23 | 23 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
24 | 24 |
@@ -18,26 +18,26 @@ discard block |
||
18 | 18 | |
19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
20 | 20 | |
21 | -if($delete = sys_get_param_id('delete')) |
|
21 | +if ($delete = sys_get_param_id('delete')) |
|
22 | 22 | { |
23 | 23 | doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;"); |
24 | 24 | } |
25 | -elseif(sys_get_param_str('delete_update_info')) |
|
25 | +elseif (sys_get_param_str('delete_update_info')) |
|
26 | 26 | { |
27 | 27 | doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);"); |
28 | 28 | } |
29 | -elseif(sys_get_param_str('deleteall') == 'yes') |
|
29 | +elseif (sys_get_param_str('deleteall') == 'yes') |
|
30 | 30 | { |
31 | 31 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
32 | 32 | } |
33 | 33 | |
34 | -if($detail = sys_get_param_id('detail')) |
|
34 | +if ($detail = sys_get_param_id('detail')) |
|
35 | 35 | { |
36 | 36 | $template = gettemplate('admin/adm_log_main_detail', true); |
37 | 37 | |
38 | 38 | $errorInfo = doquery("SELECT * FROM `{{logs}}` WHERE `log_id` = {$detail} LIMIT 1;", true); |
39 | 39 | $error_dump = unserialize($errorInfo['log_dump']); |
40 | - if(is_array($error_dump)) |
|
40 | + if (is_array($error_dump)) |
|
41 | 41 | { |
42 | 42 | foreach ($error_dump as $key => $value) |
43 | 43 | { |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | $i = 0; |
59 | 59 | $query = doquery("SELECT * FROM `{{logs}}` ORDER BY log_id DESC LIMIT 100;"); |
60 | - while($u = db_fetch($query)) |
|
60 | + while ($u = db_fetch($query)) |
|
61 | 61 | { |
62 | 62 | $i++; |
63 | 63 | $v = array(); |
64 | - foreach($u as $key => $value) |
|
64 | + foreach ($u as $key => $value) |
|
65 | 65 | { |
66 | 66 | $v[strtoupper($key)] = $value; |
67 | 67 | } |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
40 | 40 | $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
41 | 41 | $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
42 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
43 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
42 | + $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
44 | 43 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
45 | 44 | |
46 | 45 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -61,7 +60,7 @@ discard block |
||
61 | 60 | // } |
62 | 61 | |
63 | 62 | public static function db_planet_by_parent($parent_id, $for_update = false, $fields = '*') { |
64 | - if(!($parent_id = idval($parent_id))) { |
|
63 | + if (!($parent_id = idval($parent_id))) { |
|
65 | 64 | return false; |
66 | 65 | } |
67 | 66 | |
@@ -70,7 +69,7 @@ discard block |
||
70 | 69 | } |
71 | 70 | |
72 | 71 | public static function db_planet_by_id_and_owner($planet_id, $owner_id, $for_update = false, $fields = '*') { |
73 | - if(!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) { |
|
72 | + if (!($planet_id = idval($planet_id)) || !($owner_id = idval($owner_id))) { |
|
74 | 73 | return false; |
75 | 74 | } |
76 | 75 | return classSupernova::db_get_record_list(LOC_PLANET, |
@@ -79,7 +78,7 @@ discard block |
||
79 | 78 | |
80 | 79 | |
81 | 80 | public static function db_planet_list_moon_other($user_id, $this_moon_id) { |
82 | - if(!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) { |
|
81 | + if (!($user_id = idval($user_id)) || !($this_moon_id = idval($this_moon_id))) { |
|
83 | 82 | return false; |
84 | 83 | } |
85 | 84 | return classSupernova::db_get_record_list(LOC_PLANET, |
@@ -94,7 +93,7 @@ discard block |
||
94 | 93 | } |
95 | 94 | |
96 | 95 | public static function db_planet_list_sorted($user_row, $skip_planet_id = false, $field_list = '', $conditions = '') { |
97 | - if(!is_array($user_row)) { |
|
96 | + if (!is_array($user_row)) { |
|
98 | 97 | return false; |
99 | 98 | } |
100 | 99 | $conditions .= $skip_planet_id ? " AND `id` <> {$skip_planet_id} " : ''; |
@@ -115,7 +114,7 @@ discard block |
||
115 | 114 | } |
116 | 115 | |
117 | 116 | public static function db_planet_list_by_user_or_planet($user_id, $planet_id) { |
118 | - if(!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
|
117 | + if (!($user_id = idval($user_id)) && !($planet_id = idval($planet_id))) { |
|
119 | 118 | return false; |
120 | 119 | } |
121 | 120 | |
@@ -124,14 +123,14 @@ discard block |
||
124 | 123 | } |
125 | 124 | |
126 | 125 | public static function db_planet_set_by_id($planet_id, $set) { |
127 | - if(!($planet_id = idval($planet_id))) { |
|
126 | + if (!($planet_id = idval($planet_id))) { |
|
128 | 127 | return false; |
129 | 128 | } |
130 | 129 | return classSupernova::db_upd_record_by_id(LOC_PLANET, $planet_id, $set); |
131 | 130 | } |
132 | 131 | |
133 | 132 | public static function db_planet_set_by_gspt($ui_galaxy, $ui_system, $ui_planet, $ui_planet_type = PT_ALL, $set) { |
134 | - if(!($set = trim($set))) { |
|
133 | + if (!($set = trim($set))) { |
|
135 | 134 | return false; |
136 | 135 | } |
137 | 136 | |
@@ -144,14 +143,14 @@ discard block |
||
144 | 143 | } |
145 | 144 | |
146 | 145 | public static function db_planet_set_by_parent($ui_parent_id, $ss_set) { |
147 | - if(!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) { |
|
146 | + if (!($si_parent_id = idval($ui_parent_id)) || !($ss_set = trim($ss_set))) { |
|
148 | 147 | return false; |
149 | 148 | } |
150 | 149 | return classSupernova::db_upd_record_list(LOC_PLANET, "`parent_planet` = {$si_parent_id}", $ss_set); |
151 | 150 | } |
152 | 151 | |
153 | 152 | public static function db_planet_set_by_owner($ui_owner_id, $ss_set) { |
154 | - if(!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) { |
|
153 | + if (!($si_owner_id = idval($ui_owner_id)) || !($ss_set = trim($ss_set))) { |
|
155 | 154 | return false; |
156 | 155 | } |
157 | 156 | return classSupernova::db_upd_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}", $ss_set); |
@@ -159,7 +158,7 @@ discard block |
||
159 | 158 | |
160 | 159 | |
161 | 160 | public static function db_planet_delete_by_id($planet_id) { |
162 | - if(!($planet_id = idval($planet_id))) { |
|
161 | + if (!($planet_id = idval($planet_id))) { |
|
163 | 162 | return false; |
164 | 163 | } |
165 | 164 | classSupernova::db_del_record_by_id(LOC_PLANET, $planet_id); |
@@ -169,7 +168,7 @@ discard block |
||
169 | 168 | } |
170 | 169 | |
171 | 170 | public static function db_planet_list_delete_by_owner($ui_owner_id) { |
172 | - if(!($si_owner_id = idval($ui_owner_id))) { |
|
171 | + if (!($si_owner_id = idval($ui_owner_id))) { |
|
173 | 172 | return false; |
174 | 173 | } |
175 | 174 | classSupernova::db_del_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}"); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | $this->container = array(); |
30 | 30 | |
31 | - if(classSupernova::$cache->getMode() != classCache::CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
31 | + if (classSupernova::$cache->getMode() != classCache::CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
32 | 32 | $this->cache = classSupernova::$cache; |
33 | 33 | classSupernova::log_file('locale.__constructor: Cache is present'); |
34 | 34 | //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug! |
35 | 35 | } |
36 | 36 | |
37 | - if($enable_stat_usage && empty($this->stat_usage)) { |
|
37 | + if ($enable_stat_usage && empty($this->stat_usage)) { |
|
38 | 38 | $this->enable_stat_usage = $enable_stat_usage; |
39 | 39 | $this->usage_stat_load(); |
40 | 40 | // TODO shutdown function |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | unset($fallback[$this->active]); |
61 | 61 | |
62 | 62 | // Проходим по оставшимся локалям |
63 | - foreach($fallback as $try_language) { |
|
63 | + foreach ($fallback as $try_language) { |
|
64 | 64 | // Если нет такой строки - пытаемся вытащить из кэша |
65 | - if(!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
65 | + if (!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
66 | 66 | $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset); |
67 | 67 | // Записываем результат работы кэша |
68 | 68 | $locale_cache_statistic['queries']++; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | // Если мы как-то где-то нашли строку... |
74 | - if(isset($this->container[$try_language][$offset])) { |
|
74 | + if (isset($this->container[$try_language][$offset])) { |
|
75 | 75 | // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер |
76 | 76 | $this[$offset] = $this->container[$try_language][$offset]; |
77 | 77 | $locale_cache_statistic['fallbacks']++; |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | $this->container[$this->active][] = $value; |
86 | 86 | } else { |
87 | 87 | $this->container[$this->active][$offset] = $value; |
88 | - if($this->cache) { |
|
88 | + if ($this->cache) { |
|
89 | 89 | $this->cache->__set($this->cache_prefix_lang . $offset, $value); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | 93 | public function offsetExists($offset) { |
94 | 94 | // Шорткат если у нас уже есть строка в памяти PHP |
95 | - if(!isset($this->container[$this->active][$offset])) { |
|
96 | - if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
95 | + if (!isset($this->container[$this->active][$offset])) { |
|
96 | + if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
97 | 97 | // Если нету такой строки - делаем фоллбэк |
98 | 98 | $this->locale_string_fallback($offset); |
99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | public function offsetGet($offset) { |
109 | 109 | $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null; |
110 | - if($this->enable_stat_usage) { |
|
110 | + if ($this->enable_stat_usage) { |
|
111 | 111 | $this->usage_stat_log($offset, $value); |
112 | 112 | } |
113 | 113 | return $value; |
@@ -124,24 +124,24 @@ discard block |
||
124 | 124 | public function usage_stat_load() { |
125 | 125 | global $sn_cache; |
126 | 126 | |
127 | - $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
128 | - if(empty($this->stat_usage)) { |
|
127 | + $this->stat_usage = $sn_cache->lng_stat_usage = array(); // TODO for debug |
|
128 | + if (empty($this->stat_usage)) { |
|
129 | 129 | $query = doquery("SELECT * FROM {{lng_usage_stat}}"); |
130 | - while($row = db_fetch($query)) { |
|
130 | + while ($row = db_fetch($query)) { |
|
131 | 131 | $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty']; |
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
135 | 135 | public function usage_stat_save() { |
136 | - if(!empty($this->stat_usage_new)) { |
|
136 | + if (!empty($this->stat_usage_new)) { |
|
137 | 137 | global $sn_cache; |
138 | 138 | $sn_cache->lng_stat_usage = $this->stat_usage; |
139 | 139 | doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1"); |
140 | - foreach($this->stat_usage_new as &$value) { |
|
141 | - foreach($value as &$value2) { |
|
140 | + foreach ($this->stat_usage_new as &$value) { |
|
141 | + foreach ($value as &$value2) { |
|
142 | 142 | $value2 = '"' . db_escape($value2) . '"'; |
143 | 143 | } |
144 | - $value = '(' . implode(',', $value) .')'; |
|
144 | + $value = '(' . implode(',', $value) . ')'; |
|
145 | 145 | } |
146 | 146 | doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new)); |
147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1)); |
155 | 155 | |
156 | 156 | $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line']; |
157 | - if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) { |
|
157 | + if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != $empty) { |
|
158 | 158 | $this->stat_usage[$string_id] = empty($value); |
159 | 159 | $this->stat_usage_new[] = array( |
160 | 160 | 'lang_code' => $this->active, |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | $cache_file_key = $this->cache_prefix_lang . '__' . $filename; |
195 | 195 | |
196 | 196 | // Подключен ли внешний кэш? |
197 | - if($this->cache) { |
|
197 | + if ($this->cache) { |
|
198 | 198 | // Загружен ли уже данный файл? |
199 | 199 | $cache_file_status = $this->cache->__get($cache_file_key); |
200 | 200 | classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0); |
201 | - if($cache_file_status) { |
|
201 | + if ($cache_file_status) { |
|
202 | 202 | // Если да - повторять загрузку нет смысла |
203 | 203 | return null; |
204 | 204 | } |
@@ -212,35 +212,35 @@ discard block |
||
212 | 212 | $this->make_fallback($language); |
213 | 213 | |
214 | 214 | $file_path = ''; |
215 | - foreach($this->fallback as $lang_try) { |
|
216 | - if(!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
215 | + foreach ($this->fallback as $lang_try) { |
|
216 | + if (!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
220 | - if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
220 | + if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
221 | 221 | break; |
222 | 222 | } |
223 | 223 | |
224 | - if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
224 | + if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
225 | 225 | break; |
226 | 226 | } |
227 | 227 | |
228 | 228 | $file_path = ''; |
229 | 229 | } |
230 | 230 | |
231 | - if($file_path) { |
|
231 | + if ($file_path) { |
|
232 | 232 | include($file_path); |
233 | 233 | |
234 | - if(!empty($a_lang_array)) { |
|
234 | + if (!empty($a_lang_array)) { |
|
235 | 235 | $this->merge($a_lang_array); |
236 | 236 | |
237 | 237 | // Загрузка данных из файла в кэш |
238 | - if($this->cache) { |
|
238 | + if ($this->cache) { |
|
239 | 239 | classSupernova::log_file("Locale: loading '{$filename}' into cache"); |
240 | - foreach($a_lang_array as $key => $value) { |
|
240 | + foreach ($a_lang_array as $key => $value) { |
|
241 | 241 | $value_cache_key = $this->cache_prefix_lang . $key; |
242 | - if($this->cache->__isset($value_cache_key)) { |
|
243 | - if(is_array($value)) { |
|
242 | + if ($this->cache->__isset($value_cache_key)) { |
|
243 | + if (is_array($value)) { |
|
244 | 244 | $alt_value = $this->cache->__get($value_cache_key); |
245 | 245 | $value = array_replace_recursive($alt_value, $value); |
246 | 246 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | - if($this->cache) { |
|
253 | + if ($this->cache) { |
|
254 | 254 | $this->cache->__set($cache_file_key, true); |
255 | 255 | } |
256 | 256 | |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | public function lng_load_i18n($i18n) { |
266 | - if(!isset($i18n)) { |
|
266 | + if (!isset($i18n)) { |
|
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | - foreach($i18n as $i18n_data) { |
|
271 | - if(is_string($i18n_data)) { |
|
270 | + foreach ($i18n as $i18n_data) { |
|
271 | + if (is_string($i18n_data)) { |
|
272 | 272 | $this->lng_include($i18n_data); |
273 | - } elseif(is_array($i18n_data)) { |
|
273 | + } elseif (is_array($i18n_data)) { |
|
274 | 274 | $this->lng_include($i18n_data['file'], $i18n_data['path']); |
275 | 275 | } |
276 | 276 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); |
290 | 290 | |
291 | - if($language_new == $this->active) { |
|
291 | + if ($language_new == $this->active) { |
|
292 | 292 | classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); |
293 | 293 | return false; |
294 | 294 | } |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | $this['LANG_INFO'] = $this->lng_get_info($this->active); |
300 | 300 | $this->make_fallback($this->active); |
301 | 301 | |
302 | - if($this->cache) { |
|
302 | + if ($this->cache) { |
|
303 | 303 | $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); |
304 | 304 | classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0); |
305 | - if($cache_lang_init_status) { |
|
305 | + if ($cache_lang_init_status) { |
|
306 | 306 | return false; |
307 | 307 | } |
308 | 308 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | // Loading global language files |
319 | 319 | $this->lng_load_i18n($sn_mvc['i18n']['']); |
320 | 320 | |
321 | - if($this->cache) { |
|
321 | + if ($this->cache) { |
|
322 | 322 | classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); |
323 | 323 | $this->cache->__set($this->cache_prefix_lang . '__INIT', true); |
324 | 324 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | public function lng_get_info($entry) { |
333 | 333 | $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php'; |
334 | 334 | $lang_info = array(); |
335 | - if(file_exists($file_name)) { |
|
335 | + if (file_exists($file_name)) { |
|
336 | 336 | include($file_name); |
337 | 337 | } |
338 | 338 | |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | public function lng_get_list() { |
343 | - if(empty($this->lang_list)) { |
|
343 | + if (empty($this->lang_list)) { |
|
344 | 344 | $this->lang_list = array(); |
345 | 345 | |
346 | 346 | $path = SN_ROOT_PHYSICAL . 'language/'; |
347 | 347 | $dir = dir($path); |
348 | - while(false !== ($entry = $dir->read())) { |
|
349 | - if(is_dir($path . $entry) && $entry[0] != '.') { |
|
348 | + while (false !== ($entry = $dir->read())) { |
|
349 | + if (is_dir($path . $entry) && $entry[0] != '.') { |
|
350 | 350 | $lang_info = $this->lng_get_info($entry); |
351 | - if($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
351 | + if ($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
352 | 352 | $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info; |
353 | 353 | } |
354 | 354 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $configValue = $forceLoad ? $this->config->db_loadItem($configName) : $this->config[$configName]; |
36 | 36 | $configType == WATCHDOG_TIME_SQL ? $configValue = strtotime($configValue, SN_TIME_NOW) : false; |
37 | 37 | |
38 | - if(SN_TIME_NOW - $configValue > $timeDiff) { |
|
38 | + if (SN_TIME_NOW - $configValue > $timeDiff) { |
|
39 | 39 | $callable(); |
40 | 40 | } |
41 | 41 |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public static function autoloader($class) { |
22 | 22 | $classFile = str_replace('\\', '/', $class); |
23 | - foreach(static::$folders as $folder) { |
|
23 | + foreach (static::$folders as $folder) { |
|
24 | 24 | $classFullFileName = str_replace('\\', '/', $folder . $classFile) . DOT_PHP_EX; |
25 | - if(file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
25 | + if (file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
26 | 26 | require_once($classFullFileName); |
27 | - if(method_exists($class, '_constructorStatic')) { |
|
27 | + if (method_exists($class, '_constructorStatic')) { |
|
28 | 28 | $class::_constructorStatic(); |
29 | 29 | } |
30 | 30 | } |
@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | * @param string $absoluteClassRoot - absolute path to root class folder |
36 | 36 | */ |
37 | 37 | public static function register($absoluteClassRoot) { |
38 | - if(!static::$autoloaderRegistered) { |
|
38 | + if (!static::$autoloaderRegistered) { |
|
39 | 39 | spl_autoload_register(array(__CLASS__, 'autoloader')); |
40 | 40 | static::$autoloaderRegistered = true; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot); |
44 | 44 | |
45 | - if(!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
45 | + if (!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/'; |
50 | 50 | |
51 | - if(!isset(static::$folders[$absoluteClassRoot])) { |
|
51 | + if (!isset(static::$folders[$absoluteClassRoot])) { |
|
52 | 52 | static::$folders[$absoluteClassRoot] = $absoluteClassRoot; |
53 | 53 | } |
54 | 54 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | global $lang, $debug; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | if ($new_rank_name = sys_get_param_str('newRankName')) |
17 | 17 | { |
18 | - foreach($ally_rights as $fieldName) |
|
18 | + foreach ($ally_rights as $fieldName) |
|
19 | 19 | { |
20 | 20 | $newRank[$fieldName] = 0; |
21 | 21 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | { |
29 | 29 | unset($ranks); |
30 | 30 | |
31 | - foreach($rankListInput as $rankID => $rank) |
|
31 | + foreach ($rankListInput as $rankID => $rank) |
|
32 | 32 | { |
33 | - foreach($ally_rights as $rightName) |
|
33 | + foreach ($ally_rights as $rightName) |
|
34 | 34 | { |
35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $d = sys_get_param_int('d'); |
42 | 42 | if ($d && isset($ranks[$d])) |
43 | 43 | { |
44 | - if(count($ranks) == 1) |
|
44 | + if (count($ranks) == 1) |
|
45 | 45 | { |
46 | 46 | messageBox($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']); |
47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | if (count($ranks)) |
55 | 55 | { |
56 | - foreach($ranks as $rankID => $rank) |
|
56 | + foreach ($ranks as $rankID => $rank) |
|
57 | 57 | { |
58 | 58 | $rank_data = array( |
59 | 59 | 'ID' => $rankID, |
60 | 60 | 'NAME' => $rank['name'], |
61 | 61 | ); |
62 | 62 | |
63 | - for($i = 1; $i < count($rank); $i++) |
|
63 | + for ($i = 1; $i < count($rank); $i++) |
|
64 | 64 | { |
65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
65 | + $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
66 | 66 | $rank_data['N' . $i] = $ally_rights[$i]; |
67 | 67 | } |
68 | 68 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @return mixed |
14 | 14 | * @deprecated |
15 | 15 | */ |
16 | -function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false){return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result));} |
|
16 | +function RestoreFleetToPlanet(&$fleet_row, $start = true, $only_resources = false, $safe_fleet = false) {return sn_function_call('RestoreFleetToPlanet', array(&$fleet_row, $start, $only_resources, $safe_fleet, &$result)); } |
|
17 | 17 | /** |
18 | 18 | * @param array $fleet_row |
19 | 19 | * @param bool $start |