diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2011-05-24 17:08:38 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net ; true> | 2011-05-24 17:08:38 -0700 |
commit | a39f9512f0efd3ec3e0a31df656e25dd3f824f6d (patch) | |
tree | 70e797cc9b1f8978f73799fc0d181e9005859530 /htdocs/src | |
parent | b41edfdbeb371f3259da1470a5533523939b42a0 (diff) |
Working on moderation approve/reject
Diffstat (limited to 'htdocs/src')
-rw-r--r-- | htdocs/src/Post.inc.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php index cfd7d07..820ca97 100644 --- a/htdocs/src/Post.inc.php +++ b/htdocs/src/Post.inc.php @@ -46,10 +46,11 @@ class Post { $row = $db->fetchAssocRow($query); if ($row) { - $user = new Post(); - $user->info = $row; + $post = new Post(); + $post->info = $row; + $post->indatabase = true; - return $user; + return $post; } else { return false; @@ -62,6 +63,9 @@ class Post { // Cleanup Info foreach ($this->info as $key=>$value) $info[$key] = addslashes($value); + // Remove artifical fields. + unset($info['createdts']); + // Save or create? if ($this->indatabase) { return $db->update('post', $info, "WHERE `id`='". $this->getId() ."'"); @@ -70,6 +74,7 @@ class Post { // Creating... set special fields. $info['stage'] = 'verification'; $info['secretid'] = uniqid(); + $info['created'] = date('Y-m-d H:i:s'); $ret = $db->insert('post', $info); @@ -112,11 +117,15 @@ class Post { } public function approve() { - $this->info['stage'] = 'approved'; + if ($this->getStage() == 'moderation') { + $this->info['stage'] = 'approved'; + } } public function verify() { - $this->info['stage'] = 'verify'; + if ($this->getStage() == 'verification') { + $this->info['stage'] = 'moderation'; + } } public function getCreated() { |