[pLog-svn] r3762 - in plog/trunk/class/data/validator: . rules
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Jul 20 21:22:44 GMT 2006
Author: oscar
Date: 2006-07-20 21:22:05 +0000 (Thu, 20 Jul 2006)
New Revision: 3762
Modified:
plog/trunk/class/data/validator/rules/stringrangerule.class.php
plog/trunk/class/data/validator/usernamevalidator.class.php
Log:
do not allow usernames longer than 15 characters, which is the exact lenght of the username field in the database
Modified: plog/trunk/class/data/validator/rules/stringrangerule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/stringrangerule.class.php 2006-07-20 20:45:34 UTC (rev 3761)
+++ plog/trunk/class/data/validator/rules/stringrangerule.class.php 2006-07-20 21:22:05 UTC (rev 3762)
@@ -25,7 +25,7 @@
* @param minValue the lower boundary of the range
* @param maxValue the upper boundary of the range
*/
- function RangeRule($minValue, $maxValue)
+ function StringRangeRule($minValue, $maxValue)
{
$this->Rule();
Modified: plog/trunk/class/data/validator/usernamevalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/usernamevalidator.class.php 2006-07-20 20:45:34 UTC (rev 3761)
+++ plog/trunk/class/data/validator/usernamevalidator.class.php 2006-07-20 21:22:05 UTC (rev 3762)
@@ -3,7 +3,9 @@
include_once( PLOG_CLASS_PATH."class/data/validator/validator.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/rules/nonemptyrule.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/rules/regexprule.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/validator/rules/stringrangerule.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/rules/filteredpatternsrule.class.php" );
+ include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
define( "ONLY_ALPHANUMERIC_REGEXP", "^([A-Za-z0-9]*)$" );
@@ -28,7 +30,8 @@
$this->Validator();
$this->addRule( new NonEmptyRule());
- $this->addRule( new RegExpRule( ONLY_ALPHANUMERIC_REGEXP ));
+ $this->addRule( new RegExpRule( ONLY_ALPHANUMERIC_REGEXP ));
+ $this->addRule( new StringRangeRule( 0, 15 )); // to make sure they're not longer than 15 characters
$config =& Config::getConfig();
$forbiddenUsernames = $config->getValue( "forbidden_usernames", "" );
$forbiddenUsernamesArray = explode( " ", $forbiddenUsernames );
More information about the pLog-svn
mailing list