hi,
i'm trying to install this bad-word filter plugin to my site i'm creating but it doesnt even work with the demo file. I have gone thru the forum but still straggling to find the answer. Basically whats happening is its not filtering at all i see a message like below on the top of the topic and Yes i'm using the "addon_badwords.txt" and haven't done any changes to the file @ all...
Could someone please point me in the right direction to solve this problem...
This is what i'm getting...
<@;}{~!--'; /* special symbols (surrounding bad words) - regular expression pattern */ function striReplace($find,$replace,$string){ $i=0; $exploded=explode(strtolower($find),strtolower($string)); foreach($exploded as $k=>$v){ $exploded[$k]=substr($string,$i,strlen($v)); $i+=strlen($find)+strlen($v); } return implode($replace,$exploded); } function badWords(&$fText){ $badAr=explode("\n",str_replace("\r",'',implode('',file($GLOBALS['pathToFiles'].'addon_badwords.txt')))); $text=explode(' ',str_replace("\n",' ',str_replace("\r",'',strtolower($fText)))); foreach($badAr as $bV){ foreach($text as $tk=>$tV){ if($bV==$tV or(strlen($bV)>=$GLOBALS['tolerance'][0]&&stristr($tV,$bV)) or(eregi('(['.$GLOBALS['badReg'].']|^)'.$bV.'(['.$GLOBALS['badReg'].']|$)',$tV)) or(strlen($bV)>=$GLOBALS['tolerance'][1]&&eregi('(['.$GLOBALS['badReg'].']|^)'.$bV.'(.*)',$tV))){ $rep='*'; $ln=strlen(ereg_replace('['.$GLOBALS['badReg'].']','',$tV)); for($i=1;$i<$ln;$i++) $rep.='*'; $repSave=$text[$tk]; $text[$tk]=ereg_replace('[^'.$GLOBALS['badReg'].'].*[^'.$GLOBALS['badReg'].']',$rep,$tV); $fText=striReplace($repSave,$text[$tk],$fText); } } } } if(isset($action) and $action=='ptopic'){ badWords($_POST['topicTitle']); badWords($_POST['postText'] ); } elseif(isset($action) and $action=='pthread') badWords($_POST['postText'] ); elseif(isset($action) and $action=='editmsg2'){ badWords($_POST['postText'] ); if(isset($_POST['postTopic'])) badWords($_POST['postTopic']); } elseif(isset($_POST['prevForm']) and trim($_POST['postText'])!=''){ if(isset($_POST['topicTitle'])) badWords($_POST['topicTitle']); badWords($_POST['postText'] ); } ?> |