1
devilock76
Word Censor Problem
  • 2006/2/2 19:48

  • devilock76

  • Just popping in

  • Posts: 56

  • Since: 2005/7/1 2


OK I am setting up the word censor and I noticed the following condition

If you have say the word badword to be replaced with !DOH!

OK so the following lines:

badword
badwordyomomma
yomommabadword

Become:
!DOH!
!DOH!yomomma
yomommabadword

The third instance the word filter does not pick up. It seems that XOOPS will only pick up the bad word if it is stand alone or the beginning of a new word. It will not pick it up if there is other text in front of it.

Why is this important to me/

Well our site we are fairly lenient about the words however we are trying to keep out F***, S***, and C***

Ok well that works fine but we want to make sure F*** derivatives are caught and the one that is not by this limitation is motherF***er.

i would like MotherF***er to become Mother!DOH!er. Call it my aesthetic opinion.

Ok well I looked at module.textsanitizer.php

and found this snippet:

/**
     * Replaces banned words in a string with their replacements
     *
     * @param   string $text
     * @return  string
     *
     * @deprecated
     **/
    
function &censorString(&$text)
    {
        if (!isset(
$this->censorConf)) {
            
$config_handler =& xoops_gethandler('config');
            
$this->censorConf =& $config_handler->getConfigsByCat(XOOPS_CONF_CENSOR);
        }
        if (
$this->censorConf['censor_enable'] == 1) {
            
$replacement $this->censorConf['censor_replace'];
            foreach (
$this->censorConf['censor_words'] as $bad) {
                if ( !empty(
$bad) ) {
                     
$bad quotemeta($bad);
                    
$patterns[] = "/(s)".$bad."/siU";
                    
$replacements[] = "\1".$replacement;
                    
$patterns[] = "/^".$bad."/siU";
                    
$replacements[] = $replacement;
                    
$patterns[] = "/(n)".$bad."/siU";
                    
$replacements[] = "\1".$replacement;
                    
$patterns[] = "/]".$bad."/siU";
                    
$replacements[] = "]".$replacement;
                    
$text preg_replace($patterns$replacements$text);
                }
               }
        }
           return 
$text;
    }


So I guess my base question is what $patterns[] entry do I need to make to get this to function the way I want?

On a side note if I get this fixed I am also looking for a way to make my private forums excluded from the word filter yet keep the filter on all other content including the public forums?

Ken

2
devilock76
Re: Word Censor Problem
  • 2006/2/3 19:07

  • devilock76

  • Just popping in

  • Posts: 56

  • Since: 2005/7/1 2


Bump, I am thinking the answer to my problem is to make the pattern simply the pattern string alone with no special before or after coditions?

Ken

3
devilock76
Re: Word Censor Problem
  • 2006/2/6 16:30

  • devilock76

  • Just popping in

  • Posts: 56

  • Since: 2005/7/1 2


Sorry to be redundant but...

BUMP Take 2.

Anyone, Bueller, is my question that boring?

Ken

4
bb2120
Re: Word Censor Problem
  • 2006/2/6 19:34

  • bb2120

  • Not too shy to talk

  • Posts: 179

  • Since: 2005/7/6 1


No, just none of the XOOPS.ORG resident techies have seen it yet...

5
devilock76
Re: Word Censor Problem
  • 2006/2/10 15:56

  • devilock76

  • Just popping in

  • Posts: 56

  • Since: 2005/7/1 2


Quote:

bb2120 wrote:
No, just none of the XOOPS.ORG resident techies have seen it yet...


Yeah, figured that, I am just a little weak on the PHP side. I am getting better. I used to be a pretty good C/C++ programmer so it is coming back!

Reminds me I found a bug in XOOPS 2.0.13 I need to post. This time I worked around it.

Ken

Login

Who's Online

308 user(s) are online (245 user(s) are browsing Support Forums)


Members: 0


Guests: 308


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits