4 * File: BlackList.Examine.class.php
5 * This is the Personal BlackList Examine class for the Geeklog Spam-X plugin
7 * Copyright (C) 2004-2006 by the following authors:
8 * Author Tom Willett tomw AT pigstye DOT net
10 * Licensed under GNU General Public License
16 if (strpos(strtolower($_SERVER['PHP_SELF']), 'blacklist.examine.class.php') !== false) {
17 die('This file can not be used on its own!');
21 * Include Abstract Examine Class
23 require_once $_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php';
26 * Examines Comment according to Personal BLacklist
28 * @author Tom Willett tomw AT pigstye DOT net
32 class BlackList extends BaseCommand {
34 * No Constructor Use BaseCommand constructor
39 function execute ($comment)
41 global $_CONF, $_TABLES, $_USER, $LANG_SX00;
43 if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
50 * Include Blacklist Data
52 $result = DB_query ("SELECT value FROM {$_TABLES['spamx']} WHERE name='Personal'", 1);
53 $nrows = DB_numRows ($result);
56 $comment = html_entity_decode ($comment);
58 $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
60 $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
62 for ($i = 1; $i <= $nrows; $i++) {
63 list ($val) = DB_fetchArray ($result);
64 $val = str_replace ('#', '\\#', $val);
65 if (preg_match ("#$val#i", $comment)) {
66 $ans = 1; // quit on first positive match
67 SPAMX_log ($LANG_SX00['foundspam'] . $val .
68 $LANG_SX00['foundspam2'] . $uid .
69 $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);