@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * <p>null - транзакция НЕ должна быть запущена</p> |
| 324 | 324 | * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
| 325 | 325 | * <p>false - всё равно - для совместимости с $for_update</p> |
| 326 | - * @return bool Текущий статус транзакции |
|
| 326 | + * @return null|boolean Текущий статус транзакции |
|
| 327 | 327 | */ |
| 328 | 328 | public static function db_transaction_check($status = null) { |
| 329 | 329 | $error_msg = false; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | /** |
| 400 | 400 | * Блокирует указанные таблицу/список таблиц |
| 401 | 401 | * |
| 402 | - * @param string|array $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов |
|
| 402 | + * @param string $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов |
|
| 403 | 403 | * <p>string - название таблицы для блокировки</p> |
| 404 | 404 | * <p>array - массив, где ключ - имя таблицы, а значение - условия блокировки элементов</p> |
| 405 | 405 | */ |
@@ -574,6 +574,9 @@ discard block |
||
| 574 | 574 | return $result; |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | + /** |
|
| 578 | + * @param integer $location_type |
|
| 579 | + */ |
|
| 577 | 580 | public static function db_ins_field_set($location_type, $field_set, $serialize = false) { |
| 578 | 581 | // TODO multiinsert |
| 579 | 582 | !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set, $serialize) : false; |
@@ -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,41 +54,41 @@ 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 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | // Initializing global 'debug' object |
| 107 | 107 | classSupernova::$debug = new debug(); |
| 108 | 108 | |
| 109 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
| 109 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
| 110 | 110 | classSupernova::init_main_db(new db_mysql()); |
| 111 | 111 | |
| 112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | //require_once('classes/sn_module.php'); |
| 117 | 117 | |
| 118 | 118 | //require_once('classes/userOptions.php'); |
| 119 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
| 119 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * @var classConfig $config |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | // define('BE_DEBUG', true); // Отладка боевого движка |
| 130 | 130 | classSupernova::init_debug_state(); |
| 131 | 131 | |
| 132 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
| 133 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
| 132 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
| 133 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
| 134 | 134 | |
| 135 | 135 | init_update(); |
| 136 | 136 | |
@@ -139,28 +139,28 @@ discard block |
||
| 139 | 139 | ? trim(strip_tags($_GET['page'])) |
| 140 | 140 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
| 141 | 141 | define('INITIAL_PAGE', $sn_page_name_original); |
| 142 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
| 143 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
| 144 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
| 145 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
| 146 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
| 147 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
| 148 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
| 142 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
| 143 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
| 144 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
| 145 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
| 146 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
| 147 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
| 148 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
| 149 | 149 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
| 150 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
| 151 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
| 150 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
| 151 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
| 152 | 152 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
| 153 | 153 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
| 154 | 154 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
| 155 | 155 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
| 156 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
| 156 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
| 157 | 157 | |
| 158 | 158 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
| 159 | 159 | |
| 160 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
| 160 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
| 161 | 161 | $template_result = array('.' => array('result' => array())); |
| 162 | 162 | |
| 163 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
| 163 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | // Конфиг - часть манифеста? |
| 173 | 173 | classSupernova::$auth = new core_auth(); |
| 174 | 174 | |
| 175 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
| 175 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
| 176 | 176 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
| 177 | 177 | |
| 178 | 178 | // Подключаем дефолтную страницу |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
| 181 | 181 | // Но нужно, пока у нас есть не MVC-страницы |
| 182 | 182 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
| 183 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
| 184 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 183 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
| 184 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 185 | 185 | require_once($sn_page_name_file); |
| 186 | - if(is_array($sn_page_data['options'])) { |
|
| 186 | + if (is_array($sn_page_data['options'])) { |
|
| 187 | 187 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | $load_order = array(); |
| 199 | 199 | $sn_req = array(); |
| 200 | 200 | |
| 201 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
| 201 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
| 202 | 202 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
| 203 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
| 204 | - foreach($module_data->manifest['require'] as $require_name) { |
|
| 203 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
| 204 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
| 205 | 205 | $sn_req[$loaded_module_name][$require_name] = 0; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | do { |
| 215 | 215 | $prev_order = $load_order; |
| 216 | 216 | |
| 217 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
| 217 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
| 218 | 218 | $level = 1; |
| 219 | - foreach($req_data as $req_name => &$req_level) { |
|
| 220 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
| 219 | + foreach ($req_data as $req_name => &$req_level) { |
|
| 220 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
| 221 | 221 | $level = $req_level = -1; |
| 222 | 222 | break; |
| 223 | 223 | } else { |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | $req_level = $load_order[$req_name]; |
| 227 | 227 | } |
| 228 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
| 228 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
| 229 | 229 | $load_order[$loaded_module_name] = $level; |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | -} while($prev_order != $load_order); |
|
| 232 | +} while ($prev_order != $load_order); |
|
| 233 | 233 | |
| 234 | 234 | asort($load_order); |
| 235 | 235 | |
| 236 | 236 | // Инициализируем модули |
| 237 | 237 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
| 238 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
| 239 | - if($load_order_order >= 0) { |
|
| 238 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
| 239 | + if ($load_order_order >= 0) { |
|
| 240 | 240 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
| 241 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
| 241 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
| 242 | 242 | unset(sn_module::$sn_module[$loaded_module_name]); |
| 243 | 243 | continue; |
| 244 | 244 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | unset($sn_req); |
| 256 | 256 | |
| 257 | 257 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 258 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
| 258 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
| 259 | 259 | $sn_page_name = ''; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -263,6 +263,6 @@ discard block |
||
| 263 | 263 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
| 264 | 264 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
| 265 | 265 | |
| 266 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
| 266 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
| 267 | 267 | require_once "init_secondary.php"; |
| 268 | 268 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | default: |
| 99 | 99 | switch (self::$mode) { |
| 100 | 100 | case CACHER_NO_CACHE: |
| 101 | - self::$data[$this->prefix . $name] = $value; |
|
| 101 | + self::$data[$this->prefix.$name] = $value; |
|
| 102 | 102 | break; |
| 103 | 103 | |
| 104 | 104 | case CACHER_XCACHE: |
| 105 | - xcache_set($this->prefix . $name, $value); |
|
| 105 | + xcache_set($this->prefix.$name, $value); |
|
| 106 | 106 | break; |
| 107 | 107 | } |
| 108 | 108 | break; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | default: |
| 123 | 123 | switch (self::$mode) { |
| 124 | 124 | case CACHER_NO_CACHE: |
| 125 | - return self::$data[$this->prefix . $name]; |
|
| 125 | + return self::$data[$this->prefix.$name]; |
|
| 126 | 126 | break; |
| 127 | 127 | |
| 128 | 128 | case CACHER_XCACHE: |
| 129 | - return xcache_get($this->prefix . $name); |
|
| 129 | + return xcache_get($this->prefix.$name); |
|
| 130 | 130 | break; |
| 131 | 131 | |
| 132 | 132 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | public function __isset($name) { |
| 140 | 140 | switch (self::$mode) { |
| 141 | 141 | case CACHER_NO_CACHE: |
| 142 | - return isset(self::$data[$this->prefix . $name]); |
|
| 142 | + return isset(self::$data[$this->prefix.$name]); |
|
| 143 | 143 | break; |
| 144 | 144 | |
| 145 | 145 | case CACHER_XCACHE: |
| 146 | - return xcache_isset($this->prefix . $name) && ($this->__get($name) !== null); |
|
| 146 | + return xcache_isset($this->prefix.$name) && ($this->__get($name) !== null); |
|
| 147 | 147 | break; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,25 +153,25 @@ discard block |
||
| 153 | 153 | public function __unset($name) { |
| 154 | 154 | switch (self::$mode) { |
| 155 | 155 | case CACHER_NO_CACHE: |
| 156 | - unset(self::$data[$this->prefix . $name]); |
|
| 156 | + unset(self::$data[$this->prefix.$name]); |
|
| 157 | 157 | break; |
| 158 | 158 | |
| 159 | 159 | case CACHER_XCACHE: |
| 160 | - xcache_unset($this->prefix . $name); |
|
| 160 | + xcache_unset($this->prefix.$name); |
|
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function unset_by_prefix($prefix_unset = '') { |
| 166 | 166 | static $array_clear; |
| 167 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
| 167 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
| 168 | 168 | strpos($k, $p) === 0 ? $v = null : false; |
| 169 | 169 | } : false; |
| 170 | 170 | |
| 171 | 171 | switch (self::$mode) { |
| 172 | 172 | case CACHER_NO_CACHE: |
| 173 | 173 | // array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset); |
| 174 | - array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset); |
|
| 174 | + array_walk(self::$data, $array_clear, $this->prefix.$prefix_unset); |
|
| 175 | 175 | |
| 176 | 176 | return true; |
| 177 | 177 | break; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - return xcache_unset_by_prefix($this->prefix . $prefix_unset); |
|
| 184 | + return xcache_unset_by_prefix($this->prefix.$prefix_unset); |
|
| 185 | 185 | break; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($this->$name[0] === null) { |
| 220 | 220 | for ($i = count($name) - 1; $i > 0; $i--) { |
| 221 | 221 | $cName = "{$name[$i]}_COUNT"; |
| 222 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 222 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 223 | 223 | if ($this->$cName1 == null || $i == 1) { |
| 224 | 224 | $this->$cName++; |
| 225 | 225 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | for ($i = 1; $i < count($name); $i++) { |
| 266 | 266 | $cName = "{$name[$i]}_COUNT"; |
| 267 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
| 267 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
| 268 | 268 | |
| 269 | 269 | if ($i == 1 || $this->$cName1 === null) { |
| 270 | 270 | $this->$cName--; |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
| 191 | 191 | |
| 192 | 192 | // Alliance bonus calculations |
| 193 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 193 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 194 | 194 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
| 195 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
| 195 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
| 196 | 196 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
| 197 | 197 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
| 198 | 198 | |
@@ -223,25 +223,25 @@ discard block |
||
| 223 | 223 | 'deuterium_basic_income' => 0, |
| 224 | 224 | 'eco_scale_storage' => 1, |
| 225 | 225 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
| 226 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 226 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 227 | 227 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
| 228 | 228 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
| 229 | 229 | 'energy_basic_income' => 0, |
| 230 | 230 | |
| 231 | 231 | // Bashing protection settings |
| 232 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 233 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 234 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 235 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 236 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 232 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 233 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 234 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 235 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 236 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 237 | 237 | |
| 238 | 238 | 'Fleet_Cdr' => 30, |
| 239 | 239 | 'fleet_speed' => 1, |
| 240 | 240 | |
| 241 | 241 | 'fleet_update_interval' => 4, |
| 242 | 242 | |
| 243 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 244 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 243 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 244 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 245 | 245 | // Defaults |
| 246 | 246 | 'game_default_language' => 'ru', |
| 247 | 247 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | 'game_maxSystem' => 199, |
| 256 | 256 | 'game_maxPlanet' => 15, |
| 257 | 257 | // Game global settings |
| 258 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 258 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 259 | 259 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
| 260 | 260 | |
| 261 | 261 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
| 262 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 262 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 263 | 263 | // Noob protection |
| 264 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 264 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 265 | 265 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
| 266 | 266 | |
| 267 | 267 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | 'payment_currency_exchange_wmu' => 30, |
| 312 | 312 | 'payment_currency_exchange_wmz' => 1, |
| 313 | 313 | |
| 314 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
| 315 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 314 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
| 315 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 316 | 316 | |
| 317 | 317 | 'planet_teleport_cost' => 50000, // |
| 318 | 318 | 'planet_teleport_timeout' => 86400, // |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | 'resource_multiplier' => 1, |
| 331 | 331 | |
| 332 | 332 | //Roleplay system |
| 333 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 333 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 334 | 334 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
| 335 | 335 | |
| 336 | 336 | // Black Market - General |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | $qry[] = "('{$item_name}', '{$item_value}')"; |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | - doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";"); |
|
| 99 | + doquery("REPLACE INTO `{{".$this->table_name."}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES ".implode(',', $qry).";"); |
|
| 100 | 100 | |
| 101 | 101 | // И только после взятия блокировок - меняем значения в кэше |
| 102 | 102 | foreach ($item_list as $item_name => $item_value) { |