4 * File: MTBlackList.Examine.class.php
5 * This module examines comments for entries on the MT-Blacklist
6 * for the Geeklog Spam-X plugin
8 * Copyright (C) 2004-2009 by the following authors:
9 * Author Tom Willett tomw AT pigstye DOT net
11 * Licensed under GNU General Public License
13 * The MT-Blacklist was maintained by Jay Allen
14 * http://www.jayallen.org/comment_spam/
20 if (strpos(strtolower($_SERVER['PHP_SELF']), 'mtblacklist.examine.class.php') !== false) {
21 die('This file can not be used on its own!');
25 * Include Abstract Examine Class
27 require_once $_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php';
30 * Examines Comment according to MT-BLacklist
32 * @author Tom Willett tomw AT pigstye DOT net
37 class MTBlackList extends BaseCommand {
39 * No Constructor Use BaseCommand constructor
44 function execute ($comment)
46 global $_CONF, $_USER, $_TABLES, $LANG_SX00;
48 if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
55 * Include Blacklist Data
57 $result = DB_query ("SELECT value FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'", 1);
58 $nrows = DB_numRows ($result);
61 $comment = html_entity_decode ($comment);
63 $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
65 $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
66 $ans = 0; // Found Flag
67 for ($i = 1; $i <= $nrows; $i++) {
68 list ($val) = DB_fetchArray ($result);
69 if (@preg_match ("#$val#i", $comment)) {
70 $ans = 1; // quit on first positive match
71 SPAMX_log ($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] .
72 $uid . $LANG_SX00['fsc2'] . $_SERVER['REMOTE_ADDR']);