Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3346/plugins/serendipity_event_spamblock
Modified Files:
Tag: branch-smarty
serendipity_event_spamblock.php
Log Message:
mfh
Index: serendipity_event_spamblock.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php,v
retrieving revision 1.4.2.10
retrieving revision 1.4.2.11
diff -u -d -r1.4.2.10 -r1.4.2.11
--- serendipity_event_spamblock.php 23 Sep 2004 13:16:44 -0000 1.4.2.10
+++ serendipity_event_spamblock.php 23 Sep 2004 13:24:09 -0000 1.4.2.11
@@ -225,9 +225,9 @@
if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) {
$logfile = $this->get_config('logfile', $serendipity['serendipityPath'] . 'spamblock_captcha.log');
if ( $this->get_config('killswitch', false) === true ) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_KILLSWITCH;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH, $addData);
return false;
}
@@ -236,9 +236,9 @@
$query = "SELECT count(id) AS counter FROM {$serendipity['dbPrefix']}comments WHERE body = '" . serendipity_db_escape_string($addData['comment']) . "'";
$row = serendipity_db_query($query, true);
if (is_array($row) && $row['counter'] > 0) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH, $addData);
return false;
}
}
@@ -248,9 +248,9 @@
$query = "SELECT max(timestamp) AS last_post FROM {$serendipity['dbPrefix']}comments WHERE ip = '" . serendipity_db_escape_string($_SERVER['REMOTE_ADDR']) . "'";
$row = serendipity_db_query($query, true);
if (is_array($row) && $row['last_post'] > (time() - $this->get_config('ipflood', 2)*60)) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_IPFLOOD, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_IP;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_IPFLOOD, $addData);
return false;
}
}
@@ -268,9 +268,9 @@
foreach ($rbls as $rbl) {
$rblhost = $reverseIP .'.'. trim($rbl);
if (gethostbyname($rblhost) != $rblhost) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_RBL, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_RBL;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_RBL, $addData);
return false;
}
}
@@ -280,33 +280,33 @@
// Captcha checking
if ($show_captcha) {
if (!isset($serendipity['POST']['captcha']) || strtolower($serendipity['POST']['captcha']) != strtolower($_SESSION['spamblock']['captcha'])) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_CAPTCHAS;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS, $addData);
return false;
}
}
// Check for forced moderation
if ($forcemoderation > 0 && $eventData['timestamp'] < (time() - ($forcemoderation * 60 * 60 * 24))) {
+ $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_FORCEMODERATION, $addData);
$eventData['moderate_comments'] = true;
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_NOTICE_MODERATION;
- $this->log($logfile, $eventData['id'], 'MODERATE', PLUGIN_EVENT_SPAMBLOCK_FORCEMODERATION, $addData);
return false;
}
$link_count = substr_count(strtolower($addData['comment']), 'http://');
if ($links_reject > 0 && $link_count > $links_reject) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_LINKS_REJECT, $addData);
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_LINKS_REJECT, $addData);
return false;
}
if ($links_moderate > 0 && $link_count > $links_moderate) {
+ $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_LINKS_MODERATE, $addData);
$eventData['moderate_comments'] = true;
$serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_NOTICE_MODERATION;
- $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_LINKS_MODERATE, $addData);
return false;
}
}
@@ -437,11 +437,12 @@
}
$fp = @fopen($logfile, 'a+');
- if ( !is_resource($fp) ) {
+ if (!is_resource($fp)) {
return;
}
+
fwrite($fp, sprintf(
- '[%s] - [%s: %s] - [#%d, Name "%s", E-Mail "%s", URL "%s", User-Agent "%s", IP %s] - [%s]' . "\n",
+ '[%s] - [%s: %s] - [#%s, Name "%s", E-Mail "%s", URL "%s", User-Agent "%s", IP %s] - [%s]' . "\n",
date('Y-m-d H:i:s'),
$switch,
$reason,
|