示例#1
0
 /**
  * Creator 
  */
 function __construct($path)
 {
     parent::__construct($path);
     core::dprint('[users] construct');
     // load module stuff
     // need for module('auth')
     $this->users = $this->class_register('users', array('no_extra' => true, 'no_preload' => true));
     $this->anonymous = new anonymous_user($this->users);
 }
示例#2
0
 /**
  * constructor
  * $params goes to ->cfg('options.$')
  * @throws exception
  */
 public function __construct($params = array())
 {
     self::time_check('core-boot');
     // bogus: fix loop with get_instance
     if (!self::$_instance) {
         self::$_instance = $this;
     }
     $initilize_after_load = $params === true;
     if (empty($params) && !is_array($params)) {
         $params = array();
     }
     $cfg_file = @$params['config-file'] ?: 'engine';
     $cfg_file = loader::get_docs() . $cfg_file . '.cfg';
     if (fs::file_exists($cfg_file)) {
         // echo('[error] Configuration file not found');
         $this->init_config(parse_ini_file($cfg_file, true));
     }
     // override core-config
     if (!empty($params['config'])) {
         $this->config = array_merge($this->config, $params['config']);
     }
     // multiconfig config/domain.engine.cfg
     $host = @$_SERVER['HTTP_HOST'];
     $host = strpos($host, 'www.') === 0 ? substr($host, 4) : $host;
     if ($this->cfg('multidomain_config', false) && $host) {
         $host = str_replace(':', '.', $host);
         // localhost:8002
         $host_config = loader::get_docs() . $host . '.engine.cfg';
         if (fs::file_exists($host_config)) {
             $this->init_config(parse_ini_file($host_config, true), abs_config::INIT_APPEND);
         }
     }
     setlocale(LC_ALL, $locale = $this->cfg('locale', 'ru_RU.UTF8'));
     if (loader::is_windows()) {
         list($lang, $codeset) = explode('.', $locale);
         $lang = substr($lang, 0, 2);
         putenv('LANG=' . $lang . '.' . $codeset);
         putenv('LANGUAGE=' . $lang . '.' . $codeset);
         //bind_textdomain_codeset('mydomain', $codeset);
     }
     if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
         self::$system_libs = parse_ini_file($libs_file, true);
     }
     self::$libs = new core_libs();
     $duagent = $this->cfg('debugger_agent', 'iamdebugger');
     // compare only lside of agent, because firephp or something add its stuff to end
     if (isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) === $duagent || !empty($params['debug'])) {
         self::set_debug(!empty($params['debug']) ? $params['debug'] : $this->cfg('debug', self::E_INFO));
         if (!self::is_debug()) {
             self::register_lib('console', new SatCMS\Modules\Core\Console\FakeConsole());
         } else {
             if (array_key_exists('console', self::$system_libs)) {
                 // load external console
                 self::lib('console');
             } else {
                 // bind console (modules/core/console)
                 self::register_lib('console', new Debug_HackerConsole_Main(!$this->cfg('no_console') && !loader::in_shell() && !loader::in_ajax() || loader::in_ajax() && $this->cfg('debug_ajax', false)));
             }
         }
     } else {
         if (!loader::in_shell()) {
             self::$_debug_level = false;
             //@todo fix blank page on errors without debug enabled
             ini_set('display_errors', 'off');
         } else {
             // enable debug messages in shell
             self::set_debug($this->cfg('shell_debug_level', self::E_INFO));
         }
     }
     if (self::is_debug() && (!loader::in_ajax() || $this->cfg('debug_ajax', false)) && !loader::_option(loader::OPTION_TESTING) && class_exists('\\Whoops\\Run')) {
         $whoops = new \Whoops\Run();
         $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
         $whoops->register();
         $this->set_cfg_var('with_debugger', true);
     }
     // build module
     parent::__construct(loader::get_public(loader::DIR_MODULES) . __CLASS__ . '/', array('options' => $params));
     if ($initilize_after_load) {
         $this->init();
     }
 }
示例#3
0
 function __construct()
 {
     parent::__construct();
     $this->msg = new msg();
     $this->users = new users();
 }
示例#4
0
 /**
  * constructor
  * @throws exception
  */
 function __construct()
 {
     $cfg_file = loader::get_docs() . 'engine.cfg';
     if (fs::file_exists($cfg_file)) {
         // echo('[error] Configuration file not found');
         $this->init_config(parse_ini_file($cfg_file, true));
     }
     if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
         self::$system_libs = parse_ini_file($libs_file);
     }
     self::$libs = new registry();
     $duagent = $this->get_cfg_var('debugger_agent', 'iamdebugger');
     // compare only lside of agent, cause firephp or something adds its stuff to end
     if (!isset($_SERVER['HTTP_USER_AGENT']) || substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) != $duagent) {
         if (!loader::in_shell()) {
             self::$_debug_level = false;
             ini_set('display_errors', 'off');
         } else {
             // enable debug messages in shell
             self::set_debug($this->get_cfg_var('shell_debug_level', self::E_INFO));
         }
     } else {
         // disable console when
         if ((self::$_debug_level = $this->get_cfg_var('debug')) && !$this->get_cfg_var('no_console') && !loader::in_ajax()) {
             self::register_lib('console', new Debug_HackerConsole_Main(!loader::in_shell()));
         }
     }
     // Init cacher
     if (self::lib_enabled('cache')) {
         $cache = $this->lib('cache');
         $cache->set_rate((int) $this->get_cfg_var('cache_rate', 1));
     }
     /*  
         @TODO get rid of them, compatibility only?
         ident vars
         using globals $cmd_{xxx} is depricated 
         do the $core->get_ident_var('{xxx}') instead;
     */
     // @todo use self::TAG_ ..
     self::$ident_vars = new registry(array('id' => 0 >= ($tmp = functions::request_var('id', -1)) ? false : $tmp, 'pid' => 0 >= ($tmp = functions::request_var('pid', -1)) ? false : $tmp, 'c' => functions::request_var('c', ''), 'op' => functions::request_var('op', ''), 'do' => functions::request_var('do', ''), 'type' => functions::request_var('type', ''), 'embed' => functions::request_var('embed', ''), 'start' => functions::request_var('start', 0), '2print' => functions::request_var('2print', ''), 'module' => preg_replace('/[^\\w\\d]/', '', functions::request_var('m', ''))));
     // construct module
     parent::__construct(loader::get_root() . loader::DIR_MODULES . __CLASS__ . '/');
 }