summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design/database.sql3
-rw-r--r--htdocs/deletepost.php10
-rw-r--r--htdocs/new-post.php4
-rw-r--r--htdocs/page.php10
-rw-r--r--htdocs/postings.php10
-rw-r--r--htdocs/src/Post.inc.php12
6 files changed, 31 insertions, 18 deletions
diff --git a/design/database.sql b/design/database.sql
index caecbeb..06b607c 100644
--- a/design/database.sql
+++ b/design/database.sql
@@ -54,7 +54,8 @@ CREATE TABLE post (
stage ENUM('verification',
'moderation',
'approved',
- 'rejected') NOT NULL DEFAULT 'verification',
+ 'rejected',
+ 'deleted') NOT NULL DEFAULT 'verification',
PRIMARY KEY(id),
UNIQUE KEY(secretid)
diff --git a/htdocs/deletepost.php b/htdocs/deletepost.php
index 7ebec19..50d35c5 100644
--- a/htdocs/deletepost.php
+++ b/htdocs/deletepost.php
@@ -48,8 +48,14 @@ if (isset($_GET['confirmed'])) {
require_once "src/footer.inc.php";
function errorNotFound() {
- // TODO: Better 404 error
- echo "404";
+ // Get the 404 page
+ $page = Page::getByUrl('404');
+ if ($page) {
+ echo $page->getContent();
+ } else {
+ echo "Error: Page not found.";
+ }
+ require_once "src/footer.inc.php";
exit;
}
diff --git a/htdocs/new-post.php b/htdocs/new-post.php
index d463d1a..273e864 100644
--- a/htdocs/new-post.php
+++ b/htdocs/new-post.php
@@ -22,9 +22,9 @@ echo "<h2>New Posting</h2>";
* 2) ToS
* 3) Title, Desc, Location, email
* 4) Images
- * 5) Notify about email
+ * 5) Source
+ * 6) Notify about email
*
- * TODO: Set the source of the post.
*/
$stage = 'category';
diff --git a/htdocs/page.php b/htdocs/page.php
index e843229..2ccc248 100644
--- a/htdocs/page.php
+++ b/htdocs/page.php
@@ -35,8 +35,14 @@ echo $page->getContent();
require_once "src/footer.inc.php";
function errorNotFound() {
- // TODO: Better 404 error
- echo "404";
+ // Get the 404 page
+ $page = Page::getByUrl('404');
+ if ($page) {
+ echo $page->getContent();
+ } else {
+ echo "Error: Page not found.";
+ }
+ require_once "src/footer.inc.php";
exit;
}
diff --git a/htdocs/postings.php b/htdocs/postings.php
index ee178cb..a40cfb7 100644
--- a/htdocs/postings.php
+++ b/htdocs/postings.php
@@ -66,8 +66,14 @@ foreach ($post->getImages() as $imgid) {
require_once "src/footer.inc.php";
function errorNotFound() {
- // TODO: Better 404 error
- echo "404";
+ // Get the 404 page
+ $page = Page::getByUrl('404');
+ if ($page) {
+ echo $page->getContent();
+ } else {
+ echo "Error: Page not found.";
+ }
+ require_once "src/footer.inc.php";
exit;
}
diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php
index 4f5e246..e36884b 100644
--- a/htdocs/src/Post.inc.php
+++ b/htdocs/src/Post.inc.php
@@ -110,15 +110,9 @@ class Post {
}
public function delete() {
- $db = getDatabase();
-
- // Delete Images
- $db->delete('image', 'post_id=' . $this->getId());
-
- // Delete Post
- $db->delete('post', 'id=' . $this->getId());
-
- $this->indatabase = false;
+ // Rather than deleting the post, archive it.
+ $this->info['stage'] = 'deleted';
+ $this->save();
}
public function getId() {