diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2011-06-17 10:45:18 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net ; true> | 2011-06-17 10:45:18 -0700 | 
| commit | 4abea1ff10cc1376308ba590ee4e97091fc997e1 (patch) | |
| tree | 4be8a013cccda8350d9367f843a41b4b69717971 /htdocs/postings.php | |
| parent | bd90538bb72812e2f770a2dbfe5357b96df08629 (diff) | |
Added delete post. Fixed logout
Diffstat (limited to 'htdocs/postings.php')
| -rw-r--r-- | htdocs/postings.php | 35 | 
1 files changed, 24 insertions, 11 deletions
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 "<div class=\"moderationbox\">You are moderating this post: "; +        printf("<a href=\"../moderate/moderate.php?id=%s&action=approve\">approve</a> " +            . "<a href=\"../moderate/moderate.php?id=%s&action=reject\">reject</a>", +            $post->getid(), $post->getid()); +        echo "<p><a href=\"../moderate/index.php\">return to moderation</a></p>"; +        echo "</div>"; + + +    } else { +        // Post already approved +        if ($_SESSION['currentUser']->isAdmin()) { +            echo "<div class=\"moderationbox\">Administrative options:<br />"; +             +            printf("<a href=\"../moderate/moderate.php?id=%s&action=delete\">delete post</a><br />" +                . "<a href=\"../moderate/moderate.php?id=%s&action=reject\">reject post</a>", +                $post->getid(), $post->getid()); +            echo "</div>"; +        }      } -    echo "<div class=\"moderationbox\">You are moderating this post: "; -    printf("<a href=\"../moderate/moderate.php?id=%s&action=approve\">Approve</a> " -        . "<a href=\"../moderate/moderate.php?id=%s&action=reject\">Reject</a>", -        $post->getId(), $post->getId()); -    echo "<p><a href=\"../moderate/index.php\">Return to moderation</a></p>"; -    echo "</div>";  } +  // Display the post.  echo "<h2>". $post->getName();  | 
