Ejemplo n.º 1
0
 public function logout()
 {
     $user = Fari_User::getCredentials();
     Fari_Message::notify("Thanks for the visit {$user}.");
     Fari_User::signOut();
     $this->redirect('/secure/');
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 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'));
         }
     }
 }
Ejemplo n.º 4
0
 public function logout()
 {
     Fari_User::signOut();
     Fari_Message::success('Goodbye');
     $this->redirect('/blog/login/');
 }
Ejemplo n.º 5
0
<?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> &nbsp; |
                &nbsp; <a href="<?php 
    $this->url('/blog/logout');
    ?>
">Logout</a>
        </div>
    </div>
<?php 
}