public function lng_switch($language_new) { global $language, $user, $sn_mvc; classSupernova::log_file("locale.switch: Request for switch to '{$language_new}'", 1); $language_new = str_replace(array('?', '&', 'lang='), '', $language_new); $language_new = $language_new ? $language_new : (!empty($user['lang']) ? $user['lang'] : DEFAULT_LANG); classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); if ($language_new == $this->active) { classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); return false; } $this->active = $language = $language_new; $this->cache_prefix_lang = $this->cache_prefix . $this->active . '_'; $this['LANG_INFO'] = $this->lng_get_info($this->active); $this->make_fallback($this->active); if ($this->cache) { $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); 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); if ($cache_lang_init_status) { return false; } // Чистим текущие локализации из кэша. Достаточно почистить только флаги инициализации языкового кэша и загрузки файлов - они начинаются с '__' classSupernova::log_file("locale.switch: Cache - invalidating data"); $this->cache->unset_by_prefix($this->cache_prefix_lang . '__'); } $this->lng_include('system'); // $this->lng_include('menu'); $this->lng_include('tech'); $this->lng_include('payment'); // Loading global language files $this->lng_load_i18n($sn_mvc['i18n']['']); if ($this->cache) { classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); $this->cache->__set($this->cache_prefix_lang . '__INIT', true); } classSupernova::log_file("locale.switch: Complete - EXIT"); return true; }
public function __construct($gamePrefix = 'sn_') { parent::__construct("{$gamePrefix}dbcache_"); }
public function __construct($gamePrefix = 'sn_', $table_name = 'table') { parent::__construct("{$gamePrefix}{$table_name}_"); $this->table_name = $table_name; $this->sql_index_field = "{$table_name}_name"; $this->sql_value_field = "{$table_name}_value"; if (!$this->_DB_LOADED) { $this->db_loadAll(); } }