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

mark at devel.lifetype.net mark at devel.lifetype.net
Mon Jun 9 12:10:09 EDT 2008


Author: mark
Date: 2008-06-09 12:10:09 -0400 (Mon, 09 Jun 2008)
New Revision: 6531

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksaction.class.php
Log:
1. Only the postId can move the constructor and use the registerFieldValidator.

2. We should use httpurlvalidator as array emelement validator to validate the postLinks and TrackbackLinks.

Modified: plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksaction.class.php	2008-06-09 15:23:20 UTC (rev 6530)
+++ plog/branches/lifetype-1.2/class/action/admin/adminsendtrackbacksaction.class.php	2008-06-09 16:10:09 UTC (rev 6531)
@@ -5,6 +5,7 @@
     lt_include( PLOG_CLASS_PATH."class/view/admin/adminnewpostview.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/trackbackclient.class.php" );
     lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
 
@@ -30,29 +31,28 @@
         {
         	$this->AdminAction( $actionInfo, $request );
 
+        	$this->registerFieldValidator( "postId", new IntegerValidator(), false );
+
+			$view = new AdminPostsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id" ));
+			$this->setValidationErrorView( $view );
+
 			$this->requirePermission( "add_post" );
         }
 
-            // TODO: using old methods - should be changed to new, right?
 		function validate()
 		{
+			if( !parent::validate())
+				return( false );
+
 			// fetch the validated data
+			$this->_postId = $this->_request->getValue( "postId" );
 			$this->_postLinks = $this->_request->getValue( "postLink" );
 			$this->_trackbackLinks = $this->_request->getValue( "trackbackLink" );
-			$this->_postId = $this->_request->getValue( "postId" );
 			
-			$intval = new IntegerValidator();
-			if( !$intval->validate( $this->_postId ) ) {
+			$val = new ArrayValidator( new HttpUrlValidator() );
+			if( !$val->validate( $this->_postLinks ) && !$val->validate( $this->_trackbackLinks ) ) {
                 $this->_view = new AdminPostsListView( $this->_blogInfo );
-                $this->_view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id"));
-                $this->setCommonData();
-
-                return false;				
-			}
-			
-			$arrryval = new ArrayValidator();
-			if( !$arrryval->validate( $this->_postLinks ) && !$arrryval->validate( $this->_trackbackLinks ) ) {
-                $this->_view = new AdminPostsListView( $this->_blogInfo );
                 $this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
                 $this->setCommonData();
 



More information about the pLog-svn mailing list