public function getFlash() { if ($this->hasFlash()) { $flash = $_SESSION['flash']; unset($_SESSION['flash']); return Secure::toClient($flash); } return ''; }
public function get($varName, $alt = '') { if (array_key_exists($varName, $this->views)) { return $this->views[$varName]; } elseif (array_key_exists($varName, $this->vars)) { return Secure::toClient($this->vars[$varName]); } elseif (array_key_exists($varName, $GLOBALS)) { return Secure::toClient($GLOBALS[$varName]); } return $alt; }
public function executeTryLogUp(HTTPRequest $request) { //On récupère le manager de Users $manager = $this->getManagerOf($this->module(), 'Users'); //Verify if this nickname already exists if ($manager->exists($request->postData('nickname'))) { echo 'nickname'; exit; } else { if ($manager->exists($request->postData('mail'))) { echo 'mail'; exit; } else { //Create a new user $newUser = new User(['nickname' => $request->postData('nickname'), 'pass' => Secure::passHash($request->postData('pass')), 'mail' => $request->postData('mail'), 'authLevel' => User::MEMBER]); //Save into dataBase $manager->save($newUser); if ($GLOBALS['userManager']->set($request->postData('nickname'), $request->postData('pass'))) { echo 'ok'; exit; } } } }