News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Check Before Posting

Started by slinouille, February 11, 2009, 01:18:38 AM

Previous topic - Next topic

edi67

Quote from: slinouille on February 23, 2009, 08:34:32 AM
I've uploaded release 0.3.1 that should correct my previous very bad mod packaging.
I've tested it on my forum and on a fresh rc1 smf forum ... should work as it should ;)
Please tell me if on your forum it's okay?

i dont understand, not work for me, i insert url of site image not allowed and nothing happen, i disallowed url and nothing, i allow and nothing....i can post normally image from not permitted host
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

slinouille

@edi67: perhaps is it my code parser that is not good ?!? can you post what kind of text you have put in the "restriction list" so that I test it

Thks
Visit VAG-Technique.fr
Take a look to my mods

edi67

Quote from: slinouille on February 26, 2009, 02:31:35 AM
@edi67: perhaps is it my code parser that is not good ?!? can you post what kind of text you have put in the "restriction list" so that I test it

Thks

for example

amazon.com
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

mgrmgr

#23
Thanks for that version 0.3.1, slinouille, does work now (on my page).

Just a suggestion for the next improvement:

the mod seems to work only with the img and url bbc-tags. Automatically activated links like http://www.yahoo.de or so seem not to be checked (answer also for edi67's question?) I'd like to have also checked those kind auf automatic links :)

Edit: disabling those "automatic" links is no real solution, because it would also disallow links to our own site (like forum links) which should be working.

slinouille

@edi67: I've seen an error in my code.
in file Sources/Post.php, select
//CheckBeforePosting mod
    if ( isset($modSettings['enable_check_images']) && $modSettings['enable_check_images'] == 1 || ( $modSettings['enable_check_links'] != '0' && isset($modSettings['enable_check_links']) ) ){

replace by
//CheckBeforePosting mod
    if ( isset($modSettings['enable_check_images']) && $modSettings['enable_check_images'] != '0' || ( $modSettings['enable_check_links'] != '0' && isset($modSettings['enable_check_links']) ) ){


I'll put a new release today
Visit VAG-Technique.fr
Take a look to my mods

eddie8

This Mod is a really good idea

This Mod seems like a good thing to have, is their any outstanding issues
I should know about before I install it? I read the thread and I see some
updates then nothing, I know its probably completed I'm just double checking

Thanks
Ed

mgrmgr

Quote from: eddie8 on March 20, 2009, 05:24:28 PM
This Mod is a really good idea

This Mod seems like a good thing to have, is their any outstanding issues
I should know about before I install it? I read the thread and I see some
updates then nothing, I know its probably completed I'm just double checking

I have installed version 0.3.2 on my Test forum 2.0 RC1 - works ok for me.

SFF Forum

Thanks for your good job,it is really a good mod.But can you please update this mod to SMF1.1.8,too
I Love Simple Machines Forum .

Shark-Time



Providing Cheapest Offshore Hosting as low as 5$/year.
MoneyBookers | AlertPay
Pm Me

mgrmgr

Quote from: Shark-Time on August 17, 2009, 06:13:59 AM
need for SMF 1.1.10

I agree - I'd like to have also an updated (if necessary) version for 2.0 RC2 or an entry in the description that it works on that version too.

@slinouille : But I won't hold my breath :)

Mick.

#30
Maybe we need to fine tune this mod a bit...

I get the following errors:

8: Undefined index: uppercase_ratio_in_message
File: /home/******/public_html/Sources/Post.php
Line: 1535


and...

8: Undefined index: uppercase_ratio_in_subject
File: /home/*******/public_html/Sources/Post.php
Line: 1528



FYI,  those are the only options im not using.  The uppercases.   

The links and hosting options seem to be fine without errors.




These are the lines....

//CheckBeforePosting mod - check uppercase letters ratio in SUBJECT
if ( $modSettings['uppercase_ratio_in_subject'] >= 0 && !empty($modSettings['uppercase_ratio_in_subject']) ){
$subject = str_replace(' ','',$_POST['subject']); //don't take spaces into account
$ratio = preg_match_all( "/[A-Z]/", $subject, $res ) / strlen($subject) * 100;
if ( $ratio >= $modSettings['uppercase_ratio_in_subject'] )
$post_errors[] = 'too_many_uppercase_letters_in_subject';
}
//CheckBeforePosting mod - check uppercase letters ratio in MESSAGE
if ( $modSettings['uppercase_ratio_in_message'] >= 0 && !empty($modSettings['uppercase_ratio_in_message']) ){
$message = str_replace(' ','',$_POST['message']); //don't take spaces into account
$ratio = preg_match_all( "/[A-Z]/", $message, $res ) / strlen($message) * 100;
if ( $ratio >= $modSettings['uppercase_ratio_in_message'] )
$post_errors[] = 'too_many_uppercase_letters_in_message';
}

SISPro

#31

Quote
Quote from: bluedevil on January 22, 2010, 05:49:21 PM
Maybe we need to fine tune this mod a bit...

I get the following errors:

8: Undefined index: uppercase_ratio_in_message
File: /home/******/public_html/Sources/Post.php
Line: 1535


and...

8: Undefined index: uppercase_ratio_in_subject
File: /home/*******/public_html/Sources/Post.php
Line: 1528



FYI,  those are the only options im not using.  The uppercases.   

The links and hosting options seem to be fine without errors.




These are the lines....

//CheckBeforePosting mod - check uppercase letters ratio in SUBJECT
if ( $modSettings['uppercase_ratio_in_subject'] >= 0 && !empty($modSettings['uppercase_ratio_in_subject']) ){
$subject = str_replace(' ','',$_POST['subject']); //don't take spaces into account
$ratio = preg_match_all( "/[A-Z]/", $subject, $res ) / strlen($subject) * 100;
if ( $ratio >= $modSettings['uppercase_ratio_in_subject'] )
$post_errors[] = 'too_many_uppercase_letters_in_subject';
}
//CheckBeforePosting mod - check uppercase letters ratio in MESSAGE
if ( $modSettings['uppercase_ratio_in_message'] >= 0 && !empty($modSettings['uppercase_ratio_in_message']) ){
$message = str_replace(' ','',$_POST['message']); //don't take spaces into account
$ratio = preg_match_all( "/[A-Z]/", $message, $res ) / strlen($message) * 100;
if ( $ratio >= $modSettings['uppercase_ratio_in_message'] )
$post_errors[] = 'too_many_uppercase_letters_in_message';
}


getting the same thing.

well not sure about this mod it looks and sound like a cool but, I am getting way to many errors in the error log. here are some.


with this mod any page i go to it puts a error in the error log
also not matter how i have it set lets say disallowed hosting sites i put in the ones i don't want i can't post anything it is always telling me that site is not allowed.

would like to see this get fix i do like it this mod.

Kindred

#32
something which I discovered, which may be related to the errors noted:

If you do not SET each of the field values, the system does not set them and thus you get undefined_index errors.

to fix:
for EACH field, choose a setting other than the default.
---
turn on the link check, set a value for the caps check, etc.
Save
then change the settings back to what you want, i.e. turn off link check, but leave caps check on...

this sets the variable in the system and thus stops the undefined_index errors.



the ultimate fix for this would be to have the mod actually SET those values, if it determines a NULL.


edit: just discovered another error...
Division by 0

This is due to the fact that the subject and message CAPS check happen before the "is the subject/message empty" check.

Either change
if ( $modSettings['uppercase_ratio_in_subject'] >= 0 && !empty($modSettings['uppercase_ratio_in_subject']) ) {
to
if ( $modSettings['uppercase_ratio_in_subject'] >= 0 && !empty($modSettings['uppercase_ratio_in_subject']) && strlen($_POST['subject'])>0 ) {
and
if ( $modSettings['uppercase_ratio_in_message'] >= 0 && !empty($modSettings['uppercase_ratio_in_message']) ){
to
if ( $modSettings['uppercase_ratio_in_message'] >= 0 && !empty($modSettings['uppercase_ratio_in_message']) && strlen($_POST['message'])>0 ){

or (better choice)
move the entire caps check to AFTER

// Check the subject and message.
if (!isset($_POST['subject']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['subject'])) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['message']), ENT_QUOTES) === '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';
else
{
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SISPro

is there a for sure fix for this mod

Kindred

for sure fix for WHAT?

The mod works correctly for me. I noted (and listed the fix for) two minor issues.... but neither of those issues affect how the mod works.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SISPro

this is the message i get when posting

The following error or errors occurred while posting this message:
You can't insert a link to

Kindred

and what do you have in the "denied link" field in admin?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SISPro

these are image hosting sites that i don't want allowed.

imagepix,imageshack,imagepix,tinypic,hotlinkimage,yourfreeporn,linkbee,linkbucks,imagecash,hostapicture,

and so far file hosting sites.

Letitbit,filemonster,

the links i was posting was done of these.

Kindred

hmmm.... the empty comma at the end might be the issue...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

sharks

Yeah, this can very useful. Maybe you could add more options, like block certain keywords from being used in the topic title and/or topic body.

Also, please optimize it such that it does not crash big forums. Decrease the number of queries if possible.

Advertisement: