[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/data/validator/rules/nonemptyrule.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/data/validator/rules/regexprule.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/data/validator/rules/stringrangerule.class.php" ); 7 lt_include( PLOG_CLASS_PATH."class/data/validator/rules/filteredpatternsrule.class.php" ); 8 lt_include( PLOG_CLASS_PATH."class/config/config.class.php" ); 9 10 define( "ONLY_ALPHANUMERIC_REGEXP", "^([a-z0-9]*)$" ); 11 12 /** 13 * \ingroup Validator 14 * 15 * Checks if a username is valid. Usernames have to comply with the following rules: 16 * 17 * - They must not be empty 18 * - They must only be made of alphanumeric characters (a-z, A-Z and 0-9) 19 * - They must not be any of the forbidden usernames. Forbidden usernames can be configured 20 * via the 'forbidden_usernames' configuration parameter. 21 * 22 * @see NonEmptyRule 23 * @see RegExpRule 24 * @see FilteredWordsRule 25 */ 26 class UsernameValidator extends Validator 27 { 28 function UsernameValidator() 29 { 30 $this->Validator(); 31 32 $this->addRule( new NonEmptyRule()); 33 $this->addRule( new RegExpRule( ONLY_ALPHANUMERIC_REGEXP )); 34 $this->addRule( new StringRangeRule( 0, 15 )); // to make sure they're not longer than 15 characters 35 $config =& Config::getConfig(); 36 $forbiddenUsernames = $config->getValue( "forbidden_usernames", "" ); 37 $forbiddenUsernamesArray = explode( " ", $forbiddenUsernames ); 38 $this->addRule( new FilteredPatternsRule( $forbiddenUsernamesArray, false )); 39 } 40 } 41 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |