From 0c72d673a9056c753503e6b2a8d4fbf3aba75a95 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Wed, 25 May 2011 11:32:49 -0700 Subject: Moderation workflow is.. working --- htdocs/moderate/moderate.php | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 htdocs/moderate/moderate.php (limited to 'htdocs/moderate/moderate.php') diff --git a/htdocs/moderate/moderate.php b/htdocs/moderate/moderate.php new file mode 100644 index 0000000..0d3a67d --- /dev/null +++ b/htdocs/moderate/moderate.php @@ -0,0 +1,45 @@ + + * + */ + +require_once('../src/base.inc.php'); + +if (!isset($_SESSION['currentUser'])) { + header('Location: ' . $CONFIG['urlroot'].'/moderate/login.php'); + exit(); +} + +// If we have a valid id. +if (isset($_GET['id']) and is_numeric($_GET['id'])) { + + // Get the post. + $post = Post::getById($_GET['id']); + + if ($post) { + // Accept or Reject. + if (isset($_GET['action'])) { + switch ($_GET['action']) { + case 'approve': + $post->approve(); + break; + + case 'reject': + $post->reject(); + break; + } + + $post->save(); + } + } +} + +// Redirect back to the moderation index. +header('Location: ' . $CONFIG['urlroot'] . '/moderate'); + +?> -- cgit v1.2.3