From 9ad57b3d8d1000f17962bb0ba00a8958b2f141db Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Wed, 1 Jun 2011 12:15:26 -0700 Subject: Added scripts, email addresses, other minor modifications --- htdocs/src/Post.inc.php | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'htdocs/src/Post.inc.php') diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php index c05cb7e..4a109d2 100644 --- a/htdocs/src/Post.inc.php +++ b/htdocs/src/Post.inc.php @@ -88,7 +88,7 @@ class Post { } else { // Creating... set special fields. $info['stage'] = 'verification'; - $info['secretid'] = uniqid(); + $info['secretid'] = uniqid('', true); $info['created'] = date('Y-m-d H:i:s'); try { @@ -108,6 +108,16 @@ class Post { } } + public function delete() { + $db = getDatabase(); + + // Delete Images + $db->delete('image', 'post_id=' . $this->getId()); + + // Delete Post + $db->delete('post', 'id=' . $this->getId()); + } + public function getId() { return $this->info['id']; } @@ -167,6 +177,10 @@ class Post { return $this->info['email']; } + public function getPublicEmail() { + return 'posting-' . $this->getId() .'@'. $GLOBALS['CONFIG']['emaildomain']; + } + public function setEmail($value) { $this->info['email'] = $value; } @@ -254,7 +268,7 @@ class Post { $email->setSubject($GLOBALS['CONFIG']['sitetitle'] . " Email Validation"); - $url = $GLOBALS['CONFIG']['urlroot'] . '/validate.php?id=' . $this->getSecretId(); + $url = buildUrl('validate.php?id=' . $this->getSecretId()); $email->appendMessage("Please click on the link below to verify your email address.\n\n"); $email->appendMessage($url); @@ -265,14 +279,22 @@ class Post { public function sendAcceptance() { $email = new Email($this->getEmail()); - $email->setSubject($GLOBALS['CONFIG']['sitetitle'] . " Posting Approved"); + $email->setSubject($GLOBALS['CONFIG']['sitetitle'] + . " Posting Approved"); $email->appendMessage("Your posting titled ". $this->getName() ." has been approved by our moderation team.\n\n"); - $url = $GLOBALS['CONFIG']['urlroot'] . '/postings/' - . $this->getId() .'.html'; - $email->appendMessage("You can view your post at $url."); + // View URL + $url = buildUrl('postings/' . $this->getId() . '.html'); + $email->appendMessage("You can view your post at $url.\n\n"); + + // Delete URL + $url = buildUrl('deletepost.php?id=' . $this->getId() + . '&secret=' . $this->getSecretId()); + $email->appendMessage("Your posting will expire in " . + $GLOBALS['CONFIG']['expiretime'] + . " days. If you would like to remove it sooner, go to $url.\n"); $email->send(); } -- cgit v1.2.3