public function delete() { $thread_id = Param::get('thread_id'); authorize_user_request($thread_id, self::AUTH_THREAD_DELETE); $user_id = get_authenticated_user_id($_SESSION['userid']); try { Thread::delete($thread_id); } catch (PDOException $e) { $_SESSION['deleteHasError'] = true; } $page_to_go = Param::get('page'); if ($page_to_go === self::PROFILE_PAGE) { redirect(PROFILE_PAGE, array("user_id" => $user_id)); } redirect(THREAD_PAGE); }
public function delete() { $thread_id = Param::get('thread_id'); $comment_id = Param::get('comment_id'); authorize_user_request($comment_id, self::AUTH_COMMENT_DELETE); try { Comment::delete($comment_id, $thread_id); } catch (PDOException $e) { $_SESSION['delete_error'] = true; } redirect(VIEW_COMMENT_PAGE, array('thread_id' => $thread_id)); }