summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Pages/Posts/NewPost.php
diff options
context:
space:
mode:
authorxue <>2006-05-30 03:30:14 +0000
committerxue <>2006-05-30 03:30:14 +0000
commit75f28186a995aa930f6db9f05ec7b63bbd2cd284 (patch)
tree9621a9db8c69daf951f87fb57996428d57d710a6 /demos/blog/protected/Pages/Posts/NewPost.php
parent2ea02214b2fb6bedb58dbbd318ef171a9e146524 (diff)
Merge from 3.0 branch till 1103
Diffstat (limited to 'demos/blog/protected/Pages/Posts/NewPost.php')
-rw-r--r--demos/blog/protected/Pages/Posts/NewPost.php28
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 &copy; 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 &copy; 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();