Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_spamblock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16156
Modified Files:
Tag: branch-smarty
serendipity_event_spamblock.php
Log Message:
* revert lost changes
* We use spaces, not tabs. :)
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.24
retrieving revision 1.4.2.25
diff -u -d -r1.4.2.24 -r1.4.2.25
--- serendipity_event_spamblock.php 11 Nov 2004 13:31:39 -0000 1.4.2.24
+++ serendipity_event_spamblock.php 11 Nov 2004 14:10:34 -0000 1.4.2.25
@@ -124,6 +124,9 @@
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_TITLE);
$propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_DESC);
+ $propbag->add('stackable', false);
+ $propbag->add('author', 'Garvin Hicking, Sebastian Nohn');
+ $propbag->add('version', '1.1');
$propbag->add('event_hooks', array(
'frontend_saveComment' => true,
'external_plugin' => true,
@@ -278,8 +281,8 @@
return false;
}
- // Check for identical comments.
- if ( $this->get_config('bodyclone', true) === true ) {
+ // 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']) . "'";
$row = serendipity_db_query($query, true);
if (is_array($row) && $row['counter'] > 0) {
@@ -326,21 +329,21 @@
// 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'])) {
- $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;
- return false;
- }
- // BEGIN Code copied from http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
- $urls = '(http|file|ftp)';
- $ltrs = '\w';
- $gunk = '/#~:.?+=&%@!\-';
- $punc = '.:?\-';
- $any = "$ltrs$gunk$punc";
- preg_match_all("{
+ require_once 'bundled-libs/Services/SURBL.php';
+ $surbl = new Services_SURBL();
+ if ($surbl->isSpam($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;
+ return false;
+ }
+ // BEGIN Code copied from http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
+ $urls = '(http|file|ftp)';
+ $ltrs = '\w';
+ $gunk = '/#~:.?+=&%@!\-';
+ $punc = '.:?\-';
+ $any = "$ltrs$gunk$punc";
+ preg_match_all("{
\b
$urls :
[$any] +?
@@ -353,16 +356,16 @@
$
)
}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)) {
- $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;
- return false;
- }
- }
- }
+ // 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)) {
+ $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;
+ return false;
+ }
+ }
+ }
// Captcha checking
if ($show_captcha && $addData['type'] == 'NORMAL') {
|