/** * Dispatch the request * * @param Library\CommandContext $context A command context object */ protected function _actionDispatch(Library\CommandContext $context) { //Render the page if (!$context->response->isRedirect() && $context->request->getFormat() == 'html') { //Render the page $config = array('response' => $context->response); $layout = $context->request->query->get('tmpl', 'cmd', 'default'); if (!$this->isPermitted('render')) { $layout = 'login'; } $this->getObject('com:application.controller.page', $config)->layout($layout)->render(); } parent::_actionDispatch($context); }
/** * Load the user session or create a new one * * Old sessions are flushed based on the configuration value for the cookie lifetime. If an existing session, * then the last access time is updated. If a new session, a session id is generated and a record is created * in the users_sessions table. * * @return void */ public function getUser() { if (!$this->_user instanceof Library\DispatcherUserInterface) { $user = parent::getUser(); $session = $user->getSession(); //Set Session Name $session->setName(md5($this->getCfg('secret') . $this->getCfg('session_name'))); //Set Session Lifetime $session->setLifetime($this->getCfg('lifetime', 15) * 60); //Set Session Handler $session->setHandler('database', array('table' => 'com:users.database.table.sessions')); //Set Session Options $session->setOptions(array('cookie_path' => (string) $this->getRequest()->getBaseUrl()->getPath() ?: '/', 'cookie_secure' => $this->getCfg('force_ssl') == 2 ? true : false)); //Auto-start the session if a cookie is found if (!$session->isActive()) { if ($this->getRequest()->cookies->has($session->getName())) { $session->start(); } } //Re-create the session if we changed sites if ($user->isAuthentic() && $session->site != $this->getSite()) { //@TODO : Fix this //if(!$this->getObject('com:users.controller.session')->add()) { // $session->destroy(); //} } } return parent::getUser(); }