예제 #1
0
 public function edit($article)
 {
     if (!Fari_User::isAuthenticated('realname') or $article == NULL) {
         Fari_Message::fail('You need to authenticate first');
         $this->redirect('/blog/login/');
     } else {
         // are we saving updates?
         if (!empty($_POST['slug'])) {
             Fari_Db::update('articles', array('text' => Fari_Escape::quotes($_POST['text']), 'status' => $_POST['status']), array('slug' => $_POST['slug']));
             Fari_Message::success('Changes saved');
         }
         // pickup messages for us
         $this->view->messages = Fari_Message::get();
         // a specific article
         $article = Fari_Escape::URL($article);
         $this->view->article = $article = Fari_Db::selectRow('articles', '*', array('slug' => $article));
         $this->view->display('/themes/' . BLOG_THEME . '/edit');
     }
 }