[pLog-svn] BlogNameValidator() cause Chinese blog name error!

Jon Daley plogworld at jon.limedaley.com
Tue Sep 11 13:52:41 EDT 2007


 	But, doesn't the validator stop the action altogether and never 
run perform if it fails?

On Wed, 12 Sep 2007, Mark Wu wrote:

> Here come the code from AdminAddBlogAction()
>
> =======================================
>
>    	function AdminAddBlogAction( $actionInfo, $request )
>        {
>        	$this->AdminAction( $actionInfo, $request );
>
>        	// data validation
>        	$this->registerFieldValidator( "blogName", new
> BlogNameValidator());
>        	$this->registerFieldValidator( "userId", new
> IntegerValidator());
> 			if( Subdomains::getSubdomainsEnabled()) {
> 				$this->registerFieldValidator(
> "blogSubDomain", new DomainValidator());
> 				$this->registerFieldValidator(
> "blogMainDomain", new DomainValidator());
> 			}
>
>        	$this->registerField( "userName" );
> 			$view = new AdminCreateBlogView( $this->_blogInfo );
> 			$view->setErrorMessage( $this->_locale->tr(
> "error_adding_blog" ));
>        	$this->setValidationErrorView( $view );
>
> 			$this->requireAdminPermission( "add_site_blog" );
>        }
>
>        function perform()
>        {
> 	        // fetch the validated data
>        	$this->_blogName =
> Textfilter::filterAllHTML($this->_request->getValue( "blogName" ));
>            $this->_ownerId  = $this->_request->getValue( "userId" );
> 			$this->_blogProperties = $this->_request->getValue(
> "properties" );
>
> ====================================
>
> You can see we use the blogName with "filterAllHTML" ,....
>
> So, no matter blogNameValidator or stringValidator, we only use the blog
> name with "filterAllHTML" ...
>
> Mark
>
>
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>> Sent: Wednesday, September 12, 2007 1:42 AM
>> To: LifeType Developer List
>> Subject: Re: [pLog-svn] BlogNameValidator() cause Chinese
>> blog name error!
>>
>>  	Check again:
>>
>> return(( Textfilter::domainize( Textfilter::filterAllHTML(
>> $value ))) != "" );
>>
>>
>> On Tue, 11 Sep 2007, Oscar Renalias wrote:
>>
>>> Why is BlogNameValidator the problem? I don't see any calls to
>>> domainize() or urlize() in the code of the validator...
>>>
>>> On 11 Sep 2007, at 14:28, Mark Wu wrote:
>>>
>>>> Hi Oscar & Jon:
>>>>
>>>> It seems the new BlogNameValidator will cause some error when user
>>>> enter Chinese blog name.
>>>>
>>>> I am still checking on it, it seems the new
>> Textfilter::domanize() or
>>>> Textfilter::urlize()  casue the error.
>>>>
>>>> If I can not fix this bug, I will change it back to string
>> validator
>>>> if blog admin does not enable subdomain and blogdomain
>> function. It
>>>> can avoid this kind of problem.
>>>>
>>>> Mark
>>>> _______________________________________________
>>>> pLog-svn mailing list
>>>> pLog-svn at devel.lifetype.net
>>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> Normal people believe that if it ain't broke,
>>     don't fix it.
>> Engineers believe that if it ain't broke,
>>     it doesn't have enough features yet.
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com/

There are two ways to write error-free programs; only the third works.
-- Alan J. Perlis


More information about the pLog-svn mailing list