View Full Version : Show Thread Enhancements - FractalizeR: Extended Post Censor
FractalizeR
11-11-2007, 10:00 PM
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
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
* projectego clicks install :)
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:
Return(array(
'/!{3,}/' => '!!!',
'/?{3,}/' => '???'
));
I would also like to limit the signs to just one. Would I just change the code to:
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
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
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
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
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
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:
“ -and- ” -and- ’
to
" -and- " -and- '
Rss feeds don't like the previous curly quote.
FractalizeR
11-15-2007, 03:32 PM
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.
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.
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
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.
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.
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
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
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
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
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:
return(array());
And I get error'ss with these samle ones too:
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....
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
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
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.
Big_Ern
12-08-2007, 07:00 PM
Did anyone find a solution to the errors me & brandonury are getting??
dartho
01-07-2008, 12:28 AM
This looks like what I may be looking for.
I would like to have rules in place to censor words so that guests or Registered users will see '*'s in place of swear words, but one specific secondary usergroup will see still the uncensored post.
Is this how the "censor for this usergroup' works?
In regards to censoring titles, I see that THIS (https://vborg.vbsupport.ru/showthread.php?t=105209) add-on by Calorie has options for censoring Titles also (although the logic behind the add-on is entirely different) - do you think it may be possible to implement something for titles?
Thanks
[Edit]
Just had a look at the code - this kind of does the opposite to what I want in regards to censoring posts. I'm sure it will just take adding an '!' or two in the right place to make this apply to ALL users groups except those checked in the admincp options - any help appreciated!
Thanks
yellowpinky
03-17-2008, 03:51 PM
Anyone using on 3.6.8p2 ?
I installed it with no changes (empty replacements)
and the posts all show up with no message text.
I added the default example replacements, same story, no message text.
Oddly, this is for all users, not only the usergroups selected in the configuration screen.
ePrOmD
03-28-2008, 05:46 PM
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.
sorry for the delay, I`ve already tried it, but it doesn`t work.
'/\s+[A-Za-z_\.]+@[A-Za-z_]+\.[A-Za-z_]+\s+/' =>'XXX@XXX.XXX'
i leave the screen shot, in order that you see can check it.
thank you very much
77871
Big_Ern
03-30-2008, 11:40 PM
Anyone using on 3.6.8p2 ?
I installed it with no changes (empty replacements)
and the posts all show up with no message text.
I added the default example replacements, same story, no message text.
Oddly, this is for all users, not only the usergroups selected in the configuration screen.
Same problem for me on 3.6.8p2
Arboristsite
12-08-2008, 01:35 AM
I was wondering if you have people putting stuff like For Sale and you ban for sale and then they come back with F O R S A L E. Will it attack that? Or will it make every f and o and so on on the board a *. If this can't be done with this hack anyone know how to attack this kind of behavior?
FractalizeR
12-08-2008, 08:28 AM
It is impossible. Forget about blocking advertising names. Better hire more moderators to keep and eye on ads spammers.
mikeinjersey
03-23-2009, 01:40 AM
I remember members on my forum would try to bypass the censor filter by changing the font size or color of certain letters...so that it would pass through the censor.
example : FONT COLOR=BLACK , etc..
Can this mod fix that , so it doesnt pass through censor anymore ? has anyone here tried it ?
RTWAP
04-06-2009, 03:54 PM
Has anyone used this with 3.8.2?
To mikeinjersey: Regular expressions are very powerful. You can search for "F|f" followed by zero or more " " followed by "U|u" ... and so on.
accludetuner
10-26-2009, 05:41 AM
will be testing on 3.8.4
accludetuner
10-27-2009, 08:57 PM
So far it appears to be working fine on 3.8.4! Thanks FractalizeR!
I was wondering if anyone else using this has a list of REGEX's for the common curse words and maybe variations of them. It would sure make it a lot easier for myself and others if common REGEX's were posted in this thread.
accludetuner
10-28-2009, 07:04 PM
OK, noticed one issue. If I select a specific usergroup in adminCP, it does not get saved when I click save. Looking into it now and hopefully I'll have a solution for it.
Zillo
03-10-2010, 07:01 PM
Hello,
Does this work on 4.2?
Simon Lloyd
03-11-2010, 06:03 AM
3.8.4 - 4.2 have their own censored words list that you can add entries to, what does this mod do more than that?
FractalizeR
03-12-2010, 06:50 AM
There is no 4.2 version released. Only 4.0.2.
But my mod allows to use regular expressions on word censoring. Standard doesn't have this capability.
Kaitou Ace
09-18-2010, 04:49 AM
Any chance of a vb 4.0.x version? I used to have this on my forum under 3.x and it was wonderfully useful.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.