1 (edited by Knalzalm 2006-01-13 20:20)

Topic: Censoring overruled by BCC code

I don't know if someone has said this before. This is not really a bug, just something I noticed. For example: If you have fuck censored on your forum, this can simply be overruled:

fuck

This works with all BCC codes, at every word. I hope this will be fixed in 1.3 (if this ís in fact a problem, I could after all be wrong ofcourse).

2

Re: Censoring overruled by BCC code

f.u.c.k isn't caught either by the wildcards. I have a bunch that find every way they can to get around the filter.  Does anyone know a way to solve this?

Thanks

Re: Censoring overruled by BCC code

you could solve catching f.u.c.k or f-u-c-k etc using a regex such as f[.-]?u[.-]?c[.-]?k, however im not sure if punbb censoring supports regex, or it would need to be hard coded in (in which case it would be more work).

Re: Censoring overruled by BCC code

then you could just do f..uck tongue imo censor is a bit wasted, just edit posts and punish people as appropriate?

5

Re: Censoring overruled by BCC code

Or you could use another language to curse with and then nobody is the wiser wink

6

Re: Censoring overruled by BCC code

I just want to censor the F word, because we have a few guys who use it in every post...and the mods don't do anything about it b/c their all friends...so It's an uphill battle that I'm loosing.

I like Reines idea. Can someone elaborate on regex more? and does anyone know if it works with punbb?

7 (edited by Reines 2006-01-18 15:51)

Re: Censoring overruled by BCC code

Odis wrote:

I like Reines idea. Can someone elaborate on regex more? and does anyone know if it works with punbb?

Taking a look at the censor function, no punbb doesn't support regex censors just now. I assume this is because if it did then all censors would need to be regex, and alot of people have trouble with it. If you wish to change it so punbb will allow you to add regex censors (keep in mind this would require all your censors to be regex compatable) then you can simply open include/functions.php and find

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

and replace with

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', $search_for[$i]).')\b/i';

If you need help with using regex's, there is a good tutorial here: http://weblogtoolscollection.com/regex/regex.php

Re: Censoring overruled by BCC code

Reines wrote:
Odis wrote:

I like Reines idea. Can someone elaborate on regex more? and does anyone know if it works with punbb?

Taking a look at the censor function, no punbb doesn't support regex censors just now. I assume this is because if it did then all censors would need to be regex, and alot of people have trouble with it. If you wish to change it so punbb will allow you to add regex censors (keep in mind this would require all your censors to be regex compatable) then you can simply open include/functions.php and find

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

and replace with

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', $search_for[$i]).')\b/i';

If you need help with using regex's, there is a good tutorial here: http://weblogtoolscollection.com/regex/regex.php

That was a great tutorial. Maybe this is something I should look into deeper.

9 (edited by CodeXP 2006-02-16 22:34)

Re: Censoring overruled by BCC code

I've been playing around with this a little bit lately, and I found the following to be a good solution:

In functions.php, replace:

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

with:

            $search_for[$i] = ( substr($search_for[$i], 0, 7) == 'regexp:' ) ? substr($search_for[$i], 7) : '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

This would allow you to use both the regular PunBB word replacement, and regular expressions. Simply add regexp: before the word to censor, and the exact regexp you enter after the : will be executed smile

10

Re: Censoring overruled by BCC code

CodeXP wrote:

I've been playing around with this a little bit lately, and I found the following to be a good solution:

In functions.php, replace:

            $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

with:

            $search_for[$i] = ( substr($search_for[$i], 0, 7) == 'regexp:' ) ? substr($search_for[$i], 7) : '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';

This would allow you to use both the regular PunBB word replacement, and regular expressions. Simply add regexp: before the word to censor, and the exact regexp you enter after the : will be executed smile

Going to look at this when I get home.  You're saying with this I add regexp: on the admin list to censor?

11 (edited by CodeXP 2006-02-17 00:16)

Re: Censoring overruled by BCC code

Yes, although, you don't want to add *just* regexp: wink

Here's a very simplistic example, that you could add in the censor word box, to do an case-insensitive search for PunBB:

regexp:/PunBB/i

Easy, yet quite effective.


EDIT: A better example would be how to solve the problem described in this topic.

Censored word:

regexp:/\s([\?:;!])/

EDIT 2: Damnit, this forum messed up the replacement text when in a code tag, but ok, as the replacement text, enter the following, without the spaces: & # 160;$1

12

Re: Censoring overruled by BCC code

works nicely.  How can I do a wildcard in it though?  something like

regexp:/f*u*c*k/i

13 (edited by CodeXP 2006-02-17 00:41)

Re: Censoring overruled by BCC code

Odis wrote:

works nicely.  How can I do a wildcard in it though?  something like

regexp:/f*u*c*k/i

You could do it like this:

regexp:/f.*u.*c.*k/i

(dot matches any chars that is not a line-break, followed by a * which indicates that it's continue searching until a match for the next char is found.)

Although, that would create problems...as it will continue searching *all* the text until a match is found. A better solution would be:

regexp:/f.{0,7}u.{0,7}c.{0,7}k/i

This wil make sure that when the letter F is found, it'll look from 0 to 7 chars forward for the next letter C, and so on. Just replace the number 7 with whatever you want the maximum to be. Don't set it to high though smile

14 (edited by Odis 2006-02-17 16:55)

Re: Censoring overruled by BCC code

perfect regexp:/f.{0,2}u.{0,2}c.{0,2}k/i

Thanks CodeXP