From: nohn Date: Tue, 19 Apr 2005 11:29:55 +0000 (+0000) Subject: factoring out surbl X-Git-Tag: 0.8.1~30^2~18 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b7cc75aeea00babd81b4c4ae201e24ccd78a2ac9;p=s9y.git factoring out surbl --- diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php index c96cc8f..b053eca 100644 --- a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php +++ b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php @@ -19,7 +19,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_DESC', 'Mehrere Varianten um Kommentarspam einzudämmen'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY', 'Spamschutz: Ungültiger Kommentar'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_IP', 'Spamschutz: Ein weiterer Kommentar kann nicht so schnell übermittelt werden.'); - @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL', 'Spamschutz: Ihre Nachricht enthält eine URL, die als SPAM geführt wird, daher wird Ihr Kommentar abgewiesen.'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_KILLSWITCH', 'Dieses Blog ist im "Notfall Kommentar"-Modus. Bitte kommen Sie später wieder.'); @define('PLUGIN_EVENT_SPAMBLOCK_BODYCLONE', 'Keine doppelten Kommentare erlauben'); @define('PLUGIN_EVENT_SPAMBLOCK_BODYCLONE_DESC', 'Verbietet Benutzern ein Kommentar zu übermitteln, was gleichlautend bereits besteht.'); @@ -27,8 +26,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH_DESC', 'Übergangsweise Kommentare zu allen Einträgen verbieten. Nützlich, wenn das Blog unter andauerndem Spam-Beschuss leidet.'); @define('PLUGIN_EVENT_SPAMBLOCK_IPFLOOD', 'IP-Block Intervall'); @define('PLUGIN_EVENT_SPAMBLOCK_IPFLOOD_DESC', 'Schränkt die Anzahl an Kommentare pro IP ein, indem nur alle X Minuten ein Kommentar erlaubt wird. Hilfreich um Spamfluten derselben IP abzuwehren.'); - @define('PLUGIN_EVENT_SPAMBLOCK_SURBL', 'Kommentare abweisen, die als SPAM gelistete URLs enthalten'); - @define('PLUGIN_EVENT_SPAMBLOCK_SURBL_DESC', 'Wird diese Option aktiviert, werden Kommentare abgewiesen die als SPAM geblacklistet sind.'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS', 'Captchas aktivieren'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_DESC', 'Erfordert die Eingabe eines zufälligen Buchstabenfolge vom Benutzer, damit ein Kommentar angenommen wird. Diese Eingabe kann von Spambots nicht getätigt werden und verhindert so automatische Kommentare. Jedoch können behinderte oder blinde Personen mit der Darstellung solcher Eingabegrafiken Probleme haben.'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_USERDESC', 'Um maschinelle und automatische Übertragung von Spamkommentaren zu verhinden, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss um dieses Verfahren anzuwenden. '); @@ -90,7 +87,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_DESC', 'A variety of methods to prevent comment spam'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_BODY', 'Spam Prevention: Invalid message.'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_IP', 'Spam Prevention: You cannot post a comment so soon after submitting another one.'); - @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_SURBL', 'Spam Prevention: Your comment contains an URL listed in SURBL.'); @define('PLUGIN_EVENT_SPAMBLOCK_ERROR_KILLSWITCH', 'This blog is in "Emergency Comment Blockage Mode", please come back another time'); @define('PLUGIN_EVENT_SPAMBLOCK_BODYCLONE', 'Do not allow duplicate comments'); @@ -99,8 +95,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH_DESC', 'Temporarily disable comments for all entries. Useful if your blog is under spam attack.'); @define('PLUGIN_EVENT_SPAMBLOCK_IPFLOOD', 'IP block interval'); @define('PLUGIN_EVENT_SPAMBLOCK_IPFLOOD_DESC', 'Only allow an IP to submit a comment every n minutes. Useful to prevent comment floods.'); - @define('PLUGIN_EVENT_SPAMBLOCK_SURBL', 'Reject comments that containt SURBL-listed hosts'); - @define('PLUGIN_EVENT_SPAMBLOCK_SURBL_DESC', 'Reject comments that containt SURBL-listed hosts'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS', 'Enable Captchas'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_DESC', 'Will force the user to input a random string displayed in a specially crafted image. This will disallow automated submits to your blog. Please remember that people with decreased vision may find it hard to read those captchas.'); @define('PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_USERDESC', 'To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.'); @@ -128,7 +122,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_REASON_KILLSWITCH', 'Emergency Comment Blockage'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_BODYCLONE', 'Duplicate comment'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_IPFLOOD', 'IP-block'); - @define('PLUGIN_EVENT_SPAMBLOCK_REASON_SURBL', 'SURBL-block'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_CAPTCHAS', 'Invalid captcha (Entered: %s, Expected: %s)'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION', 'Auto-moderation after X days'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_REJECT', 'Too many hyperlinks'); @@ -186,7 +179,7 @@ var $filter_defaults; 'frontend_comment' => true, 'fetchcomments' => true )); - $propbag->add('configuration', array('killswitch', 'bodyclone', 'ipflood', 'surbl_enabled', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'contentfilter_authors', 'hide_email', 'logtype', 'logfile')); + $propbag->add('configuration', array('killswitch', 'bodyclone', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'contentfilter_authors', 'hide_email', 'logtype', 'logfile')); $this->filter_defaults = array( 'authors' => 'casino;phentermine;credit;loans;poker', @@ -294,13 +287,6 @@ var $filter_defaults; $propbag->add('default', 0); break; - case 'surbl_enabled': - $propbag->add('type', 'boolean'); - $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_SURBL); - $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_SURBL_DESC); - $propbag->add('default', false); - break; - case 'captchas_ttl': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_TTL); @@ -564,49 +550,6 @@ var $filter_defaults; } } - // Check for IP listed in SURBL - if (serendipity_db_bool($this->get_config('surbl_enabled', false))) { - 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; - 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] +? - - - (?= - [$punc] * - [^$any] - | - $ - ) - }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->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; - return false; - } - } - } - } - return true; - break; - case 'frontend_comment': if (serendipity_db_bool($this->get_config('hide_email', false))) { echo '
' . PLUGIN_EVENT_SPAMBLOCK_HIDE_EMAIL_NOTICE . '
';