public static function init() { if (Session::exists('language')) { // The Language was already set; nothing to do. return; } else { if (Cookie::exists(PREFIX . 'language')) { $cookie = Cookie::get(PREFIX . 'language'); if (preg_match('/[a-z]/', $cookie) && in_array($cookie, self::$codes)) { Session::set('language', ucfirst($cookie)); } } } }
/** * Password Recovery */ public function recovery() { $data['title'] = $this->language->get('title_recovery'); if (isset($_POST['submit'])) { $email = $_POST['email']; //validation if (Password::verify($password, $this->model->getHash($username)) == false) { $error[] = $this->language->get('error_recovery'); } //if validation has passed carry on if (!$error) { $userDb = $this->model->getUser($username); $user = $userDb[0]; Session::set('loggedin', true); Session::set('id', $user->id); Session::set('first_name', $user->first_name); Session::set('last_name', $user->last_name); Session::set('timezone', $user->timezone); Session::set('dateformat', $user->dateformat); Session::set('timeformat', $user->timeformat); Session::set('dateformat_moment', Date::convertPHPToMomentFormat($user->dateformat)); Session::set('timeformat_moment', Date::convertPHPToMomentFormat($user->timeformat)); Session::set('language_id', 1); Session::set('language_code', 'en'); if (!Cookie::exists('navigation')) { Cookie::set('navigation', ''); } Log::info('logged_in'); //$data = array('lastLogin' => date('Y-m-d H:i:s')); //$where = array('id' => $this->_model->getId($username)); //$this->_model->update($data,$where); Url::redirect(); } else { $data['username'] = $username; } } View::renderTemplate('header', $data, 'auth'); View::render('auth/recovery', $data, $error); View::renderTemplate('footer', $data, 'auth'); }