get_from_database($_GET['id']); if ($result == 0) { http_response_code(404); include_once './includes/templates/404.php'; die(); } } } else { $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT); $delete = filter_input(INPUT_POST, 'delete', FILTER_SANITIZE_STRING); $post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING); $post = new Post(); $post->get_from_database($id); if (strcasecmp($delete, "on") == 0) { delete_post($post); } else { edit_post($post, $post_content); } header("Location: /viewthread.php?id=" . $post->thread->id); } ?>
You must be signed in to manage a post.
'; return; } // Admin users should be able to delete posts, but they should not be able to edit them // Or should they?? if (Session::get()->get_current_user()->id != $current->author->id) { echo 'You can\'t manage another user\'s post!
'; return; } // TODO: Disallow editing/deleting posts if they have been around for a while ?>