/** * Initial startup function * to register session, create database and imap connections * * @todo Remove global vars $DB, $USER */ private function startup() { // initialize syslog if ($this->config->get('log_driver') == 'syslog') { $syslog_id = $this->config->get('syslog_id', 'roundcube'); $syslog_facility = $this->config->get('syslog_facility', LOG_USER); openlog($syslog_id, LOG_ODELAY, $syslog_facility); } // connect to database $GLOBALS['DB'] = $this->get_dbh(); // start session $this->session_init(); // create user object $this->set_user(new rcube_user($_SESSION['user_id'])); // configure session (after user config merge!) $this->session_configure(); // set task and action properties $this->set_task(get_input_value('_task', RCUBE_INPUT_GPC)); $this->action = asciiwords(get_input_value('_action', RCUBE_INPUT_GPC)); // reset some session parameters when changing task if ($_SESSION['task'] != $this->task) { $this->session->remove('page'); } // set current task to session $_SESSION['task'] = $this->task; // init output class if (!empty($_REQUEST['_remote'])) { $GLOBALS['OUTPUT'] = $this->json_init(); } else { $GLOBALS['OUTPUT'] = $this->load_gui(!empty($_REQUEST['_framed'])); } // create plugin API and load plugins $this->plugins = rcube_plugin_api::get_instance(); // init plugins $this->plugins->init(); }
/** * Initial startup function */ protected function init($mode = 0) { // initialize syslog if ($this->config->get('log_driver') == 'syslog') { $syslog_id = $this->config->get('syslog_id', 'roundcube'); $syslog_facility = $this->config->get('syslog_facility', LOG_USER); openlog($syslog_id, LOG_ODELAY, $syslog_facility); } // connect to database if ($mode & self::INIT_WITH_DB) { $this->get_dbh(); } // create plugin API and load plugins if ($mode & self::INIT_WITH_PLUGINS) { $this->plugins = rcube_plugin_api::get_instance(); } }
/** * Initial startup function * to register session, create database and imap connections * * @todo Remove global vars $DB, $USER */ private function startup() { $config_all = $this->config->all(); // initialize syslog if ($this->config->get('log_driver') == 'syslog') { $syslog_id = $this->config->get('syslog_id', 'roundcube'); $syslog_facility = $this->config->get('syslog_facility', LOG_USER); openlog($syslog_id, LOG_ODELAY, $syslog_facility); } // set task and action properties $this->set_task(get_input_value('_task', RCUBE_INPUT_GPC)); $this->action = asciiwords(get_input_value('_action', RCUBE_INPUT_GPC)); // connect to database $GLOBALS['DB'] = $this->get_dbh(); // use database for storing session data include_once 'include/session.inc'; // set session domain if (!empty($config_all['session_domain'])) { ini_set('session.cookie_domain', $config_all['session_domain']); } // set session garbage collecting time according to session_lifetime if (!empty($config_all['session_lifetime'])) { ini_set('session.gc_maxlifetime', $config_all['session_lifetime'] * 120); } // start PHP session (if not in CLI mode) if ($_SERVER['REMOTE_ADDR']) { session_start(); } // set initial session vars if (!isset($_SESSION['auth_time'])) { $_SESSION['auth_time'] = time(); $_SESSION['temp'] = true; } // create user object $this->set_user(new rcube_user($_SESSION['user_id'])); // reset some session parameters when changing task if ($_SESSION['task'] != $this->task) { rcube_sess_unset('page'); } // set current task to session $_SESSION['task'] = $this->task; // create IMAP object if ($this->task == 'mail') { $this->imap_init(); } // create plugin API and load plugins $this->plugins = rcube_plugin_api::get_instance(); }