[pLog-svn] r6505 - plog/branches/lifetype-1.2/class/action
Jon Daley
plogworld at jon.limedaley.com
Thu Jun 5 08:40:28 EDT 2008
Anyone know if we can copy the validation stuff from
ResourceServerAction and use regular registerFieldValidator() in
blogaction? It'd be a cleaner way to do it, I think, though the same
technical result in the end. I am mostly not sure about an error view for
the blogaction constructor.
On Thu, 5 Jun 2008, jondaley at devel.lifetype.net wrote:
> Author: jondaley
> Date: 2008-06-05 08:32:07 -0400 (Thu, 05 Jun 2008)
> New Revision: 6505
>
> Modified:
> plog/branches/lifetype-1.2/class/action/blogaction.class.php
> Log:
> validate stuff. though these validators don't do very much. see bug #1524
>
> Modified: plog/branches/lifetype-1.2/class/action/blogaction.class.php
> ===================================================================
> --- plog/branches/lifetype-1.2/class/action/blogaction.class.php 2008-06-05 11:52:32 UTC (rev 6504)
> +++ plog/branches/lifetype-1.2/class/action/blogaction.class.php 2008-06-05 12:32:07 UTC (rev 6505)
> @@ -2,7 +2,10 @@
>
> lt_include( PLOG_CLASS_PATH."class/action/action.class.php" );
> lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
> - lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.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/blognamevalidator.class.php" );
> + lt_include( PLOG_CLASS_PATH."class/data/validator/domainvalidator.class.php" );
>
> /**
> * \ingroup Action
> @@ -178,12 +181,32 @@
> }
> }
>
> + $val = new IntegerValidator();
> $blogId = $this->_request->getValue( 'blogId' );
> + if( !$val->validate( $blogId ))
> + $blogId = "";
> +
> + $val = new IntegerValidator();
> + $userId = $this->_request->getValue( 'userId' );
> + if( !$val->validate( $userId ))
> + $userId = "";
> +
> + $val = new BlogNameValidator();
> $blogName = $this->_request->getValue( 'blogName' );
> - $userId = $this->_request->getValue( 'userId' );
> + if( !$val->validate( $blogName ))
> + $blogName = "";
> +
> + $val = new UsernameValidator();
> $userName = $this->_request->getValue( 'blogUserName' );
> + if( !$val->validate( $userName ))
> + $userName = "";
> +
> + $val = new DomainValidator();
> $blogDomain = $this->_request->getValue( 'blogDomain' );
> + if( !$val->validate( $blogDomain ))
> + $blogDomain = "";
>
> +
> // if there is a "blogId" parameter, it takes precedence over the
> // "user" parameter.
> if( !$blogId && !$blogName && !$blogDomain) {
> @@ -372,7 +395,6 @@
> */
> function _getPage()
> {
> - lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php");
> // get the value from the request
> $page = HttpVars::getRequestValue( "page" );
> // but first of all, validate it
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
--
Jon Daley
http://jon.limedaley.com
~~
Measuring programming progress by lines of code is like
measuring aircraft building progress by weight.
-- Bill Gates
More information about the pLog-svn
mailing list