diff options
author | xue <> | 2006-05-30 03:26:33 +0000 |
---|---|---|
committer | xue <> | 2006-05-30 03:26:33 +0000 |
commit | 6e0338629774fffe5fbe7136dfce34ce83844a5c (patch) | |
tree | 9520eaa7c3c278b5ebf525a0d1e09f0a4cdf7779 /demos/blog/protected/Pages/Posts/NewPost.php | |
parent | 7f508e187e4539a16cdbb1dd6a4b1133c53cf24d (diff) |
Blog demo is completed.
Diffstat (limited to 'demos/blog/protected/Pages/Posts/NewPost.php')
-rw-r--r-- | demos/blog/protected/Pages/Posts/NewPost.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/demos/blog/protected/Pages/Posts/NewPost.php b/demos/blog/protected/Pages/Posts/NewPost.php index 055c7f92..7d02557d 100644 --- a/demos/blog/protected/Pages/Posts/NewPost.php +++ b/demos/blog/protected/Pages/Posts/NewPost.php @@ -1,5 +1,22 @@ <?php
+/**
+ * NewPost class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ */
+/**
+ * NewPost class
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2006 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ */
class NewPost extends BlogPage
{
public function onLoad($param)
@@ -17,9 +34,14 @@ class NewPost extends BlogPage if($this->IsValid)
{
$postRecord=new PostRecord;
- $postRecord->Title=$this->Title->Text;
- $postRecord->Content=$this->Content->Text;
- $postRecord->Status=$this->DraftMode->Checked?0:1;
+ $postRecord->Title=$this->Title->SafeText;
+ $postRecord->Content=$this->Content->SafeText;
+ if($this->DraftMode->Checked)
+ $postRecord->Status=PostRecord::STATUS_DRAFT;
+ else if(!$this->User->IsAdmin && TPropertyValue::ensureBoolean($this->Application->Parameters['PostApproval']))
+ $postRecord->Status=PostRecord::STATUS_PENDING;
+ else
+ $postRecord->Status=PostRecord::STATUS_PUBLISHED;
$postRecord->CreateTime=time();
$postRecord->AuthorID=$this->User->ID;
$cats=array();
|