From 8b44cecf9637e77cf0495e5ad08fdd033b39f06f Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sun, 6 Jun 2021 09:05:53 -0600 Subject: Remove manage post and search pages --- includes/model/Post.php | 12 ------- includes/templates/header.php | 2 -- manage_post.php | 80 ------------------------------------------- search.php | 66 ----------------------------------- 4 files changed, 160 deletions(-) delete mode 100644 manage_post.php delete mode 100644 search.php diff --git a/includes/model/Post.php b/includes/model/Post.php index 42add02..49fd640 100644 --- a/includes/model/Post.php +++ b/includes/model/Post.php @@ -94,18 +94,6 @@ class Post $result = '
#' . $this->id . ''; $result .= ' Posted by ' . $this->author->name . ''; $result .= ' on ' . date('m/d/Y g:ia', strtotime($this->date_created)); - - // If the post has a edit date, display it - if (!is_null($this->date_edited)) { - $result .= ' edited ' . date('m/d/Y g:ia', strtotime($this->date_edited)) . ''; - } - - // Append a manage post button if the user is signed in and is the post's creator - if (Session::get()->is_signed_in() && Session::get()->get_current_user()->id == $this->author->id) { - $result .= ''; - $result .= '[Edit/Delete]'; - $result .= ''; - } $result .= '
'; // Append the formatted post content diff --git a/includes/templates/header.php b/includes/templates/header.php index 5070cfe..f1c2c94 100644 --- a/includes/templates/header.php +++ b/includes/templates/header.php @@ -2,8 +2,6 @@

cflip.net forumbeta

[Home] -[All Threads] -[All Posts] [Create a thread] 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); -} -?> - - - - Manage a post - cflip.net forum - - - - -

Manage a post

-'; - -$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); - -if (!Session::get()->is_signed_in()) { - echo '

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 -?> -
-

Edit post

- - -

Edited posts will show a timestamp above the post showing when the last edit was made.

-

- - -

- -
- - diff --git a/search.php b/search.php deleted file mode 100644 index e5ef9db..0000000 --- a/search.php +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Search - cflip.net forum - - - - -

Search cflip.net forum

-
" method="get"> - - - - - - - -
-
-'; - echo '' . $thread->subject . ''; - echo ' created by ' . $thread->author->name . ' on ' . date('M d, Y', strtotime($thread->date_created)) . ''; - echo '

'; - } - break; - case 'post': - $posts = get_all_posts(); - - foreach ($posts as $post) { - echo '

From ' . $post->thread->subject . '

'; - echo get_post_content($post); - echo '
'; - } - break; - case 'user': - break; - default: - echo '

Could not search: Invalid type!

'; - break; - } -} -?> - - -- cgit v1.2.3