summaryrefslogtreecommitdiff
path: root/htdocs/moderate/moderate.php
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/moderate/moderate.php')
-rw-r--r--htdocs/moderate/moderate.php45
1 files changed, 45 insertions, 0 deletions
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 @@
+<?php
+
+/* Foursquare Community Site
+ *
+ * Copyright (C) 2011 Foursquare Church.
+ *
+ * Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
+ *
+ */
+
+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');
+
+?>