/** * * @param string $hash * @return Ajde_Resource */ public static function fromHash($hash) { // TODO: throw new Deprecated(); $session = new Session('AC.Resource'); return $session->get($hash); }
public function getAuthenticationURL($returnto = '') { $connection = $this->getProvider(); // set returnto in session, google is very strict with callback urls $returntoSession = new Session('returnto'); $returntoSession->set("url", $returnto); return $connection->createAuthUrl(); }
public static function verifyFormTime() { $session = new Session('AC.Form'); $sessionTime = $session->get('formTime'); if (time() - $sessionTime < self::FORM_MIN_TIME || time() - $sessionTime > self::FORM_MAX_TIME) { return false; } else { return true; } }
/** * * @param array $viewParams * @param boolean|string $persist * @return Ajde_Collection_View */ public function getCollectionView($viewParams = array(), $persist = 'auto') { if (!$this->getCollection()->hasView()) { $viewSession = new Session('AC.Crud.View'); $sessionName = $this->getSessionName(); if ($viewSession->has($sessionName)) { $crudView = $viewSession->get($sessionName); } else { $crudView = new View($sessionName, $this->getOption('list.view', array())); $crudView->setColumns($this->getOption('list.show', $this->getFieldNames())); } // somehow, when altering crudView, the instance in the session gets updated as well, and we don't want that $crudView = clone $crudView; if (empty($viewParams)) { $viewParams = Ajde::app()->getRequest()->getParam('view', array()); // if we have params, but no columns, assume a reset if (!empty($viewParams) && !isset($viewParams['columns'])) { $viewParams['columns'] = $this->getOption('list.show', $this->getFieldNames()); } } $crudView->setOptions($viewParams); if ($persist == 'auto' && $this->getOperation() == 'list' || $persist === true) { $viewSession->set($sessionName, $crudView); } $this->getCollection()->setView($crudView); } return $this->getCollection()->getView(); }
public function logout() { // First destroy current session // TODO: overhead to call session_regenerate_id? is it not required?? //session_regenerate_id(); $session = new Session('user'); $session->destroy(); $cookie = new Cookie(Config::get('ident') . '_user'); $cookie->destroy(); self::$_user = null; }