Hi,

Some members use SPACE to match the minimum length of description and title field, can you tell me if this has been corrected in the CVS version or if there is any other way to limit the users who post too much and without trying to write an original title and description ?

Thanks a lot.

Comments

mercmobily’s picture

Hi,

There is no current way. My god, that's nasty of your users...

Fixing it is probably semi trivial. Line 884 in node.module:

// Check the length of the title and the body
//
if(variable_get('drigg_body_minimum_length',50 ) != 0 && strlen(strip_tags($node->body)) < variable_get('drigg_body_minimum_length',50)){
form_set_error('body', t('The description is too short!'));
}
...
if(variable_get('drigg_title_minimum_length',10) != 0 && strlen(strip_tags($node->title)) < variable_get('drigg_title_minimum_length',10)){
form_set_error('title', t('The title is too short!'));
}

Can you send me a patch that does the same checks but trims spaces before and after the body and the title?

I can't believe they are doing it.

Merc.

alliax’s picture

Status: Fixed » Active

I'm not sending a patch because I don't know how to do one, but just to tell the author what is needed, it is simply adding the trim() function to those lines : strlen(strip_tags($node->body)

so the code would look like :

// Check the length of the title and the body
//
if(variable_get('drigg_body_minimum_length',50 ) != 0 && strlen(strip_tags(trim($node->body))) < variable_get('drigg_body_minimum_length',50)){
form_set_error('body', t('The description is too short!'));
}
...
if(variable_get('drigg_title_minimum_length',10) != 0 && strlen(strip_tags(trim($node->title))) < variable_get('drigg_title_minimum_length',10)){
form_set_error('title', t('The title is too short!'));
}

but if your users then use dots or other characters to fill in the body and title, find out where they live and kill them!

wwwoliondorcom’s picture

The file to modify is not node.module but drigg.module

Thanks, it seems ok now, not possible to add SPACE anymore.

But how to treat the other condition, if the posters use dots or other characters ?

mercmobily’s picture

Hi,

Sorry, I got the name wrong.
I am afraid it's impossible to fix it if users use dots etc. There will always be a way to fool even the most complex AI.

Hey, feel free to send over your modifications, so that I can add them to Drigg!

Merc.

wwwoliondorcom’s picture

I just used the code that Alliax posted above, sorry but I also don't know how to make a patch.

Thanks.

mercmobily’s picture

Hi,

Silly me, I completely missed Alliax's patch!
Sorry about that. And yes, applied to CVS.

Merc.

mercmobily’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Active » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.