[ 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/filteredpatternsrule.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/config/config.class.php" ); 7 8 /** 9 * \ingroup Validator 10 * 11 * Checks if a blog name is valid. Usernames have to comply with the following rules: 12 * 13 * - They must not be empty 14 * - They must not match any of the regular expressions set by administrators as forbidden_blogname_regexp 15 * 16 * @see NonEmptyRule 17 * @see RegExpRule 18 */ 19 class BlogNameValidator extends Validator 20 { 21 function BlogNameValidator() 22 { 23 $this->Validator(); 24 25 // it can't be empty 26 $this->addRule( new NonEmptyRule()); 27 28 // it can't be any of the forbidden ones 29 $config =& Config::getConfig(); 30 $forbiddenBlognames = $config->getValue( "forbidden_blognames", "" ); 31 $forbiddenBlognamesArray = explode( " ", $forbiddenBlognames ); 32 $this->addRule( new FilteredPatternsRule( $forbiddenBlognamesArray, false )); 33 } 34 35 function validate( $value ) 36 { 37 if( !parent::validate( $value )) 38 return false; 39 40 // in addition to the other rules, the blog name won't be valid if its domainized() version 41 // returns empty spaces, so this is what would happen if we set a blog name of 42 // things like non-characters for example 43 lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" ); 44 return(( Textfilter::domainize( Textfilter::filterAllHTML( $value ))) != "" ); 45 } 46 } 47 ?>
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 |
![]() |