Esempio n. 1
0
 protected function flog($message, $die = false)
 {
     if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
         return;
     }
     list($called, $caller) = debug_backtrace(false);
     $caller_name = (get_called_class() ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')) . (!empty($caller['type']) ? $caller['type'] : '') . (!empty($caller['function']) ? $caller['function'] : '') . (!empty($called['line']) ? ':' . $called['line'] : '');
     //     $real_caller_class = get_called_class();
     $_SERVER['SERVER_NAME'] == 'localhost' ? print "<div class='debug'>{$message} - {$caller_name}\r\n</div>" : false;
     classSupernova::log_file("{$message} - {$caller_name}");
     if ($die) {
         // pdump($caller);
         // pdump(debug_backtrace(false));
         $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
     }
 }
Esempio n. 2
0
 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;
 }