1
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