/** * Prevent a user from seeing the login form if they are already logged in. * * @access protected * @return void */ protected function noLoginForLoggedIn() { if ($this->session->loggedIn()) { // If they are logged in and on the login page, send them to the homepage if ('login' == strtolower($this->getRequest()->getControllerName())) { $this->_redirect('/'); } } }
/** * Template method called by the constructor at construct time. This checks * for the presence of a Application_Model_Session object in the instance variable * and throws an exception if one is found. * * @access protected * @param array $params */ public function __construct($params = array()) { if (self::$instance instanceof Application_Model_Session) { die('CANNOT_INSTANTIATE_NEW_SESSION: The session object can only be created one time'); } // Set our instance so we can flag later instantiation attempts self::$instance = $this; // Set our request time $this->requesttime = time(); // Setup a new session id $this->id = $this->generateId(); // Get the IP address of the requestor $this->requestip = $this->request()->getServer('REMOTE_ADDR'); // Get the settings model - cookie data will have already been manipulated $this->settings = $this->settings(); // Get the user model of the current user $this->user = new Application_Model_User(); // Get our cookie names setup $this->cookiename = array('data' => $this->settings->cookiename . $this->settings->sessiondataname, 'id' => $this->settings->cookiename . $this->settings->sessionidname); }