@@ -7,6 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | |
9 | 9 | // TODO - remove public static function db_buddy_update_status($buddy_id, $status) { |
10 | + |
|
11 | + /** |
|
12 | + * @param integer $status |
|
13 | + */ |
|
10 | 14 | public function db_buddy_update_status($status) { |
11 | 15 | $buddy_id = idval($this->row['BUDDY_ID']); |
12 | 16 | |
@@ -31,6 +35,9 @@ discard block |
||
31 | 35 | ); |
32 | 36 | } |
33 | 37 | |
38 | + /** |
|
39 | + * @param string $new_request_text |
|
40 | + */ |
|
34 | 41 | public function db_buddy_insert($userId_safe, $new_friend_row_id_safe, $new_request_text) { |
35 | 42 | doquery("INSERT INTO `{{buddy}}` SET `BUDDY_SENDER_ID` = {$userId_safe}, `BUDDY_OWNER_ID` = '{$new_friend_row_id_safe}', `BUDDY_REQUEST` = '{$new_request_text}';"); |
36 | 43 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * |
10 | 10 | * Idea from buddy.php Created by Perberos. All rights reversed (C) 2006 |
11 | 11 | * */ |
12 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
12 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
13 | 13 | |
14 | 14 | class_exists('Buddy'); |
15 | 15 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // Checking for user ID - in case if it was request from outside buddy system |
55 | 55 | $new_friend_id = sys_get_param_id('request_user_id'); |
56 | 56 | $new_friend_name = sys_get_param_str_unsafe('request_user_name'); |
57 | - if($new_friend_id || $new_friend_name) { |
|
57 | + if ($new_friend_id || $new_friend_name) { |
|
58 | 58 | $buddy = classSupernova::$gc->buddy; |
59 | 59 | $new_request_text = sys_get_param_str('request_text'); |
60 | 60 | $buddy->beFriend($user, $new_friend_id, $new_friend_name, $new_request_text); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | ->setIdField($object::$idField) |
14 | 14 | ->field('*') |
15 | 15 | ->from($object::$tableName) |
16 | - ->where($object::$idField . ' = "' . $rowId . '"'); |
|
16 | + ->where($object::$idField.' = "'.$rowId.'"'); |
|
17 | 17 | |
18 | 18 | $object->row = $stmt->selectRow(); |
19 | 19 |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | if (!empty($error_msg)) { |
230 | 230 | // TODO - Убрать позже |
231 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
231 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
232 | 232 | $backtrace = debug_backtrace(); |
233 | 233 | array_shift($backtrace); |
234 | 234 | pdump($backtrace); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | public static function db_transaction_start($level = '') { |
242 | 242 | static::db_transaction_check(null); |
243 | 243 | |
244 | - $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
244 | + $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
245 | 245 | |
246 | 246 | static::$transaction_id++; |
247 | 247 | doquery('START TRANSACTION'); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | public static function db_lock_tables($tables) { |
306 | 306 | $tables = is_array($tables) ? $tables : array($tables => ''); |
307 | 307 | foreach ($tables as $table_name => $condition) { |
308 | - self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
308 | + self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | $query = static::db_query( |
366 | 366 | "SELECT |
367 | 367 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
368 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
369 | - ($filter ? ' WHERE ' . $filter : '') . |
|
368 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
369 | + ($filter ? ' WHERE '.$filter : ''). |
|
370 | 370 | ($fetch ? ' LIMIT 1' : ''), false, true); |
371 | 371 | |
372 | 372 | while ($row = db_fetch($query)) { |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | if ($indexes_str = implode(',', $parent_id_list)) { |
380 | 380 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
381 | 381 | static::db_get_record_list($owner_location_type, |
382 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
382 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | 387 | $query = static::db_query( |
388 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
388 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
389 | 389 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
390 | 390 | ); |
391 | 391 | while ($row = db_fetch($query)) { |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $condition = trim($condition); |
457 | 457 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
458 | 458 | |
459 | - if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
459 | + if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
460 | 460 | |
461 | 461 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
462 | 462 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
615 | 615 | |
616 | 616 | $user = static::db_query( |
617 | - "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
617 | + "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
618 | 618 | , true); |
619 | 619 | SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |
620 | 620 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) { |
674 | - $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . static::db_unit_time_restrictions()); |
|
674 | + $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".static::db_unit_time_restrictions()); |
|
675 | 675 | if (!empty($got_data) && is_array($got_data)) { |
676 | 676 | foreach ($got_data as $unit_id => $unit_data) { |
677 | 677 | SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
731 | 731 | $query[] = "`que_planet_id` IS NULL"; |
732 | 732 | } elseif ($planet_id) { |
733 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
733 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
734 | 734 | } |
735 | 735 | if ($que_type) { |
736 | 736 | $query[] = "`que_type` = {$que_type}"; |
@@ -844,13 +844,13 @@ discard block |
||
844 | 844 | $condition = "`{$field_name}` = "; |
845 | 845 | $value = ''; |
846 | 846 | if ($field_data['delta']) { |
847 | - $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
|
847 | + $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta']; |
|
848 | 848 | } elseif ($field_data['set']) { |
849 | 849 | $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
850 | 850 | } |
851 | 851 | |
852 | 852 | if ($value) { |
853 | - $fields[] = $condition . $value; |
|
853 | + $fields[] = $condition.$value; |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | $conditions[P_FIELDS_STR] = implode(',', $fields); |
@@ -864,9 +864,7 @@ discard block |
||
864 | 864 | // Простое условие - $field_id = $field_value |
865 | 865 | if (is_string($field_id)) { |
866 | 866 | $field_value = |
867 | - $field_value === null ? 'NULL' : |
|
868 | - (is_string($field_value) ? "'" . db_escape($field_value) . "'" : |
|
869 | - (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
867 | + $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
870 | 868 | $the_conditions[] = "`{$field_id}` = {$field_value}"; |
871 | 869 | } else { |
872 | 870 | die('Неподдерживаемый тип условия'); |
@@ -893,7 +891,7 @@ discard block |
||
893 | 891 | die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile'); |
894 | 892 | } |
895 | 893 | |
896 | - $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]); |
|
894 | + $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]); |
|
897 | 895 | } |
898 | 896 | |
899 | 897 | public static function db_changeset_apply($db_changeset, $flush_delayed = false) { |
@@ -981,7 +979,7 @@ discard block |
||
981 | 979 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
982 | 980 | if (@get_magic_quotes_gpc()) { |
983 | 981 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
984 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
982 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
985 | 983 | $value = stripslashes($value); |
986 | 984 | }); |
987 | 985 | } |
@@ -996,34 +994,34 @@ discard block |
||
996 | 994 | |
997 | 995 | $container = new Pimple\GlobalContainer(); |
998 | 996 | |
999 | - $container->db = function ($c) { |
|
997 | + $container->db = function($c) { |
|
1000 | 998 | $db = new db_mysql(); |
1001 | 999 | $db->sn_db_connect(); |
1002 | 1000 | |
1003 | 1001 | return $db; |
1004 | 1002 | }; |
1005 | 1003 | |
1006 | - $container->debug = function ($c) { |
|
1004 | + $container->debug = function($c) { |
|
1007 | 1005 | return new debug(); |
1008 | 1006 | }; |
1009 | 1007 | |
1010 | - $container->cache = function ($c) { |
|
1008 | + $container->cache = function($c) { |
|
1011 | 1009 | return new classCache(classSupernova::$cache_prefix); |
1012 | 1010 | }; |
1013 | 1011 | |
1014 | - $container->config = function ($c) { |
|
1012 | + $container->config = function($c) { |
|
1015 | 1013 | return new classConfig(classSupernova::$cache_prefix); |
1016 | 1014 | }; |
1017 | 1015 | |
1018 | - $container->dbRowOperator = function ($c) { |
|
1016 | + $container->dbRowOperator = function($c) { |
|
1019 | 1017 | return new DbRowSimple($c); |
1020 | 1018 | }; |
1021 | 1019 | |
1022 | - $container->buddy = $container->factory(function ($c) { |
|
1020 | + $container->buddy = $container->factory(function($c) { |
|
1023 | 1021 | return new Buddy($c); |
1024 | 1022 | }); |
1025 | 1023 | |
1026 | - $container->query = $container->factory(function (Pimple\GlobalContainer $c) { |
|
1024 | + $container->query = $container->factory(function(Pimple\GlobalContainer $c) { |
|
1027 | 1025 | return new DbQueryConstructor($c->db); |
1028 | 1026 | }); |
1029 | 1027 | |
@@ -1038,7 +1036,7 @@ discard block |
||
1038 | 1036 | public static function init_3_load_config_file() { |
1039 | 1037 | $dbsettings = array(); |
1040 | 1038 | |
1041 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
1039 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
1042 | 1040 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
1043 | 1041 | self::$db_name = $dbsettings['name']; |
1044 | 1042 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -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 | } |