summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Pages/Users
diff options
context:
space:
mode:
Diffstat (limited to 'demos/blog/protected/Pages/Users')
-rw-r--r--demos/blog/protected/Pages/Users/EditUser.php136
-rw-r--r--demos/blog/protected/Pages/Users/NewUser.php114
-rw-r--r--demos/blog/protected/Pages/Users/ViewUser.php82
3 files changed, 166 insertions, 166 deletions
diff --git a/demos/blog/protected/Pages/Users/EditUser.php b/demos/blog/protected/Pages/Users/EditUser.php
index c574ca6b..8d5cb090 100644
--- a/demos/blog/protected/Pages/Users/EditUser.php
+++ b/demos/blog/protected/Pages/Users/EditUser.php
@@ -1,69 +1,69 @@
-<?php
-/**
- * EditUser 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 $Id$
- */
-
-/**
- * EditUser 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 EditUser extends BlogPage
-{
- private $_userRecord=null;
-
- public function onInit($param)
- {
- parent::onInit($param);
- if(($id=$this->Request['id'])!==null)
- {
- $id=TPropertyValue::ensureInteger($id);
- if(!$this->User->IsAdmin && $this->User->ID!==$id)
- throw new BlogException(500,'profile_edit_disallowed',$id);
- }
- else
- $id=$this->User->ID;
- if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
- throw new BlogException(500,'profile_id_invalid',$id);
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $userRecord=$this->_userRecord;
- $this->Username->Text=$userRecord->Name;
- $this->FullName->Text=$userRecord->FullName;
- $this->Email->Text=$userRecord->Email;
- $this->Website->Text=$userRecord->Website;
- }
- }
-
- public function saveButtonClicked($sender,$param)
- {
- if($this->IsValid)
- {
- $userRecord=$this->_userRecord;
- if($this->Password->Text!=='')
- $userRecord->Password=md5($this->Password->Text);
- $userRecord->FullName=$this->FullName->Text;
- $userRecord->Email=$this->Email->Text;
- $userRecord->Website=$this->Website->Text;
- $this->DataAccess->updateUser($userRecord);
- $authManager=$this->Application->getModule('auth');
- $this->gotoPage('Users.ViewUser',array('id'=>$userRecord->ID));
- }
- }
-}
-
+<?php
+/**
+ * EditUser 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 $Id$
+ */
+
+/**
+ * EditUser 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 EditUser extends BlogPage
+{
+ private $_userRecord=null;
+
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ if(($id=$this->Request['id'])!==null)
+ {
+ $id=TPropertyValue::ensureInteger($id);
+ if(!$this->User->IsAdmin && $this->User->ID!==$id)
+ throw new BlogException(500,'profile_edit_disallowed',$id);
+ }
+ else
+ $id=$this->User->ID;
+ if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
+ throw new BlogException(500,'profile_id_invalid',$id);
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $userRecord=$this->_userRecord;
+ $this->Username->Text=$userRecord->Name;
+ $this->FullName->Text=$userRecord->FullName;
+ $this->Email->Text=$userRecord->Email;
+ $this->Website->Text=$userRecord->Website;
+ }
+ }
+
+ public function saveButtonClicked($sender,$param)
+ {
+ if($this->IsValid)
+ {
+ $userRecord=$this->_userRecord;
+ if($this->Password->Text!=='')
+ $userRecord->Password=md5($this->Password->Text);
+ $userRecord->FullName=$this->FullName->Text;
+ $userRecord->Email=$this->Email->Text;
+ $userRecord->Website=$this->Website->Text;
+ $this->DataAccess->updateUser($userRecord);
+ $authManager=$this->Application->getModule('auth');
+ $this->gotoPage('Users.ViewUser',array('id'=>$userRecord->ID));
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Pages/Users/NewUser.php b/demos/blog/protected/Pages/Users/NewUser.php
index 40e79910..50f9f123 100644
--- a/demos/blog/protected/Pages/Users/NewUser.php
+++ b/demos/blog/protected/Pages/Users/NewUser.php
@@ -1,58 +1,58 @@
-<?php
-/**
- * NewUser 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 $Id$
- */
-
-/**
- * NewUser 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 NewUser extends BlogPage
-{
- public function onInit($param)
- {
- if(!$this->User->IsAdmin && !TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser']))
- throw new BlogException(500,'newuser_registration_disallowed');
- }
-
- public function checkUsername($sender,$param)
- {
- $username=strtolower($this->Username->Text);
- $param->IsValid=$this->DataAccess->queryUserByName($username)===null;
- }
-
- public function createUser($sender,$param)
- {
- if($this->IsValid)
- {
- $userRecord=new UserRecord;
- $userRecord->Name=strtolower($this->Username->Text);
- $userRecord->FullName=$this->FullName->Text;
- $userRecord->Role=0;
- $userRecord->Password=md5($this->Password->Text);
- $userRecord->Email=$this->Email->Text;
- $userRecord->CreateTime=time();
- $userRecord->Website=$this->Website->Text;
- if(TPropertyValue::ensureBoolean($this->Application->Parameters['AccountApproval']))
- $userRecord->Status=UserRecord::STATUS_PENDING;
- else
- $userRecord->Status=UserRecord::STATUS_NORMAL;
- $this->DataAccess->insertUser($userRecord);
- $authManager=$this->Application->getModule('auth');
- $authManager->login($this->Username->Text,$this->Password->Text);
- $this->gotoDefaultPage();
- }
- }
-}
-
+<?php
+/**
+ * NewUser 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 $Id$
+ */
+
+/**
+ * NewUser 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 NewUser extends BlogPage
+{
+ public function onInit($param)
+ {
+ if(!$this->User->IsAdmin && !TPropertyValue::ensureBoolean($this->Application->Parameters['MultipleUser']))
+ throw new BlogException(500,'newuser_registration_disallowed');
+ }
+
+ public function checkUsername($sender,$param)
+ {
+ $username=strtolower($this->Username->Text);
+ $param->IsValid=$this->DataAccess->queryUserByName($username)===null;
+ }
+
+ public function createUser($sender,$param)
+ {
+ if($this->IsValid)
+ {
+ $userRecord=new UserRecord;
+ $userRecord->Name=strtolower($this->Username->Text);
+ $userRecord->FullName=$this->FullName->Text;
+ $userRecord->Role=0;
+ $userRecord->Password=md5($this->Password->Text);
+ $userRecord->Email=$this->Email->Text;
+ $userRecord->CreateTime=time();
+ $userRecord->Website=$this->Website->Text;
+ if(TPropertyValue::ensureBoolean($this->Application->Parameters['AccountApproval']))
+ $userRecord->Status=UserRecord::STATUS_PENDING;
+ else
+ $userRecord->Status=UserRecord::STATUS_NORMAL;
+ $this->DataAccess->insertUser($userRecord);
+ $authManager=$this->Application->getModule('auth');
+ $authManager->login($this->Username->Text,$this->Password->Text);
+ $this->gotoDefaultPage();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/blog/protected/Pages/Users/ViewUser.php b/demos/blog/protected/Pages/Users/ViewUser.php
index 75bd711a..86c27592 100644
--- a/demos/blog/protected/Pages/Users/ViewUser.php
+++ b/demos/blog/protected/Pages/Users/ViewUser.php
@@ -1,42 +1,42 @@
-<?php
-/**
- * ViewUser 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 $Id$
- */
-
-/**
- * ViewUser 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 ViewUser extends BlogPage
-{
- private $_userRecord=null;
-
- public function onInit($param)
- {
- parent::onInit($param);
- if(($id=$this->Request['id'])!==null)
- $id=TPropertyValue::ensureInteger($id);
- else
- $id=$this->User->ID;
- if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
- throw new BlogException(500,'profile_id_invalid',$id);
- $this->_userRecord->Email=strtr(strtoupper($this->_userRecord->Email),array('@'=>' at ','.'=>' dot '));
- }
-
- public function getProfile()
- {
- return $this->_userRecord;
- }
-}
-
+<?php
+/**
+ * ViewUser 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 $Id$
+ */
+
+/**
+ * ViewUser 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 ViewUser extends BlogPage
+{
+ private $_userRecord=null;
+
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ if(($id=$this->Request['id'])!==null)
+ $id=TPropertyValue::ensureInteger($id);
+ else
+ $id=$this->User->ID;
+ if(($this->_userRecord=$this->DataAccess->queryUserByID($id))===null)
+ throw new BlogException(500,'profile_id_invalid',$id);
+ $this->_userRecord->Email=strtr(strtoupper($this->_userRecord->Email),array('@'=>' at ','.'=>' dot '));
+ }
+
+ public function getProfile()
+ {
+ return $this->_userRecord;
+ }
+}
+
?> \ No newline at end of file