From c31a8dd7b9519e871cd053d41b148e14964c186f Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 13 Jan 2009 18:00:26 +0000 Subject: [PATCH] * Change "Allow duplicate content" in spamblock plugin to not operate on (empty) pingbacks (garvinhicking) --- docs/NEWS | 3 +++ .../serendipity_event_spamblock.php | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index abe94445..8e20ab7a 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -6,6 +6,9 @@ Version 1.5 () Version 1.4.1 () ------------------------------------------------------------------------ + * Change "Allow duplicate content" in spamblock plugin to not + operate on (empty) pingbacks (garvinhicking) + * Upgrade to Smarty 2.6.22 to fix a PCRE bug * Remove warning message when checking for plugin documentation files diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php index 23dcaafd..8ab88e92 100644 --- a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php +++ b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php @@ -734,10 +734,11 @@ var $filter_defaults; break; case 'frontend_saveComment': + /* $fp = fopen('/tmp/spamblock2.log', 'a'); fwrite($fp, date('Y-m-d H:i') . "\n" . print_r($eventData, true) . "\n" . print_r($addData, true) . "\n"); fclose($fp); - + */ if (!is_array($eventData) || serendipity_db_bool($eventData['allow_comments'])) { $this->checkScheme(); @@ -1110,8 +1111,8 @@ var $filter_defaults; } // Check for identical comments. We allow to bypass trackbacks from our server to our own blog. - if ( $this->get_config('bodyclone', true) === true && $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { - $query = "SELECT count(id) AS counter FROM {$serendipity['dbPrefix']}comments WHERE body = '" . serendipity_db_escape_string($addData['comment']) . "'"; + if ( $this->get_config('bodyclone', true) === true && $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] && $addData['type'] != 'PINGBACK') { + $query = "SELECT count(id) AS counter FROM {$serendipity['dbPrefix']}comments WHERE type = '" . $addData['type'] . "' AND body = '" . serendipity_db_escape_string($addData['comment']) . "'"; $row = serendipity_db_query($query, true); if (is_array($row) && $row['counter'] > 0) { $this->IsHardcoreSpammer();