@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | define('SN_IN_FLEET', true); |
6 | 6 | define('SN_RENDER_NAVBAR_PLANET', true); |
7 | 7 | |
8 | -include('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
8 | +include('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
9 | 9 | |
10 | 10 | // TODO - Переместить это куда-нибудь |
11 | 11 | $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode')); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | // break; |
193 | 193 | } |
194 | 194 | |
195 | - if($exceptionCode !== null) { |
|
196 | - print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</span><br />'); |
|
195 | + if ($exceptionCode !== null) { |
|
196 | + print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</span><br />'); |
|
197 | 197 | print('<div style="color: red; font-size: 200%;">NO EXCEPTION RAISED</div>'); |
198 | 198 | pdie(); |
199 | 199 | } else { |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | if ($exceptionCode !== null && $e->getCode() === $exceptionCode) { |
204 | 204 | // print('<span style="color: darkgreen;">Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - passed</span><br />'); |
205 | 205 | } else { |
206 | - print('<div style="color: red; font-size: 200%;">Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</div>'); |
|
207 | - print('<div style="color: red; font-size: 200%;">Got Exception [' . $e->getCode() . ']: "' . $e->getMessage() . '"/"' . classLocale::$lang['fl_attack_error'][$e->getCode()] . '" . "</div>'); |
|
206 | + print('<div style="color: red; font-size: 200%;">Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</div>'); |
|
207 | + print('<div style="color: red; font-size: 200%;">Got Exception ['.$e->getCode().']: "'.$e->getMessage().'"/"'.classLocale::$lang['fl_attack_error'][$e->getCode()].'" . "</div>'); |
|
208 | 208 | throw $e; |
209 | 209 | } |
210 | 210 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // Removing comment placeholder from statement |
165 | 165 | $this->queryPrepared = str_replace(static::COMMENT_PLACEHOLDER, DbSqlHelper::quoteComment($this->comment), $this->queryPrepared); |
166 | 166 | // Removing comment value from values list |
167 | - $this->paramsPrepared = array_filter($this->paramsPrepared, function ($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
167 | + $this->paramsPrepared = array_filter($this->paramsPrepared, function($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
168 | 168 | // TODO - Add comment value directly to statement |
169 | 169 | } |
170 | 170 | |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | public function getIterator() { |
271 | - if(DbSqlPrepare::$isUseGetResult) { |
|
271 | + if (DbSqlPrepare::$isUseGetResult) { |
|
272 | 272 | $mysqli_result = $this->statement->get_result(); |
273 | - if($mysqli_result instanceof mysqli_result) { |
|
273 | + if ($mysqli_result instanceof mysqli_result) { |
|
274 | 274 | $iterator = new DbMysqliResultIterator($this->statement->get_result()); |
275 | 275 | } else { |
276 | 276 | $iterator = new DbEmptyIterator(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function load_db_settings() { |
66 | 66 | $dbsettings = array(); |
67 | 67 | |
68 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
68 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
69 | 69 | |
70 | 70 | $this->dbsettings = $dbsettings; |
71 | 71 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $sql = $query; |
131 | 131 | if (strpos($sql, '{{') !== false) { |
132 | 132 | foreach ($this->table_list as $tableName) { |
133 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
133 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $arr = debug_backtrace(); |
151 | 151 | $file = end(explode('/', $arr[0]['file'])); |
152 | 152 | $line = $arr[0]['line']; |
153 | - classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> " . ($fetch ? '+' : ' ') . " </th></tr>"); |
|
153 | + classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> ".($fetch ? '+' : ' ')." </th></tr>"); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | |
211 | 211 | $queryResult = null; |
212 | 212 | try { |
213 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
213 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
214 | 214 | if (!$queryResult) { |
215 | 215 | throw new Exception(); |
216 | 216 | } |
217 | 217 | } catch (Exception $e) { |
218 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
218 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ($fetch) { |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | $this->isWatching = true; |
337 | 337 | $msg = "\$query = \"{$query}\"\n\r"; |
338 | 338 | if (!empty($_POST)) { |
339 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
339 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
340 | 340 | } |
341 | 341 | if (!empty($_GET)) { |
342 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
342 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
343 | 343 | } |
344 | 344 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
345 | 345 | $this->isWatching = false; |
@@ -365,37 +365,37 @@ discard block |
||
365 | 365 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
366 | 366 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
367 | 367 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
368 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
368 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
369 | 369 | $report .= ">Database Inforamation\n"; |
370 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
371 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
372 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
373 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
374 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
375 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
376 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
377 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
378 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
379 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
370 | + $report .= "\tID - ".$user['id']."\n"; |
|
371 | + $report .= "\tUser - ".$user['username']."\n"; |
|
372 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
373 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
374 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
375 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
376 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
377 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
378 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
379 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
380 | 380 | $report .= "\n"; |
381 | 381 | |
382 | 382 | $report .= ">Query Information\n"; |
383 | - $report .= "\tQuery - " . $query . "\n"; |
|
383 | + $report .= "\tQuery - ".$query."\n"; |
|
384 | 384 | $report .= "\n"; |
385 | 385 | |
386 | 386 | $report .= ">\$_SERVER Information\n"; |
387 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
388 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
389 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
390 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
391 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
392 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
393 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
394 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
387 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
388 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
389 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
390 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
391 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
392 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
393 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
394 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
395 | 395 | |
396 | 396 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
397 | 397 | |
398 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
398 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
399 | 399 | fwrite($fp, $report); |
400 | 400 | fclose($fp); |
401 | 401 |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | $this->container = array(); |
37 | 37 | |
38 | - if(classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
38 | + if (classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
39 | 39 | $this->cache = classSupernova::$cache; |
40 | 40 | classSupernova::log_file('locale.__constructor: Cache is present'); |
41 | 41 | //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug! |
42 | 42 | } |
43 | 43 | |
44 | - if($enable_stat_usage && empty($this->stat_usage)) { |
|
44 | + if ($enable_stat_usage && empty($this->stat_usage)) { |
|
45 | 45 | $this->enable_stat_usage = $enable_stat_usage; |
46 | 46 | $this->usage_stat_load(); |
47 | 47 | // TODO shutdown function |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | unset($fallback[$this->active]); |
68 | 68 | |
69 | 69 | // Проходим по оставшимся локалям |
70 | - foreach($fallback as $try_language) { |
|
70 | + foreach ($fallback as $try_language) { |
|
71 | 71 | // Если нет такой строки - пытаемся вытащить из кэша |
72 | - if(!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | - $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset); |
|
72 | + if (!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | + $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix.$try_language.'_'.$offset); |
|
74 | 74 | // Записываем результат работы кэша |
75 | 75 | $locale_cache_statistic['queries']++; |
76 | 76 | isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['hits']++ : $locale_cache_statistic['misses']++; |
77 | -!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix . $try_language . '_' . $offset : false; |
|
77 | +!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix.$try_language.'_'.$offset : false; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Если мы как-то где-то нашли строку... |
81 | - if(isset($this->container[$try_language][$offset])) { |
|
81 | + if (isset($this->container[$try_language][$offset])) { |
|
82 | 82 | // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер |
83 | 83 | $this[$offset] = $this->container[$try_language][$offset]; |
84 | 84 | $locale_cache_statistic['fallbacks']++; |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | $this->container[$this->active][] = $value; |
95 | 95 | } else { |
96 | 96 | $this->container[$this->active][$offset] = $value; |
97 | - if($this->cache) { |
|
98 | - $this->cache->__set($this->cache_prefix_lang . $offset, $value); |
|
97 | + if ($this->cache) { |
|
98 | + $this->cache->__set($this->cache_prefix_lang.$offset, $value); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | public function offsetExists($offset) { |
103 | 103 | // Шорткат если у нас уже есть строка в памяти PHP |
104 | - if(!isset($this->container[$this->active][$offset])) { |
|
104 | + if (!isset($this->container[$this->active][$offset])) { |
|
105 | 105 | // pdump($this->cache_prefix_lang . $offset); |
106 | - if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
106 | + if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang.$offset))) { |
|
107 | 107 | // pdump($this->cache_prefix_lang . $offset); |
108 | 108 | // Если нету такой строки - делаем фоллбэк |
109 | 109 | $this->locale_string_fallback($offset); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | public function offsetGet($offset) { |
121 | 121 | $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null; |
122 | - if($this->enable_stat_usage) { |
|
122 | + if ($this->enable_stat_usage) { |
|
123 | 123 | $this->usage_stat_log($offset, $value); |
124 | 124 | } |
125 | 125 | return $value; |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | public function usage_stat_load() { |
137 | - $this->stat_usage = classSupernova::$cache->lng_stat_usage = array(); // TODO for debug |
|
138 | - if(empty($this->stat_usage)) { |
|
137 | + $this->stat_usage = classSupernova::$cache->lng_stat_usage = array(); // TODO for debug |
|
138 | + if (empty($this->stat_usage)) { |
|
139 | 139 | $query = doquery("SELECT * FROM {{lng_usage_stat}}"); |
140 | - while($row = db_fetch($query)) { |
|
141 | - $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty']; |
|
140 | + while ($row = db_fetch($query)) { |
|
141 | + $this->stat_usage[$row['lang_code'].':'.$row['string_id'].':'.$row['file'].':'.$row['line']] = $row['is_empty']; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | } |
145 | 145 | public function usage_stat_save() { |
146 | - if(!empty($this->stat_usage_new)) { |
|
146 | + if (!empty($this->stat_usage_new)) { |
|
147 | 147 | classSupernova::$cache->lng_stat_usage = $this->stat_usage; |
148 | 148 | doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1"); |
149 | - foreach($this->stat_usage_new as &$value) { |
|
150 | - foreach($value as &$value2) { |
|
151 | - $value2 = '"' . db_escape($value2) . '"'; |
|
149 | + foreach ($this->stat_usage_new as &$value) { |
|
150 | + foreach ($value as &$value2) { |
|
151 | + $value2 = '"'.db_escape($value2).'"'; |
|
152 | 152 | } |
153 | - $value = '(' . implode(',', $value) .')'; |
|
153 | + $value = '('.implode(',', $value).')'; |
|
154 | 154 | } |
155 | - doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new)); |
|
155 | + doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES ".implode(',', $this->stat_usage_new)); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | public function usage_stat_log(&$offset, &$value) { |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | |
163 | 163 | $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1)); |
164 | 164 | |
165 | - $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line']; |
|
166 | - if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
165 | + $string_id = $this->active.':'.$offset.':'.$file.':'.$trace[1]['line']; |
|
166 | + if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
167 | 167 | $this->stat_usage[$string_id] = empty($value); |
168 | 168 | $this->stat_usage_new[] = array( |
169 | 169 | 'lang_code' => $this->active, |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | 'file' => $file, |
172 | 172 | 'line' => $trace[1]['line'], |
173 | 173 | 'is_empty' => intval(empty($value)), |
174 | - 'locale' => '' . $value, |
|
174 | + 'locale' => ''.$value, |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | 180 | protected function lng_try_filepath($path, $file_path_relative) { |
181 | - $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
|
181 | + $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative; |
|
182 | 182 | return file_exists($file_path) ? $file_path : false; |
183 | 183 | } |
184 | 184 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | classSupernova::log_file("locale.include: Loading data from domain '{$filename}'", 1); |
202 | 202 | |
203 | - $cache_file_key = $this->cache_prefix_lang . '__' . $filename; |
|
203 | + $cache_file_key = $this->cache_prefix_lang.'__'.$filename; |
|
204 | 204 | |
205 | 205 | // Подключен ли внешний кэш? |
206 | - if($this->cache) { |
|
206 | + if ($this->cache) { |
|
207 | 207 | // Загружен ли уже данный файл? |
208 | 208 | $cache_file_status = $this->cache->__get($cache_file_key); |
209 | - 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); |
|
210 | - if($cache_file_status) { |
|
209 | + 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); |
|
210 | + if ($cache_file_status) { |
|
211 | 211 | // Если да - повторять загрузку нет смысла |
212 | 212 | return null; |
213 | 213 | } |
@@ -221,47 +221,47 @@ discard block |
||
221 | 221 | $this->make_fallback($language); |
222 | 222 | |
223 | 223 | $file_path = ''; |
224 | - foreach($this->fallback as $lang_try) { |
|
225 | - if(!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
224 | + foreach ($this->fallback as $lang_try) { |
|
225 | + if (!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
229 | - if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
229 | + if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | |
233 | - if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
233 | + if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
234 | 234 | break; |
235 | 235 | } |
236 | 236 | |
237 | 237 | $file_path = ''; |
238 | 238 | } |
239 | 239 | |
240 | - if($file_path) { |
|
240 | + if ($file_path) { |
|
241 | 241 | $a_lang_array = array(); |
242 | 242 | include($file_path); |
243 | 243 | |
244 | - if(!empty($a_lang_array)) { |
|
244 | + if (!empty($a_lang_array)) { |
|
245 | 245 | $this->merge($a_lang_array); |
246 | 246 | |
247 | 247 | // Загрузка данных из файла в кэш |
248 | - if($this->cache) { |
|
248 | + if ($this->cache) { |
|
249 | 249 | classSupernova::log_file("Locale: loading '{$filename}' into cache"); |
250 | - foreach($a_lang_array as $key => $value) { |
|
251 | - $value_cache_key = $this->cache_prefix_lang . $key; |
|
252 | - if($this->cache->__isset($value_cache_key)) { |
|
253 | - if(is_array($value)) { |
|
250 | + foreach ($a_lang_array as $key => $value) { |
|
251 | + $value_cache_key = $this->cache_prefix_lang.$key; |
|
252 | + if ($this->cache->__isset($value_cache_key)) { |
|
253 | + if (is_array($value)) { |
|
254 | 254 | $alt_value = $this->cache->__get($value_cache_key); |
255 | 255 | $value = array_replace_recursive($alt_value, $value); |
256 | 256 | // pdump($alt_value, $alt_value); |
257 | 257 | } |
258 | 258 | } |
259 | - $this->cache->__set($this->cache_prefix_lang . $key, $value); |
|
259 | + $this->cache->__set($this->cache_prefix_lang.$key, $value); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - if($this->cache) { |
|
264 | + if ($this->cache) { |
|
265 | 265 | $this->cache->__set($cache_file_key, true); |
266 | 266 | } |
267 | 267 | |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | public function lng_load_i18n($i18n) { |
277 | - if(!isset($i18n)) { |
|
277 | + if (!isset($i18n)) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - foreach($i18n as $i18n_data) { |
|
282 | - if(is_string($i18n_data)) { |
|
281 | + foreach ($i18n as $i18n_data) { |
|
282 | + if (is_string($i18n_data)) { |
|
283 | 283 | $this->lng_include($i18n_data); |
284 | - } elseif(is_array($i18n_data)) { |
|
284 | + } elseif (is_array($i18n_data)) { |
|
285 | 285 | $this->lng_include($i18n_data['file'], $i18n_data['path']); |
286 | 286 | } |
287 | 287 | } |
@@ -299,27 +299,27 @@ discard block |
||
299 | 299 | |
300 | 300 | classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); |
301 | 301 | |
302 | - if($language_new == $this->active) { |
|
302 | + if ($language_new == $this->active) { |
|
303 | 303 | classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); |
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | |
307 | 307 | $this->active = $language = $language_new; |
308 | - $this->cache_prefix_lang = $this->cache_prefix . $this->active . '_'; |
|
308 | + $this->cache_prefix_lang = $this->cache_prefix.$this->active.'_'; |
|
309 | 309 | |
310 | 310 | $this['LANG_INFO'] = $this->lng_get_info($this->active); |
311 | 311 | $this->make_fallback($this->active); |
312 | 312 | |
313 | - if($this->cache) { |
|
314 | - $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); |
|
315 | - 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); |
|
316 | - if($cache_lang_init_status) { |
|
313 | + if ($this->cache) { |
|
314 | + $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang.'__INIT'); |
|
315 | + 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); |
|
316 | + if ($cache_lang_init_status) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Чистим текущие локализации из кэша. Достаточно почистить только флаги инициализации языкового кэша и загрузки файлов - они начинаются с '__' |
321 | 321 | classSupernova::log_file("locale.switch: Cache - invalidating data"); |
322 | - $this->cache->unset_by_prefix($this->cache_prefix_lang . '__'); |
|
322 | + $this->cache->unset_by_prefix($this->cache_prefix_lang.'__'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | $this->lng_include('system'); |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | // Loading global language files |
330 | 330 | $this->lng_load_i18n(classSupernova::$sn_mvc['i18n']['']); |
331 | 331 | |
332 | - if($this->cache) { |
|
333 | - classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); |
|
334 | - $this->cache->__set($this->cache_prefix_lang . '__INIT', true); |
|
332 | + if ($this->cache) { |
|
333 | + classSupernova::log_file("locale.switch: Cache - setting flag ".$this->cache_prefix_lang.'__INIT'); |
|
334 | + $this->cache->__set($this->cache_prefix_lang.'__INIT', true); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | classSupernova::log_file("locale.switch: Complete - EXIT"); |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | |
342 | 342 | |
343 | 343 | public function lng_get_info($entry) { |
344 | - $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php'; |
|
344 | + $file_name = SN_ROOT_PHYSICAL.'language/'.$entry.'/language.mo.php'; |
|
345 | 345 | $lang_info = array(); |
346 | - if(file_exists($file_name)) { |
|
346 | + if (file_exists($file_name)) { |
|
347 | 347 | include($file_name); |
348 | 348 | } |
349 | 349 | |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | public function lng_get_list() { |
354 | - if(empty($this->lang_list)) { |
|
354 | + if (empty($this->lang_list)) { |
|
355 | 355 | $this->lang_list = array(); |
356 | 356 | |
357 | - $path = SN_ROOT_PHYSICAL . 'language/'; |
|
357 | + $path = SN_ROOT_PHYSICAL.'language/'; |
|
358 | 358 | $dir = dir($path); |
359 | - while(false !== ($entry = $dir->read())) { |
|
360 | - if(is_dir($path . $entry) && $entry[0] != '.') { |
|
359 | + while (false !== ($entry = $dir->read())) { |
|
360 | + if (is_dir($path.$entry) && $entry[0] != '.') { |
|
361 | 361 | $lang_info = $this->lng_get_info($entry); |
362 | - if($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
362 | + if ($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
363 | 363 | $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info; |
364 | 364 | } |
365 | 365 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // TODO - rewrite |
229 | 229 | public function getParamsFromStaticClass($className) { |
230 | 230 | if (is_string($className) && $className && class_exists($className)) { |
231 | - if(method_exists($className, 'getDb')) { |
|
231 | + if (method_exists($className, 'getDb')) { |
|
232 | 232 | $this->setDb($className::getDb()); |
233 | 233 | } |
234 | 234 | $this->from($className::$_table); |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | protected function compileFrom() { |
320 | - $this->_compiledQuery[] = 'FROM `{{' . $this->escapeString($this->table) . '}}`'; |
|
320 | + $this->_compiledQuery[] = 'FROM `{{'.$this->escapeString($this->table).'}}`'; |
|
321 | 321 | if (!empty($this->alias)) { |
322 | - $this->_compiledQuery[] = 'AS `' . $this->escapeString($this->alias) . '`'; |
|
322 | + $this->_compiledQuery[] = 'AS `'.$this->escapeString($this->alias).'`'; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -329,29 +329,29 @@ discard block |
||
329 | 329 | |
330 | 330 | protected function compileWhere() { |
331 | 331 | // TODO - fields should be escaped !! |
332 | - !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false; |
|
332 | + !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | protected function compileGroupBy() { |
336 | 336 | // TODO - fields should be escaped !! |
337 | 337 | // !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false; |
338 | - !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . $this->selectFieldsToString($this->groupBy) : false; |
|
338 | + !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.$this->selectFieldsToString($this->groupBy) : false; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | protected function compileOrderBy() { |
342 | 342 | // TODO - fields should be escaped !! |
343 | - !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
343 | + !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | protected function compileHaving() { |
347 | 347 | // TODO - fields should be escaped !! |
348 | - !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false; |
|
348 | + !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | protected function compileLimit() { |
352 | 352 | // TODO - fields should be escaped !! |
353 | 353 | if ($limit = $this->fetchOne ? 1 : $this->limit) { |
354 | - $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : ''); |
|
354 | + $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : ''); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | */ |
396 | 396 | protected function processField($fieldName) { |
397 | 397 | if (is_bool($fieldName)) { |
398 | - $result = (string)intval($fieldName); |
|
398 | + $result = (string) intval($fieldName); |
|
399 | 399 | } elseif (is_numeric($fieldName)) { |
400 | 400 | $result = $fieldName; |
401 | 401 | } elseif (is_null($fieldName)) { |
402 | 402 | $result = 'NULL'; |
403 | 403 | } else { |
404 | 404 | // Field has other type - string or should be convertible to string |
405 | - $result = (string)$fieldName; |
|
405 | + $result = (string) $fieldName; |
|
406 | 406 | if (!$fieldName instanceof DbSqlLiteral) { |
407 | 407 | $result = $this->quoteField($fieldName); |
408 | 408 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $stmt = |
85 | 85 | static::buildDBQ() |
86 | 86 | ->fields($fieldList) |
87 | - ->where(static::$_idField . '=' . $recordId); |
|
87 | + ->where(static::$_idField.'='.$recordId); |
|
88 | 88 | |
89 | 89 | if ($forUpdate) { |
90 | 90 | $stmt->setForUpdate(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $query = |
106 | 106 | static::buildDBQ() |
107 | 107 | ->fields(static::$_idField) |
108 | - ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")")) |
|
108 | + ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")")) |
|
109 | 109 | ->selectIterator(); |
110 | 110 | } else { |
111 | 111 | $query = new DbEmptyIterator(); |
@@ -239,7 +239,7 @@ |
||
239 | 239 | |
240 | 240 | $factory = $this->values[$id]; |
241 | 241 | |
242 | - $extended = function ($c) use ($callable, $factory) { |
|
242 | + $extended = function($c) use ($callable, $factory) { |
|
243 | 243 | return $callable($factory($c), $c); |
244 | 244 | }; |
245 | 245 |
@@ -125,7 +125,7 @@ |
||
125 | 125 | * @since 5.1.0 |
126 | 126 | */ |
127 | 127 | public function count() { |
128 | - throw new Exception('You should implement ' . get_called_class() . '::count()'); |
|
128 | + throw new Exception('You should implement '.get_called_class().'::count()'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | } |
@@ -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 | |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | define('SN_DEBUG_PDUMP_CALLER', true); |
20 | 20 | |
21 | 21 | // Бенчмарк |
22 | -register_shutdown_function(function () { |
|
23 | - if(defined('IN_AJAX')) { |
|
22 | +register_shutdown_function(function() { |
|
23 | + if (defined('IN_AJAX')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | 27 | global $user, $locale_cache_statistic; |
28 | 28 | |
29 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
30 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
31 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
29 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
30 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
31 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
32 | 32 | '</div>'); |
33 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
33 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
34 | 34 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
35 | 35 | } |
36 | 36 | |
37 | - if(!empty($locale_cache_statistic['misses'])) { |
|
37 | + if (!empty($locale_cache_statistic['misses'])) { |
|
38 | 38 | print('<!--'); |
39 | 39 | pdump($locale_cache_statistic); |
40 | 40 | print('-->'); |
@@ -54,47 +54,47 @@ discard block |
||
54 | 54 | |
55 | 55 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
56 | 56 | |
57 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
57 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | 58 | define('SN_GOOGLE', true); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Эти три строки должны быть В ЭТОМ ФАЙЛЕ, ПО ЭТОМУ ПУТИ и ПЕРЕД ЭТИМ ИНКЛЮДОМ!!! |
62 | -define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__) . '/')); |
|
62 | +define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__).'/')); |
|
63 | 63 | define('SN_ROOT_PHYSICAL_STR_LEN', strlen(SN_ROOT_PHYSICAL)); |
64 | 64 | $phpbb_root_path = SN_ROOT_PHYSICAL; // Это нужно для работы PTL |
65 | 65 | |
66 | -$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd() . '/'); |
|
66 | +$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd().'/'); |
|
67 | 67 | //$sn_root_relative .= $sn_root_relative[strlen($sn_root_relative) - 1] == '/' ? '' : '/'; |
68 | 68 | $sn_root_relative = str_replace(SN_ROOT_PHYSICAL, '', $sn_root_relative); |
69 | 69 | $sn_root_relative .= basename($_SERVER['SCRIPT_NAME']); |
70 | 70 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
71 | 71 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
72 | 72 | |
73 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
73 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
74 | 74 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
75 | 75 | |
76 | 76 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
77 | 77 | define('PHP_EX', $phpEx); // PHP extension on this server |
78 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
78 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
79 | 79 | |
80 | 80 | |
81 | 81 | header('Content-type: text/html; charset=utf-8'); |
82 | 82 | ob_start(); |
83 | 83 | ini_set('error_reporting', E_ALL ^ E_NOTICE); |
84 | 84 | |
85 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'includes/classes/' : false; |
|
86 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
85 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'includes/classes/' : false; |
|
86 | +spl_autoload_register(function($class) use ($classRoot) { |
|
87 | 87 | $class = str_replace('\\', '/', $class); |
88 | - if (file_exists($classRoot . $class . '.php')) { |
|
89 | - require_once $classRoot . $class . '.php'; |
|
90 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
91 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
88 | + if (file_exists($classRoot.$class.'.php')) { |
|
89 | + require_once $classRoot.$class.'.php'; |
|
90 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
91 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
92 | 92 | } |
93 | 93 | }); |
94 | 94 | |
95 | 95 | require_once 'constants.php'; |
96 | -require_once SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX; |
|
97 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
96 | +require_once SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX; |
|
97 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @var classConfig $config |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | // define('BE_DEBUG', true); // Отладка боевого движка |
115 | 115 | classSupernova::init_debug_state(); |
116 | 116 | |
117 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
118 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
117 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
118 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
119 | 119 | |
120 | 120 | init_update(); |
121 | 121 | |
@@ -124,28 +124,28 @@ discard block |
||
124 | 124 | ? trim(strip_tags($_GET['page'])) |
125 | 125 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
126 | 126 | define('INITIAL_PAGE', $sn_page_name_original); |
127 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
128 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
129 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
130 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
131 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
132 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
133 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
127 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
128 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
129 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
130 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
131 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
132 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
133 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
134 | 134 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
135 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
136 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
135 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
136 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
137 | 137 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
138 | 138 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
139 | 139 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
140 | 140 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
141 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
141 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
142 | 142 | |
143 | 143 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
144 | 144 | |
145 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
145 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
146 | 146 | $template_result = array('.' => array('result' => array())); |
147 | 147 | |
148 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
148 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // Конфиг - часть манифеста? |
158 | 158 | classSupernova::$auth = new core_auth(); |
159 | 159 | |
160 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
160 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
161 | 161 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
162 | 162 | |
163 | 163 | // Подключаем дефолтную страницу |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
166 | 166 | // Но нужно, пока у нас есть не MVC-страницы |
167 | 167 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
168 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
169 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
168 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
169 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
170 | 170 | require_once($sn_page_name_file); |
171 | - if(is_array($sn_page_data['options'])) { |
|
171 | + if (is_array($sn_page_data['options'])) { |
|
172 | 172 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
173 | 173 | } |
174 | 174 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | |
180 | 180 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
181 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
181 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
182 | 182 | $sn_page_name = ''; |
183 | 183 | } |
184 | 184 | |
@@ -186,6 +186,6 @@ discard block |
||
186 | 186 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
187 | 187 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
188 | 188 | |
189 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
189 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
190 | 190 | require_once "init_secondary.php"; |
191 | 191 | } |