4 * File: IPofUrl.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']), 'ipofurl.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
33 class IPofUrl extends BaseCommand {
35 * No Constructor Use BaseCommand constructor
40 function execute($comment)
42 global $_CONF, $_TABLES, $_USER, $LANG_SX00, $result;
44 if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
51 * Check for IP of url in blacklist
54 * regex to find urls $2 = fqd
56 $regx = '(ftp|http|file)://([^/\\s]+)';
57 $num = preg_match_all ("#{$regx}#", html_entity_decode ($comment), $urls);
59 $result = DB_query ("SELECT value FROM {$_TABLES['spamx']} WHERE name='IPofUrl'", 1);
60 $nrows = DB_numRows ($result);
63 for ($j = 1; $j <= $nrows; $j++) {
64 list ($val) = DB_fetchArray ($result);
65 for ($i = 0; $i < $num; $i++) {
66 $ip = gethostbyname ($urls[2][$i]);
68 $ans = 1; // quit on first positive match
69 SPAMX_log ($LANG_SX00['foundspam'] . $urls[2][$i] .
70 $LANG_SX00['foundspam2'] . $uid .
71 $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);