vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Show Thread Enhancements - FractalizeR: Extended Post Censor (https://vborg.vbsupport.ru/showthread.php?t=162548)

FractalizeR 11-11-2007 10:00 PM

FractalizeR: Extended Post Censor
 
What this hack does?
This hack is a post censor, that will replace unwanted words and phrases by the values you specify.

Features:
  • Supports standard replace
  • Supports replacing using regular expressions
  • Allows to apply censor only to specified usergroups
  • On-the-fly regular expression syntax checking

Some use cases:
  • I don't like posts with multiple exclamation or question marks. Maximum three signs is allowed.
  • Sometimes you ban competitor forum names from using on your forum. But users enter them separating letters by spaces or underscores. This is unwanted and it is difficult to deal with using standard censor
  • Any forms of curses and bad words should be replaced by XXX

Version was tested under VB 3.6.8, but supposed to work on any 3.6.x release. Please report all compatibility issues here.

Please look at control panel screenshot below (please mind, that I am russian and screenshots are from russian forum, so for example usergroup names are incorrectly displayed when I set langauge to English).

FreshFroot 11-12-2007 08:08 PM

hmm looks really good. I know a lot of people try to bypass the filters with spaced.

Just wondering, can this also bypass other characters besides the basic alphabet? Because I know people were using other characters that look like the alphabet to bypass the filters, not sure if your hack can filter it or not?

zglows 11-12-2007 08:35 PM

cool!

FractalizeR 11-12-2007 08:41 PM

Quote:

Originally Posted by FreshFroot (Post 1381277)
Just wondering, can this also bypass other characters besides the basic alphabet? Because I know people were using other characters that look like the alphabet to bypass the filters, not sure if your hack can filter it or not?

Yes, of course. You can use \xhh in search pattern, that denotes symbol with hexadecimal code hh. You can read more about this here: http://ru2.php.net/manual/en/ref.pcre.php

brandondrury 11-12-2007 09:33 PM

I'm not sure if I did something wrong or not, but it's not working. The text isn't showing up and I'm getting the following errors.

Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 15

Warning: array_values() [function.array-values]: The argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 15

Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 23

Warning: array_values() [function.array-values]: The argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 23

Warning: preg_replace() [function.preg-replace]: Empty regular expression in \includes\class_postbit.php(296) : eval()'d code on line 23

I'm using 3.6.8 on a local Xampp server.

Brandon

FractalizeR 11-12-2007 10:07 PM

Could you please show me a screenshot of your settings in control panel?

brandondrury 11-13-2007 03:52 AM

I had done several of my arrays, but always came up with the same result. I ended up just copying and pasting your sample array even though I don't see anyone typing "StringIWantToReplaceInto1" anytime soon. :) Still, no luck.

Brandon

projectego 11-13-2007 07:35 AM

[high]* projectego clicks install :)[/high]

FractalizeR 11-13-2007 11:21 AM

brandondrury, have you get rid of those nasty error messages? I cannot reproduce this situation on my forum. About filter - have you set usergroups this filter should be applied to? Filtering will work only for usergroups you select.

Does someone who also installed this hack has any problems with it?

Elenna 11-13-2007 11:06 PM

I havn't tried it yet, i'm still fiddling with the expressions. How would I go about doing the same for multiple question marks? When I put a ? in there, it tells me that there is something wrong with my expression.

Here is what I have in the Regular Expression part:
Code:

Return(array(
'/!{3,}/' => '!!!',
'/?{3,}/' => '???'
));

I would also like to limit the signs to just one. Would I just change the code to:
Code:

Return(array(
'/!{1,}/' => '!',
'/?{1,}/' => '?'
));


FractalizeR 11-14-2007 07:16 AM

Yes, '?' is a special sign in regular expressions language that means, that preceding symbol can be in string, or can be omitted. You need to escape it by '\' to use as a string.
To replace many question marks by some string use the following regex:

'/\?{3,}/' => '???'

The expression in {} tells, that preceding symbol is repeated three or more times. We can write {,3} for example and it will mean, that something repeated up to three times. We can specify {3,6} and it will mean, that something is repeated from 3 to 6 times.

dot (".") means one any symbol.
plus ("+") means, that preceding symbol or expression is repeated one or more times. It is actually equal to {1,}.
asterisk ("*") means, that preceding symbol or expression is repeated zero or more times.

