How To install the keyword filter : sf-active
IMC / INFORMATION WARFARE MUNITIONS
sf-active :: indymedia
english | castellano | italian | Nederlands
download : documentation : support
irc : cvs : bugs : faq : servers
latest articles : sf-active sites
about sf-active
sf-active is a collection of object-oriented classes for content management, open publishing and news syndication. All the pages needed to run an indymedia site are distributed with the code

other links
indymedia codebases
indymedia global tech

software, politica e indymedia





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' ...

add your comments


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.
TITLE AUTHOR DATE
oops this should look better try this Wednesday, Oct. 04, 2006 at 12:03 AM
didn't work... try this Wednesday, Oct. 04, 2006 at 12:02 AM
meta refresh author Monday, Oct. 02, 2006 at 4:55 AM
pick a theme:

Latest Newswire
Publish your news
View Latest Comments