summaryrefslogtreecommitdiff
path: root/htdocs/deletepost.php
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-06-01 12:15:26 -0700
committerJesse Morgan <jesse@jesterpm.net ; true>2011-06-01 12:15:26 -0700
commit9ad57b3d8d1000f17962bb0ba00a8958b2f141db (patch)
tree515f444d429b999516e530e5d35fcaac6424f1a9 /htdocs/deletepost.php
parenta070cbe9627fcc29ef2f91b8f7578080203e6ad1 (diff)
Added scripts, email addresses, other minor modifications
Diffstat (limited to 'htdocs/deletepost.php')
-rw-r--r--htdocs/deletepost.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/htdocs/deletepost.php b/htdocs/deletepost.php
new file mode 100644
index 0000000..7ebec19
--- /dev/null
+++ b/htdocs/deletepost.php
@@ -0,0 +1,57 @@
+<?php
+
+/* Foursquare Community Site
+ *
+ * Copyright (C) 2011 Foursquare Church.
+ *
+ * Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
+ *
+ */
+
+require_once "src/base.inc.php";
+
+require_once "src/header.inc.php";
+
+// Make sure we have all the needed information
+if (!isset($_GET['id']) or !is_numeric($_GET['id'])
+ or !isset($_GET['secret'])) {
+ errorNotFound();
+}
+
+// Get the post.
+$post = Post::getById($_GET['id']);
+
+// Got a post with the right secretid?
+if (!$post and $post->getSecretId() == $_GET['secret']) {
+ errorNotFound();
+}
+
+if (isset($_GET['confirmed'])) {
+ // Delete post
+ $post->delete();
+
+ echo "<p>Your post has been removed.</p>";
+
+ echo "<p><a href=\"". $GLOBALS['CONFIG']['urlroot']
+ ."\">Return to homepage</a>.</p>";
+
+} else {
+ // Are you sure...
+ echo "<p>Are you sure you want to remove your posting titled "
+ . $post->getName() ."?</p>";
+ echo "<p><a href=\"". $_SERVER['REQUEST_URI']
+ ."&confirmed\">Yes, delete it</a> ";
+ echo "<a href=\"". $GLOBALS['CONFIG']['urlroot']
+ ."\">No, do not delete</a></p>";
+}
+
+require_once "src/footer.inc.php";
+
+function errorNotFound() {
+ // TODO: Better 404 error
+ echo "404";
+ exit;
+}
+
+?>
+