[pLog-svn] r6595 - plog/branches/lifetype-1.2/class/action/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Jun 19 12:58:03 EDT 2008


Author: mark
Date: 2008-06-19 12:58:03 -0400 (Thu, 19 Jun 2008)
New Revision: 6595

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminadduseraction.class.php
Log:
1. In previous design, we always use registerField() to bring the value back to the form if the value is allow empty. Now, we can set the $onlyIfAvailable = true in registerFieldValue() to get the same effect. We also gain more security through this method when we implement addXXXAction.

2. Remove blogName, it never used here.

Modified: plog/branches/lifetype-1.2/class/action/admin/adminadduseraction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminadduseraction.class.php	2008-06-19 16:43:40 UTC (rev 6594)
+++ plog/branches/lifetype-1.2/class/action/admin/adminadduseraction.class.php	2008-06-19 16:58:03 UTC (rev 6595)
@@ -5,7 +5,9 @@
     lt_include( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );	
@@ -35,16 +37,15 @@
         	$this->AdminAction( $actionInfo, $request );
         	
         	// for data validation purposes
-        	$this->registerFieldValidator( "userName", new UsernameValidator());
-        	$this->registerFieldValidator( "newUserPassword", new PasswordValidator());
-        	$this->registerFieldValidator( "userEmail", new EmailValidator());
-			$this->registerFieldValidator( "userStatus", new IntegerValidator());
-                // TODO: validate all of these
-        	$this->registerField( "userFullName" );
+        	$this->registerFieldValidator( "userName", new UsernameValidator() );
+        	$this->registerFieldValidator( "newUserPassword", new PasswordValidator() );
+        	$this->registerFieldValidator( "userEmail", new EmailValidator() );
+			$this->registerFieldValidator( "userStatus", new IntegerValidator() );
+        	$this->registerFieldValidator( "userFullName", new StringValidator(), true );
         	$this->registerFieldValidator( "blogId", new IntegerValidator(), true );
-			$this->registerField( "blogName" );
-			$this->registerField( "userPermissions" );
-        	$view = new AdminAddUserView( $this->_blogInfo );
+			$this->registerFieldValidator( "userPermissions", new ArrayValidator( new IntegerValidator() ), true );
+
+			$view = new AdminAddUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_user" ));
         	$this->setValidationErrorView( $view );
 



More information about the pLog-svn mailing list