Esempio n. 1
0
 public function action_delete()
 {
     if (!$this->user->id) {
         $this->redirect('/');
     }
     $comment_id = $this->request->param('comment_id');
     $comment = Model_Comment::get($comment_id);
     $article_id = $comment->delete_comment($this->user);
     $this->redirect('/article/' . $article_id);
 }
Esempio n. 2
0
 public function add_child(Model_Comment $child)
 {
     $children = (array) $this->get('children');
     $orphans = (array) $this->get('orphans');
     if ($child->get('parent') != $this->get_id()) {
         $orphans[$child->get_id()] = $child;
     } else {
         $children[$child->get_id()] = $child;
     }
     $this->search_parents($children, $orphans);
     $this->set('children', $children);
     $this->set('orphans', $orphans);
 }