From 4abea1ff10cc1376308ba590ee4e97091fc997e1 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 17 Jun 2011 10:45:18 -0700 Subject: Added delete post. Fixed logout --- htdocs/postings.php | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'htdocs/postings.php') diff --git a/htdocs/postings.php b/htdocs/postings.php index a52d939..b275858 100644 --- a/htdocs/postings.php +++ b/htdocs/postings.php @@ -28,24 +28,37 @@ if (!is_numeric($id)) { // Get the post. $post = Post::getById($id); -if (!$post or (!isset($_GET['moderate']) and $post->getStage() != 'approved')) { +if (!$post or (!isset($_SESSION['currentUser']) and $post->getStage() != 'approved')) { errorNotFound(); } -if (isset($_GET['moderate'])) { - if (!isset($_SESSION['currentUser'])) { - header('Location: ' . $CONFIG['urlroot'].'/moderate/login.php'); - exit(); +if (isset($_SESSION['currentUser'])) { + + if ($post->getStage() != 'approved') { + // Post waiting for approval... + echo "
You are moderating this post: "; + printf("approve " + . "reject", + $post->getid(), $post->getid()); + echo "

return to moderation

"; + echo "
"; + + + } else { + // Post already approved + if ($_SESSION['currentUser']->isAdmin()) { + echo "
Administrative options:
"; + + printf("delete post
" + . "reject post", + $post->getid(), $post->getid()); + echo "
"; + } } - echo "
You are moderating this post: "; - printf("Approve " - . "Reject", - $post->getId(), $post->getId()); - echo "

Return to moderation

"; - echo "
"; } + // Display the post. echo "

". $post->getName(); -- cgit v1.2.3