1
karuna
let each censor word have it's own replace word
  • 2005/2/22 19:06

  • karuna

  • Not too shy to talk

  • Posts: 171

  • Since: 2002/5/29


run sql via phpmyadmin
UPDATE `xoops_config` SET `conf_formtype` = 'textarea', `conf_valuetype` = 'array' WHERE `conf_name` = 'censor_replace'


modife the file kenerl/config.php
about line 221
change
if (is_array($configs)) {
                foreach (
array_keys($configs) as $i) {
                    
$ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
                }
            }

to

if (is_array($configs)) {
               foreach (
array_keys($configs) as $i) {
                if(
$configs[$i]->getVar('conf_name') == 'censor_words'){
                    
$temp = array();
                    foreach(
$configs[$i]->getConfValueForOutput() as $j)
                        
$temp[] = "|$j|siU";
                    
$ret[$configs[$i]->getVar('conf_name')] = $temp;
                } else {
                       
$ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
                }
               }
        }


class/module.textsanitizer.php

about line 360
change function &censorString(&$text){....}
to
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) {            
            
$replacements $this->censorConf['censor_replace'];
            
$patterns $this->censorConf['censor_words'];
            
$text preg_replace($patterns$replacements$text);
        }
           return 
$text;
    }




then u should enter the replace words also use the aaa|bbb format.

2
Peekay
Re: let each censor word have it's own replace word
  • 2005/2/22 21:26

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I can't test this at the moment but it sounds like a cool hack! Especially if my post about censor words and Google is true.

Login

Who's Online

203 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 203


more...

Donat-O-Meter

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

Latest GitHub Commits