\d - means one any digit.
\s - means any space character

For example we can replace multiple spaces by one:
'/\s+/' => '' " - remember, + means "one or more"

If you need to apply + or * or any other "quantifier" to several characters you need to put these characters into brackets:

/(abc)+/ => "abc" - replace one or more abc sttrings by one copy so that "abcabcabc" becomes "abc"

So, about your case - yes, all correct, just escape ? by \

Elenna 11-14-2007 12:34 PM

Got it, thanks so much!

One question, since I can't test this until my site goes live... does this work in post preview, or just when they submit the post?

FractalizeR 11-14-2007 01:55 PM

Actually, censor makes no changes to DB. So, words are replaced on post is displayed.
Preview is not affected preventing users from experimenting with filter faking.

mrkiwi 11-14-2007 02:50 PM

Hi!
Tell me please, is it possible to censor/replace the whole message, if it contains unwanted word?
Thanks )

Elenna 11-14-2007 04:23 PM

Quote:

Originally Posted by FractalizeR (Post 1382405)
Actually, censor makes no changes to DB. So, words are replaced on post is displayed.
Preview is not affected preventing users from experimenting with filter faking.

Awesome, thank you! That's what I was afraid of, if it happened during preview ;)

FractalizeR 11-14-2007 05:22 PM

Quote:

Originally Posted by mrkiwi (Post 1382446)
Hi!
Tell me please, is it possible to censor/replace the whole message, if it contains unwanted word?
Thanks )

Hi. Yes, actually, it is. Try to make it by such regex:

'/.*UnwantedWord.*/' => 'I don't like this message!'

tobybird 11-14-2007 05:23 PM

Interesting concept and one our forums could benefit from if the follow works as desired.

What would happen if you wanted to replace the "U" with "You" in the following sentence: "U should bring an umbrella."

Would the outcome be "You should bring an umbrella." or You shoyould bring an youmbrella."?

Elenna 11-15-2007 02:46 AM

This is working nicely, thank you!
How would I have it reduce
"?!?!?!?!?" to just "?!"

I kno wmy members will 'get around' it by alternating them. :P

FractalizeR 11-15-2007 05:29 AM

Quote:

Originally Posted by tobybird (Post 1382527)
Interesting concept and one our forums could benefit from if the follow works as desired.

What would happen if you wanted to replace the "U" with "You" in the following sentence: "U should bring an umbrella."

Would the outcome be "You should bring an umbrella." or You shoyould bring an youmbrella."?

In this case we need to change a single "u" with "you". You can try this one:
/\w+u\w+/ =>"you"
\w - is any "non-word" character

Quote:

Originally Posted by Elenna
This is working nicely, thank you!
How would I have it reduce
"?!?!?!?!?" to just "?!"
I kno wmy members will 'get around' it by alternating them. :P

Make it like:
"/((\?\!)|(\!\?))+/" = > "?!"
It means, replace any number of "?!" or "!?" sequences by single "?!". "|" - means "or"

Small update: to prevent users from using different combinations of "!", "?" and spaces one may try something like this:
"/((\!\s*)|(\?\s*)){3,}/" => "Exclamation!"

mrkiwi 11-15-2007 09:13 AM

Quote:

Originally Posted by FractalizeR (Post 1382526)
Hi. Yes, actually, it is. Try to make it by such regex:

'/.*UnwantedWord.*/' => 'I don't like this message!'

Thanks.

