public function remove($id) { $P = new post(); $P->find($id); $P->delete(); $this->redirect("admin/"); }
echo '<h2>' . $row['post_title'] . '</h2>'; echo '<p>' . $row['post_content'] . '</p>'; echo '<span>' . $row['post_date'] . '</span>'; echo '</div>'; } mysqli_close($cx); } public function insert($id, $title, $content, $date) { $q = mysqli_query($cx, "SELECT * FROM post WHERE post_id = " . $this->postId); $row = mysqli_fetch_assoc($q); mysqli_close($cx); return $row; } public function delete($id) { $cx = $this->connect(); if (is_int($id)) { $query = "DELETE FROM post WHERE post_id = " . $id; } else { if (is_array($id)) { $ids = implode(', ', $id); $query = "DELETE FROM post WHERE post_id in ( " . $ids . " )"; } } mysqli_query($cx, $query); } } $post = new post(); $post->delete(7); $post->retrive();
public function delete_post($id) { if (!$this->user->is_logged_in()) { redirect("/user/main/userLogin", 'location'); } else { $post = new post($id); $post->delete(); redirect('/user/blog/posts', 'location'); } }
require 'path.php'; init_cobalt('Delete post'); if (isset($_GET['id'])) { $id = urldecode($_GET['id']); require_once 'form_data_post.php'; } if (xsrf_guard()) { init_var($_POST['btn_cancel']); init_var($_POST['btn_delete']); require 'components/query_string_standard.php'; if ($_POST['btn_cancel']) { log_action('Pressed cancel button'); redirect("listview_post.php?{$query_string}"); } elseif ($_POST['btn_delete']) { log_action('Pressed delete button'); require_once 'subclasses/post.php'; $dbh_post = new post(); $object_name = 'dbh_post'; require 'components/create_form_data.php'; $dbh_post->delete($arr_form_data); redirect("listview_post.php?{$query_string}"); } } require 'subclasses/post_html.php'; $html = new post_html(); $html->draw_header('Delete Post', $message, $message_type); $html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc); $html->draw_hidden('id'); $html->detail_view = TRUE; $html->draw_controls('delete'); $html->draw_footer();
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!'); } } }