From 8e12d18e4a447df1d0bd302de68579a244d9f679 Mon Sep 17 00:00:00 2001 From: nohn Date: Tue, 19 Apr 2005 10:42:26 +0000 Subject: [PATCH] factored out rbl --- .../serendipity_event_spamblock.php | 44 +------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php index b860055..c96cc8f 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_RBL', 'Spamschutz: Ihre IP ist als Open Relay geführt, daher wird Ihr Kommentar abgewiesen.'); @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'); @@ -28,12 +27,8 @@ 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_RBL', 'Kommentare abweisen, die von geblacklisteten IPs stammen'); - @define('PLUGIN_EVENT_SPAMBLOCK_RBL_DESC', 'Wird diese Option aktiviert, werden Kommentare abgewiesen die von IPs stammen, die in einer RBL/Blacklist geführt werden. Die Aktivierung hiervon kann Dial-Up oder Proxy-User betreffen!'); @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_RBLLIST', 'Welche RBLs sollen verwendet werden'); - @define('PLUGIN_EVENT_SPAMBLOCK_RBLLIST_DESC', 'Eine Liste von zu verwendenden RBLs. Listen mit dynamischen Hosts sollten vermieden werden.'); @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. '); @@ -61,7 +56,6 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_SPAMBLOCK_REASON_KILLSWITCH', 'Notfall-Blockade'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_BODYCLONE', 'Doppelter Kommentar'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_IPFLOOD', 'IP-Block'); - @define('PLUGIN_EVENT_SPAMBLOCK_REASON_RBL', 'RBL-Block'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_CAPTCHAS', 'Captcha ungültig (Eingegeben: %s, Erwartet: %s)'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_FORCEMODERATION', 'Moderation nach X Tagen'); @define('PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_REJECT', 'Zu viele Links'); @@ -96,7 +90,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_RBL', 'Spam Prevention: The IP of the computer you are posting from, is listed as an open relay.'); @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'); @@ -106,12 +99,8 @@ 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_RBL', 'Reject comments from RBL-listed hosts'); - @define('PLUGIN_EVENT_SPAMBLOCK_RBL_DESC', 'Enabling this setting will reject comments made from hosts which are listed in RBLs. Pay attention that this may affect proxy-users or dial-up users.'); @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_RBLLIST', 'Which RBLs should be contacted'); - @define('PLUGIN_EVENT_SPAMBLOCK_RBLLIST_DESC', 'Blocks comments based on provided RBL lists. Avoid lists with dynamic 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.'); @@ -139,7 +128,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_RBL', 'RBL-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'); @@ -198,7 +186,7 @@ var $filter_defaults; 'frontend_comment' => true, 'fetchcomments' => true )); - $propbag->add('configuration', array('killswitch', 'bodyclone', 'ipflood', 'surbl_enabled', 'rbl_enabled', 'rbllist', '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', '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')); $this->filter_defaults = array( 'authors' => 'casino;phentermine;credit;loans;poker', @@ -313,20 +301,6 @@ var $filter_defaults; $propbag->add('default', false); break; - case 'rbl_enabled': - $propbag->add('type', 'boolean'); - $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_RBL); - $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_RBL_DESC); - $propbag->add('default', false); - break; - - case 'rbllist': - $propbag->add('type', 'string'); - $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_RBLLIST); - $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_RBLLIST_DESC); - $propbag->add('default', 'sbl-xbl.spamhaus.org, bl.spamcop.net'); - break; - case 'captchas_ttl': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_TTL); @@ -590,22 +564,6 @@ var $filter_defaults; } } - // Check for IP listed in RBL - 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'; - - $dnsbl->setBlacklists(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/Net/DNSBL/SURBL.php'; -- 2.39.5