But i have the same problem as brandondrury :(
same mistakes and no messages on my forum shown at all.

FractalizeR 11-15-2007 11:48 AM

Are you running 3.6.8 on your server? Could you please try to uninstall and reinstall my hack? It seem like no settings are saved or evaluated inside plugin.

Wired1 11-15-2007 12:10 PM

When searching for words to replace, will it also search for ones with spaces? For example, if you block "example", will it also block "ex am ple" on the fly? If not, this is exactly like the Replacement Variable Manager that's built into the forum.

Now, having a regex area is kind of nice, but I could swear that's built into the forum as well, just can't remember where I've seen it in the AdminCP.

mrkiwi 11-15-2007 12:30 PM

no, 3.6.7 at the moment.
I'll upgrade and try again )

SBlueman 11-15-2007 01:22 PM

Would this work with changing quotes from:

Quote:

“ -and- ” -and- ’
to

Quote:

" -and- " -and- '
Rss feeds don't like the previous curly quote.

FractalizeR 11-15-2007 03:32 PM

Quote:

Originally Posted by Wired1 (Post 1382950)
Now, having a regex area is kind of nice, but I could swear that's built into the forum as well, just can't remember where I've seen it in the AdminCP.

Ok. If you will find this out - tell me.

Quote:

Originally Posted by mrkiwi
no, 3.6.7 at the moment. I'll upgrade and try again )

Ok. I am not sure will this help or not, but I am running 3.6.8 and all fine.

Quote:

Originally Posted by SBlueman
Would this work with changing quotes from:

You can make it work, but my censor does not affect RSS. Displaying posts only.

Spank 11-16-2007 04:57 AM

Brilliant, exactly what I need, will install later.

Big_Ern 11-17-2007 03:40 AM

Will this hack censor thread titles as well as the post body text?

Big_Ern 11-17-2007 05:49 AM

Quote:

Originally Posted by FractalizeR (Post 1381660)
brandondrury, have you get rid of those nasty error messages? I cannot reproduce this situation on my forum. About filter - have you set usergroups this filter should be applied to? Filtering will work only for usergroups you select.

Does someone who also installed this hack has any problems with it?

I also installed it and am getting the same errors.

Quote:

Originally Posted by vB
Warning: array_keys() [function.array-keys]: The first argument should be an array in /includes/class_postbit.php(296) : eval()'d code on line 15

Warning: array_values() [function.array-values]: The argument should be an array in /includes/class_postbit.php(296) : eval()'d code on line 15

Warning: array_keys() [function.array-keys]: The first argument should be an array in /includes/class_postbit.php(296) : eval()'d code on line 23

Warning: array_values() [function.array-values]: The argument should be an array in /includes/class_postbit.php(296) : eval()'d code on line 23

Warning: preg_replace() [function.preg-replace]: Empty regular expression in /includes/class_postbit.php(296) : eval()'d code on line 23

These errors appear on every post I try to view at the very top of the page (right where my logo banner is) The post itself is blank.

vB 3.6.8
PHP 4.4.4
MySQL Version 4.1.22-standard

I tried the same Control Panel settings as brandondrury, as well as my own custom regex.

This mod looks perfect for my forum. I hope we can find a solution:(

Big_Ern 11-17-2007 06:18 AM

I think I found a solution for this problem: http://gallery.menalto.com/node/57633

some guy was running into the same problem with another chunk of code he was writing.
Quote:

Fixed this one by adding a line to .htaccess

php_value session.cookie_domain MY.DOMAIN.COM
I would rather not modify my .htaccess if there's a simlpe fix to your hack that could be done instead.

Cheers

Aaron

FractalizeR 11-17-2007 07:45 PM

It is not a problem of my hack, I think. It seem like PHP bug or misconfiguration.
May be also at main VBulletin settings something related to cookies or session is misconfigured.

About titles - they are not affected.

Big_Ern 11-18-2007 08:10 AM

Darn, I was hoping it might do titles too. That's one of the big things that would be usefull to censor on my forum.

I'll take a look into the hack & settings to see if I can make it work.... What version of PHP are you running?

FractalizeR 11-19-2007 08:53 AM

I am running 5.2.1. But hack should work on all PHP versions, that VB support.
I will also take a look. The problem is, that thread titles are displayed in many templates and deep hacking is needed.

ePrOmD 11-19-2007 12:57 PM

hi fractalizer

i wanna use your hack to filter mails directions.

so everytime that some user writes somebody@someserver.another.com the hack will replace it with XXXXXX@XXXX.XXX
i don?t have idea of expressions, so i dont know, how can i do it :$
so it?ll be very grateful if you guide me to do that

Skublum 11-19-2007 09:37 PM

Quote:

Originally Posted by brandondrury (Post 1381327)
I'm not sure if I did something wrong or not, but it's not working. The text isn't showing up and I'm getting the following errors.

Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 15

Warning: array_values() [function.array-values]: The argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 15

Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 23

Warning: array_values() [function.array-values]: The argument should be an array in \includes\class_postbit.php(296) : eval()'d code on line 23

Warning: preg_replace() [function.preg-replace]: Empty regular expression in \includes\class_postbit.php(296) : eval()'d code on line 23

I'm using 3.6.8 on a local Xampp server.

Brandon

Brandon

I know what the problem you are having is.

It is simply that you need to put a comma after the single quote if there is going to be ANOTHER thing to censor after it.

In other words the comma should be after each one with the exception of the last one

so it SHOULD look like this

PHP Code:

return(array(

'StringIWantToReplaceFrom1' => 'StringIWantToReplaceInto1',

'StringIWantToReplaceFrom2' => 'StringIWantToReplaceInto2',

'StringIWantToReplaceFrom3' => 'StringIWantToReplaceInto3',

'StringIWantToReplaceFrom4' => 'StringIWantToReplaceInto4',

'StringIWantToReplaceFrom5' => 'StringIWantToReplaceInto5'

)); 


Skublum 11-19-2007 09:51 PM

One thing that I might just be missing or it might not exist,

the ability to remove case sensitive blocking. So that if it is at the beginning of a sentence and is capitalized it still gets blocked.

Big_Ern 11-20-2007 06:33 AM

Quote:

Originally Posted by Skublum (Post 1385876)
I know what the problem you are having is.

It is simply that you need to put a comma after the single quote if there is going to be ANOTHER thing to censor after it.

In other words the comma should be after each one with the exception of the last one

so it SHOULD look like this

PHP Code:

return(array(

'StringIWantToReplaceFrom1' => 'StringIWantToReplaceInto1',

'StringIWantToReplaceFrom2' => 'StringIWantToReplaceInto2',

'StringIWantToReplaceFrom3' => 'StringIWantToReplaceInto3',

'StringIWantToReplaceFrom4' => 'StringIWantToReplaceInto4',

'StringIWantToReplaceFrom5' => 'StringIWantToReplaceInto5'

)); 


But the examples we tried all had coma's at the end of each line....

Even if I try it with the default installed blank setting I get the errors. I used this:
Code:

return(array());
And I get error'ss with these samle ones too:
Code:

return(array(
'StringIWantToReplaceFrom1' => 'StringIWantToReplaceInto1',
'StringIWantToReplaceFrom2' => 'StringIWantToReplaceInto2'
));


WTF, just got a msn from a board member while I was testing... setting says its set to admins only, but my friend got the same errors and he is just a regular basic user, so this mod should not even be affecting him....


Quote:

Originally Posted by Skublum (Post 1385890)
One thing that I might just be missing or it might not exist,

the ability to remove case sensitive blocking. So that if it is at the beginning of a sentence and is capitalized it still gets blocked.

Regex does that if you put '/wordToReplace/i' The i makes it case insensitive.

FractalizeR 11-21-2007 02:22 PM

Quote:

Originally Posted by ePrOmD (Post 1385535)
hi fractalizer

i wanna use your hack to filter mails directions.

so everytime that some user writes somebody@someserver.another.com the hack will replace it with XXXXXX@XXXX.XXX
i don?t have idea of expressions, so i dont know, how can i do it :$
so it?ll be very grateful if you guide me to do that

Try such regex:
'/\s+[A-Za-z_\.]+@[A-Za-z_]+\.[A-Za-z_]+\s+/' =>'XXX@XXX.XXX'

2Big_Ern:
Still cannot reproduce error on my PC, but will check these days.

Big_Ern 11-22-2007 12:48 AM

i just find it odd that me & bandonury are getting the same error.... I'm trying to think what might be causing it, but my forum has no other mods installed and I am on a good host that usually never has any tech problems r limitations like some of the free hosts....

thanks for looking into it. I hope we can find a solution, as I would love to install your mod:cool:

Skublum 11-22-2007 08:55 PM

Is there anyway this could work for people using different cases. I don't care if they use different characters to get the word across, that is against my forums rules and they will be warned, but I hate punishing those who know of the censor and just type the word anyway expecting it to be blocked but then because it was at the beginning of a sentence or they write in all caps it gets by.

Big_Ern 11-22-2007 11:17 PM

Make it case insensitive
Quote:

Originally Posted by Big_Ern (Post 1386104)
Quote:

Originally Posted by Skublum (Post 1385890)
One thing that I might just be missing or it might not exist,

the ability to remove case sensitive blocking. So that if it is at the beginning of a sentence and is capitalized it still gets blocked.

Regex does that if you put '/wordToReplace/i' The i makes it case insensitive.



All times are GMT. The time now is 07:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02141 seconds
  • Memory Usage 1,858KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (20)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete