[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /** 4 * File: BlackList.Examine.class.php 5 * This is the Personal BlackList Examine class for the Geeklog Spam-X plugin 6 * 7 * Copyright (C) 2004-2006 by the following authors: 8 * Author Tom Willett tomw AT pigstye DOT net 9 * 10 * Licensed under GNU General Public License 11 * 12 * $Id: BlackList.Examine.class.php,v 1.12 2006/12/10 08:57:49 dhaun Exp $ 13 */ 14 15 if (strpos ($_SERVER['PHP_SELF'], 'BlackList.Examine.class.php') !== false) { 16 die ('This file can not be used on its own!'); 17 } 18 19 /** 20 * Include Abstract Examine Class 21 */ 22 require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php'); 23 24 /** 25 * html_entity_decode is only available as of PHP 4.3.0 26 */ 27 if (!function_exists ('html_entity_decode')) { 28 require_once ('PHP/Compat.php'); 29 30 PHP_Compat::loadFunction ('html_entity_decode'); 31 } 32 33 /** 34 * Examines Comment according to Personal BLacklist 35 * 36 * @author Tom Willett tomw AT pigstye DOT net 37 */ 38 39 class BlackList extends BaseCommand { 40 /** 41 * No Constructor Use BaseCommand constructor 42 */ 43 /** 44 * Here we do the work 45 */ 46 function execute ($comment) 47 { 48 global $_CONF, $_TABLES, $_USER, $LANG_SX00; 49 50 if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) { 51 $uid = $_USER['uid']; 52 } else { 53 $uid = 1; 54 } 55 56 /** 57 * Include Blacklist Data 58 */ 59 $result = DB_query ("SELECT value FROM {$_TABLES['spamx']} WHERE name='Personal'", 1); 60 $nrows = DB_numRows ($result); 61 62 // named entities 63 $comment = html_entity_decode ($comment); 64 // decimal notation 65 $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment); 66 // hex notation 67 $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment); 68 $ans = 0; 69 for ($i = 1; $i <= $nrows; $i++) { 70 list ($val) = DB_fetchArray ($result); 71 $val = str_replace ('#', '\\#', $val); 72 if (preg_match ("#$val#i", $comment)) { 73 $ans = 1; // quit on first positive match 74 SPAMX_log ($LANG_SX00['foundspam'] . $val . 75 $LANG_SX00['foundspam2'] . $uid . 76 $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']); 77 break; 78 } 79 } 80 return $ans; 81 } 82 } 83 84 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |