public function sign_out() { /** @var AuthenticationHandler $auth */ $auth = Application::getInstance()->authenticationHandler; $auth::getInstance()->unsetUserSession(); Go::to(); }
public function index() { if (!empty(AuthenticationHandler::$data)) { Go::to('a'); } $f = new Form('search'); $this->addForm('search', $f); $this->setTitle('Savely.co'); $this->addScript('Dabox'); $this->addScript('Request'); $this->addScript('StageChart'); $form_register = new Form('register'); if ($form_register->isValid()) { $values = $form_register->getValues(); } $this->addForm('register', $form_register); $form = new Form('login'); if ($form->isValid()) { $values = $form->getValues(); if (AuthenticationHandler::setUserSession($values['login'], $values['password'])) { Go::to('a'); } else { $this->addContent('login_error', Dictionary::term('login.error.unknown_user')); } } $m = new ModelLink(); $all = $m->retrieveLinksHome(); $this->addContent('products', $all); $this->addForm('login', $form); }
public function update() { $links = $this->model_link->retrieveLinksByUser(AuthenticationHandler::$data['id_user']); foreach ($links as $l) { $this->model_link->updateLink($l['url_link']); } Go::to('a'); }
function __construct() { AuthenticationHandler::getInstance(); if (!AuthenticationHandler::$data) { Go::to(); } $this->addScript('ShopLater'); $f = new Form('search'); $this->addForm('search', $f); $f = new Form('addEntry'); $this->addForm('addUrl', $f); $m = new ModelList(); $this->addContent('user_lists', $m->retrieveByUser(AuthenticationHandler::$data['id_user'], 5)); }
public function redirectToDefaultItem() { $item = null; if (is_array($this->items) && !empty($this->items)) { $item = $this->items[0]; } foreach ($this->items as $i) { if (isset($i['default']) && $i['default'] == true) { $item = $i; } } if ($item === null) { trigger_error("[Object Menu] No default item found", E_USER_WARNING); return; } Go::to($item['controller'], $item['action'], $item['parameters']); }
/** * Méthode de suppression d'une entrée * Renvoie systématiquement à l'action "lister" * @return void */ public function delete() { if (!$this->actions->isEnabled('delete')) { Go::to404(); } $this->model->deleteById($_GET["id"]); $this->dispatchEvent(new Event(self::EVENT_SUCCESSUL_DELETE)); Go::to($this->className); }
/** * @static * @param $pURL * @return bool|string */ public static function extractLanguage(&$pURL) { if (Application::getInstance()->multiLanguage && !preg_match("/^statique/", $pURL, $matches)) { $language = self::shift($pURL, self::REGEXP_LANGUAGE); if (!$language) { Go::to("", "", array(), Application::getInstance()->defaultLanguage); } return $language; } return Application::getInstance()->defaultLanguage; }