public function logout() { $user = Fari_User::getCredentials(); Fari_Message::notify("Thanks for the visit {$user}."); Fari_User::signOut(); $this->redirect('/secure/'); }
public function _init() { // a listing of articles in the footer $this->view->list = !Fari_User::isAuthenticated('realname') ? Fari_Db::select('articles', 'name, published, slug', array('status' => 1), 'published DESC', BLOG_LIST) : Fari_Db::select('articles', 'name, published, slug', NULL, 'published DESC', BLOG_LIST); // articles archive (no limit on number of articles) $this->view->archive = !Fari_User::isAuthenticated('realname') ? Fari_Db::select('articles', 'name, published, slug', array('status' => 1), 'published DESC') : Fari_Db::select('articles', 'name, published, slug', NULL, 'published DESC'); }
public function add() { if (isset($_POST['text'])) { // add a new message under current credentials if (Messages::add($_POST['text'], Fari_User::getCredentials())) { // handle with JSON echo json_encode(array('status' => 'success')); } else { echo json_encode(array('status' => 'fail')); } } }
public function logout() { Fari_User::signOut(); Fari_Message::success('Goodbye'); $this->redirect('/blog/login/'); }
<?php if (!defined('FARI')) { die; } ?> <?php if (Fari_User::isAuthenticated('realname')) { ?> <div id="admin"> <div class="inside"> <a href="<?php $this->url('/blog/create'); ?> ">Add new article</a> | <a href="<?php $this->url('/blog/logout'); ?> ">Logout</a> </div> </div> <?php }