[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 3 /* 4 # ***** BEGIN LICENSE BLOCK ***** 5 # This file is part of Plume CMS, a website management application. 6 # Copyright (C) 2001-2006 Loic d'Anterroches and contributors. 7 # 8 # Plume CMS is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Plume CMS is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 # 22 # ***** END LICENSE BLOCK ***** */ 23 24 /** 25 * Vegetarian people don't like spam. 26 */ 27 class Vegetarian 28 { 29 /** 30 * $p['ct'] contains the comment. 31 */ 32 function onNewPublicComment($name, $p) 33 { 34 $ip = $p['ct']->f('comment_ip'); 35 if (strlen($p['ct']->f('comment_content')) < 20) { 36 $p['ct']->setField('comment_status', PX_RESOURCE_STATUS_JUNK); 37 } 38 if (false == Vegetarian::checkClientIP($ip)) { 39 $p['ct']->setField('comment_status', PX_RESOURCE_STATUS_JUNK); 40 } 41 } 42 43 /** 44 * Plugin Name: Block-lists anti-spam measures 45 * Version: 1.5.1 46 * Plugin URI: http://weblog.sinteur.com/index.php?p=8106 47 * Description: check if a comment poster is on an open proxy 48 * list, and check if the content contains known spammer domains 49 * Author: John Sinteur, with a big thank you to io_error! 50 * Author URI: http://weblog.sinteur.com/ 51 */ 52 function checkClientIP($spammer_ip) 53 { 54 $rev = array_reverse(explode('.', $spammer_ip)); 55 $lookup = implode('.', $rev).'.'.'l1.spews.dnsbl.sorbs.net.'; 56 if ($lookup != @gethostbyname($lookup)) { 57 return false; 58 } 59 $lookup = implode('.', $rev).'.'.'sbl-xbl.spamhaus.org.'; 60 if ($lookup != @gethostbyname($lookup)) { 61 return false; 62 } 63 $lookup = implode('.', $rev).'.'.'list.dsbl.org.'; 64 if ($lookup != gethostbyname($lookup)) { 65 return false; 66 } 67 return true ; 68 } 69 } 70 71 Hook::register('onNewPublicCommentBeforeSave', 72 'Vegetarian', 'onNewPublicComment'); 73 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |