|
printable version
- email this article
How To install the keyword filter
by PP
Tuesday, Sep. 26, 2006 at 2:12 PM
small howto on how to install the keyword filter.
1) in 'local/templates/pages/spam.tpl' add the following line:
<li><h3><a href="/admin/log/file_viewer.php?filename=banned_keywords.txt">keyword block</a></h3></li>
2) add a file named 'banned_keywords.txt' in 'local/cache'. Make sure your webserver can write to it (otherwise you can't use it in admin). In this file you add keywords.
3) add the following line to your spam section in 'local/config/sfactive.cfg'
$GLOBALS['spam_filter_keywords'] = 1; // filter for banned keywords .
The number is the amount of keywords it needs to reach before you get blocked out.
4) apply the following code to 'shared/classes/spam_class.inc':
/** block posts if they contain certain keywords. */
if ($GLOBALS['spam_filter_keywords'] > 0) {
$keywords = file(SF_CACHE_PATH.'/banned_keywords.txt','r');
$matched_keywords = array();
for ( $i=0; $i= $GLOBALS['spam_filter_keywords']) {
$ret=1;
$keyword_string = implode(' ', $matched_keywords);
$this->Log("Keyword Spam Detected: " . $keyword_string);
}
}
.
this should come in you 'Detect' method.
note: if you put 'free' as a keyword it will also block 'freedom' 'freeze' ...
LATEST COMMENTS ABOUT THIS ARTICLE
Listed below are the 10 latest comments of 6 posted about this article.
These comments are anonymously submitted by SF-IMC website visitors.
|
|
|