@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param int $sigma |
19 | 19 | * @param bool $strict |
20 | 20 | * |
21 | - * @return int |
|
21 | + * @return double |
|
22 | 22 | */ |
23 | 23 | public static function sn_rand_gauss($mu = 0, $sigma = 1, $strict = false) { |
24 | 24 | // http://ru.wikipedia.org/wiki/Среднеквадратическое_отклонение |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param float $range_start - Начало диапазона |
44 | 44 | * @param float $range_end - Конец диапазона |
45 | - * @param bool|int $round - До скольки знаков округлять результат. False - не округлять, True - округлять до целого, 1 - округлять до десятков, 2 - до сотен итд |
|
45 | + * @param boolean $round - До скольки знаков округлять результат. False - не округлять, True - округлять до целого, 1 - округлять до десятков, 2 - до сотен итд |
|
46 | 46 | * @param int $strict - В сколько сигм надо уложить результат |
47 | 47 | * @param bool|false $cut_extreme - надо ли обрезать крайние значения. Например, при $strict = 2 их слишком много |
48 | 48 | * |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | if ($logProcess) { |
132 | - pdump($linear, 'Нормализовано по х' . $from); |
|
132 | + pdump($linear, 'Нормализовано по х'.$from); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | for ($i = $from + 1; $i < count($linear); $i++) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | } |
141 | 141 | if ($logProcess) { |
142 | - pdump($linear, 'Подставили х' . $from); |
|
142 | + pdump($linear, 'Подставили х'.$from); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if ($from < count($linear) - 1) { |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | } |
155 | 155 | } |
156 | 156 | if ($logProcess) { |
157 | - pdump($linear, 'Подставили обратно х' . $from); |
|
157 | + pdump($linear, 'Подставили обратно х'.$from); |
|
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | if ($logProcess) { |
161 | - pdump($linear, 'Результат' . $from); |
|
161 | + pdump($linear, 'Результат'.$from); |
|
162 | 162 | } |
163 | 163 | foreach ($linear as $index => &$eq) { |
164 | - pdump($eq[count($linear)], 'x' . $index); |
|
164 | + pdump($eq[count($linear)], 'x'.$index); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | require_once('general_pname.php'); |
12 | 12 | |
13 | 13 | /** |
14 | - * @param $func_name |
|
14 | + * @param string $func_name |
|
15 | 15 | * @param array $func_arg |
16 | 16 | * |
17 | 17 | * @return mixed |
@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // ---------------------------------------------------------------------------------------------------------------- |
65 | +/** |
|
66 | + * @param string $filename |
|
67 | + */ |
|
65 | 68 | function sys_file_read($filename) { |
66 | 69 | return @file_get_contents($filename); |
67 | 70 | } |
@@ -104,7 +107,7 @@ discard block |
||
104 | 107 | /** |
105 | 108 | * Получение курса обмены валюты в серверную валюту |
106 | 109 | * |
107 | - * @param $currency_symbol |
|
110 | + * @param string $currency_symbol |
|
108 | 111 | * |
109 | 112 | * @return float |
110 | 113 | */ |
@@ -130,7 +133,7 @@ discard block |
||
130 | 133 | * - true - colors number to green if positive or zero; red if negative |
131 | 134 | * - 0 |
132 | 135 | * - numeric - colors number to green if less then $color; red if greater |
133 | - * @param int|bool $limit - generally converts "15000" to "15k", "2000000" to "2kk" etc |
|
136 | + * @param boolean $limit - generally converts "15000" to "15k", "2000000" to "2kk" etc |
|
134 | 137 | * - 0/false - proceed with $floor |
135 | 138 | * - numeric - divides number to segments by power of $limit and adds 'k' for each segment |
136 | 139 | * - makes sense for 1000, but works with any number |
@@ -229,6 +232,9 @@ discard block |
||
229 | 232 | return preg_replace($ListCensure, '*', $String); |
230 | 233 | } |
231 | 234 | |
235 | +/** |
|
236 | + * @param string $email |
|
237 | + */ |
|
232 | 238 | function is_email($email) { |
233 | 239 | return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)); |
234 | 240 | } |
@@ -266,6 +272,9 @@ discard block |
||
266 | 272 | return floatval(sys_get_param($param_name, $default)); |
267 | 273 | } |
268 | 274 | |
275 | +/** |
|
276 | + * @param string $param_name |
|
277 | + */ |
|
269 | 278 | function sys_get_param_escaped($param_name, $default = '') { |
270 | 279 | return db_escape(sys_get_param($param_name, $default)); |
271 | 280 | } |
@@ -434,6 +443,9 @@ discard block |
||
434 | 443 | } |
435 | 444 | |
436 | 445 | // Generates random string of $length symbols from $allowed_chars charset |
446 | +/** |
|
447 | + * @param string $allowed_chars |
|
448 | + */ |
|
437 | 449 | function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) { |
438 | 450 | $allowed_length = strlen($allowed_chars); |
439 | 451 | |
@@ -538,6 +550,10 @@ discard block |
||
538 | 550 | return implode(';', $fleet_string); |
539 | 551 | } |
540 | 552 | |
553 | +/** |
|
554 | + * @param string $title |
|
555 | + * @param string $body |
|
556 | + */ |
|
541 | 557 | function mymail($email_unsafe, $title, $body, $from = '', $html = false) { |
542 | 558 | $from = trim($from ? $from : classSupernova::$config->game_adminEmail); |
543 | 559 | |
@@ -803,6 +819,9 @@ discard block |
||
803 | 819 | return serialize($nick_array); |
804 | 820 | } |
805 | 821 | |
822 | +/** |
|
823 | + * @param string $nick_string |
|
824 | + */ |
|
806 | 825 | function player_nick_uncompact($nick_string) { |
807 | 826 | try { |
808 | 827 | $result = unserialize($nick_string); |
@@ -990,6 +1009,9 @@ discard block |
||
990 | 1009 | return $result; |
991 | 1010 | } |
992 | 1011 | |
1012 | +/** |
|
1013 | + * @param string $groups |
|
1014 | + */ |
|
993 | 1015 | function isInGroup($groups, $unitId) { |
994 | 1016 | $group = sn_get_groups($groups); |
995 | 1017 | |
@@ -1058,6 +1080,9 @@ discard block |
||
1058 | 1080 | return $ranks; |
1059 | 1081 | } |
1060 | 1082 | |
1083 | +/** |
|
1084 | + * @param boolean $planet_id |
|
1085 | + */ |
|
1061 | 1086 | function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); } |
1062 | 1087 | |
1063 | 1088 | function sn_sys_player_new_adjust($user_id, $planet_id, &$result) { |
@@ -1216,6 +1241,9 @@ discard block |
||
1216 | 1241 | return $rates; |
1217 | 1242 | } |
1218 | 1243 | |
1244 | +/** |
|
1245 | + * @param integer $in_resource |
|
1246 | + */ |
|
1219 | 1247 | function get_unit_cost_in(&$cost, $in_resource = RES_METAL) { |
1220 | 1248 | static $rates; |
1221 | 1249 | |
@@ -1382,6 +1410,9 @@ discard block |
||
1382 | 1410 | return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2)); |
1383 | 1411 | } |
1384 | 1412 | |
1413 | +/** |
|
1414 | + * @param string $name |
|
1415 | + */ |
|
1385 | 1416 | function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) { |
1386 | 1417 | $_COOKIE[$name] = $value; |
1387 | 1418 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | // ------------------------------------------------------------------------------------------------------------------------------ |
4 | 4 | function sn_sys_load_php_files($dir_name, $load_extension = '.php', $modules = false) { |
5 | - if(!file_exists($dir_name) || !is_dir($dir_name)) { |
|
5 | + if (!file_exists($dir_name) || !is_dir($dir_name)) { |
|
6 | 6 | return; |
7 | 7 | } |
8 | 8 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | continue; |
13 | 13 | } |
14 | 14 | |
15 | - $full_filename = $dir_name . $file; |
|
15 | + $full_filename = $dir_name.$file; |
|
16 | 16 | if ($modules && is_dir($full_filename)) { |
17 | 17 | if (file_exists($full_filename = "{$full_filename}/{$file}{$load_extension}")) { |
18 | 18 | require_once($full_filename); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * |
39 | 39 | */ |
40 | 40 | function init_update() { |
41 | - $update_file = SN_ROOT_PHYSICAL . "includes/update" . DOT_PHP_EX; |
|
42 | - if(file_exists($update_file)) { |
|
43 | - if(filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | - if(defined('IN_ADMIN')) { |
|
41 | + $update_file = SN_ROOT_PHYSICAL."includes/update".DOT_PHP_EX; |
|
42 | + if (file_exists($update_file)) { |
|
43 | + if (filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | + if (defined('IN_ADMIN')) { |
|
45 | 45 | sn_db_transaction_start(); // Для защиты от двойного запуска апдейта - начинаем транзакцию. Так запись в базе будет блокирована |
46 | - if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
46 | + if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
47 | 47 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW + (classSupernova::$config->upd_lock_time ? classSupernova::$config->upd_lock_time : 300)); |
48 | 48 | sn_db_transaction_commit(); |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $current_time = time(); |
54 | 54 | classSupernova::$config->db_saveItem('var_db_update', $current_time); |
55 | 55 | classSupernova::$config->db_saveItem('var_db_update_end', $current_time); |
56 | - } elseif(filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
56 | + } elseif (filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
57 | 57 | $timeout = classSupernova::$config->var_db_update_end - SN_TIME_NOW; |
58 | 58 | die( |
59 | 59 | "Обновляется база данных. Рассчетное время окончания - {$timeout} секунд (время обновления может увеличиваться). Пожалуйста, подождите...<br /> |
@@ -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,46 +54,46 @@ 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 | -define('DOT_PHP_EX', '.' . $phpEx); // PHP extension on this server |
|
77 | +define('DOT_PHP_EX', '.'.$phpEx); // PHP extension on this server |
|
78 | 78 | |
79 | 79 | |
80 | 80 | header('Content-type: text/html; charset=utf-8'); |
81 | 81 | ob_start(); |
82 | 82 | ini_set('error_reporting', E_ALL ^ E_NOTICE); |
83 | 83 | |
84 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'includes/classes/' : false; |
|
85 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
84 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'includes/classes/' : false; |
|
85 | +spl_autoload_register(function($class) use ($classRoot) { |
|
86 | 86 | $class = str_replace('\\', '/', $class); |
87 | - if (file_exists($classRoot . $class . '.php')) { |
|
88 | - require_once $classRoot . $class . '.php'; |
|
89 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
90 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
87 | + if (file_exists($classRoot.$class.'.php')) { |
|
88 | + require_once $classRoot.$class.'.php'; |
|
89 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
90 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
91 | 91 | } |
92 | 92 | }); |
93 | 93 | |
94 | 94 | require_once 'constants.php'; |
95 | -require_once SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX; |
|
96 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
95 | +require_once SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX; |
|
96 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @var classConfig $config |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | // define('BE_DEBUG', true); // Отладка боевого движка |
112 | 112 | classSupernova::init_debug_state(); |
113 | 113 | |
114 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
115 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
114 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
115 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
116 | 116 | |
117 | 117 | init_update(); |
118 | 118 | |
@@ -121,28 +121,28 @@ discard block |
||
121 | 121 | ? trim(strip_tags($_GET['page'])) |
122 | 122 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
123 | 123 | define('INITIAL_PAGE', $sn_page_name_original); |
124 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
127 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
128 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
129 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
130 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
124 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
127 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
128 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
129 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
130 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
131 | 131 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
132 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
133 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
132 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
133 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
134 | 134 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
135 | 135 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
136 | 136 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
137 | 137 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
138 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
138 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
139 | 139 | |
140 | 140 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
141 | 141 | |
142 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
142 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
143 | 143 | $template_result = array('.' => array('result' => array())); |
144 | 144 | |
145 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", DOT_PHP_EX); |
|
145 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", DOT_PHP_EX); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // Подключаем все модули |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Конфиг - часть манифеста? |
153 | 153 | classSupernova::$auth = new core_auth(); |
154 | 154 | |
155 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", DOT_PHP_EX, true); |
|
155 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", DOT_PHP_EX, true); |
|
156 | 156 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
157 | 157 | |
158 | 158 | // Подключаем дефолтную страницу |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
161 | 161 | // Но нужно, пока у нас есть не MVC-страницы |
162 | 162 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
163 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
164 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
163 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
164 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
165 | 165 | require_once($sn_page_name_file); |
166 | - if(is_array($sn_page_data['options'])) { |
|
166 | + if (is_array($sn_page_data['options'])) { |
|
167 | 167 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
168 | 168 | } |
169 | 169 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
176 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
176 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
177 | 177 | $sn_page_name = ''; |
178 | 178 | } |
179 | 179 | |
@@ -181,6 +181,6 @@ discard block |
||
181 | 181 | classLocale::$lang = $lang = classSupernova::$gc->localePlayer; |
182 | 182 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
183 | 183 | |
184 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
184 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
185 | 185 | require_once "init_secondary.php"; |
186 | 186 | } |
@@ -13,9 +13,9 @@ |
||
13 | 13 | |
14 | 14 | $allow_anonymous = true; |
15 | 15 | |
16 | -include('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
|
16 | +include('includes/init.'.substr(strrchr(__FILE__, '.'), 1)); |
|
17 | 17 | // die(); |
18 | -if($template_result[F_USER_IS_AUTHORIZED]) { |
|
18 | +if ($template_result[F_USER_IS_AUTHORIZED]) { |
|
19 | 19 | sys_redirect('index.php'); |
20 | 20 | } |
21 | 21 | lng_include('login'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | global $user, $planetrow; |
17 | 17 | |
18 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
18 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
19 | 19 | |
20 | 20 | lng_include('infos'); |
21 | 21 | lng_include('artifacts'); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | die(); |
67 | 67 | break; |
68 | 68 | } |
69 | - message($Message, classLocale::$lang['tech'][UNIT_ARTIFACTS], 'artifacts' . DOT_PHP_EX, 5); |
|
69 | + message($Message, classLocale::$lang['tech'][UNIT_ARTIFACTS], 'artifacts'.DOT_PHP_EX, 5); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $template = gettemplate('artifacts', true); |