summaryrefslogtreecommitdiff
path: root/htdocs/src/Post.inc.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/src/Post.inc.php
parenta070cbe9627fcc29ef2f91b8f7578080203e6ad1 (diff)
Added scripts, email addresses, other minor modifications
Diffstat (limited to 'htdocs/src/Post.inc.php')
-rw-r--r--htdocs/src/Post.inc.php34
1 files changed, 28 insertions, 6 deletions
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();
}