public function posts() { if (!$this->user->is_logged_in()) { redirect("/user/main/userLogin", 'location'); } else { $post = new post(-1); $data['objects'] = $post->get(); $data['id_user'] = $this->user->get_id(); $this->show->set_user_backend(); $this->show->user_backend('show_post_objects', $data); } }
private function delete_post($post_id) { if ($this->user['SiteRank'] >= 4) { $post = post::get($post_id); if ($post['postorderid'] == 0) { if ($this->user['Username'] == $post['author'] || $this->user['Username'] >= 4) { $result = post::delete($post_id); //Update thread replys count thread::update_post_count($post['thread']); ////Build event details to log // $logEventID = '132'; // $logDetails = 'Forum post id:'.$post_id.' in thread id:'.$thread.' for category id:'.$category.' deleted!'; // $logEventAuthor = $this->user['Username']; // //Write to admin log. json::resp(array('success' => true, 'cat' => $post['cat'], 'thread' => $post['thread'])); } } else { self::errorJSON('Cannot delete first post of thread, the entire thread must be deleted!'); } } }