Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7626/plugins/serendipity_event_spamblock
Modified Files:
serendipity_event_spamblock.php
Log Message:
Updated serendipity_event_spamblock to the new Networking::Net_DNSBL package
Index: serendipity_event_spamblock.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- serendipity_event_spamblock.php 19 Nov 2004 11:24:57 -0000 1.27
+++ serendipity_event_spamblock.php 21 Nov 2004 15:32:05 -0000 1.28
@@ -310,30 +310,25 @@
// Check for IP listed in RBL
// Partly based on work done by James Seward (ja...@ja...)
if (serendipity_db_bool($this->get_config('rbl_enabled', false))) {
+ require_once 'bundled-libs/Net/DNSBL.php';
+ $dnsbl = new Net_DNSBL();
$remoteIP = $_SERVER['REMOTE_ADDR'];
# $remoteIP = '81.70.69.193';
- $rbls = explode(',', $this->get_config('rbllist'));
- if (preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/", $remoteIP, $res)) {
- array_shift($res);
- $reverseIP = implode('.', array_reverse($res));
- foreach ($rbls as $rbl) {
- $rblhost = $reverseIP .'.'. trim($rbl);
- if (gethostbyname($rblhost) != $rblhost) {
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_RBL, $addData);
- $eventData = array('allow_comments' => false);
- $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL;
- return false;
- }
- }
+ $dnsbl->setRBL(explode(',', $this->get_config('rbllist')));
+ if ($dnsbl->isListed($remoteIP)) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_RBL, $addData);
+ $eventData = array('allow_comments' => false);
+ $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL;
+ return false;
}
}
// Check for IP listed in SURBL
if (serendipity_db_bool($this->get_config('surbl_enabled', false))) {
- require_once 'bundled-libs/Services/SURBL.php';
- $surbl = new Services_SURBL();
- if ($surbl->isSpam($addData['url'])) {
+ require_once 'bundled-libs/Net/DNSBL/SURBL.php';
+ $surbl = new Net_DNSBL_SURBL();
+ if ($surbl->isListed($addData['url'])) {
$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_SURBL, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL;
@@ -360,7 +355,7 @@
}x", $addData['comment'], $matches);
// END Code copied from http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
foreach ($matches[0] as $surbl_check_url) {
- if ($surbl->isSpam($surbl_check_url)) {
+ if ($surbl->isListed($surbl_check_url)) {
$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_SURBL, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL;
|