From 06a9e22c8abbe81e02f0095c8962432a59b6daea Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Thu, 8 Sep 2005 08:59:55 +0000 Subject: [PATCH] Spamblock plugin can check for "@" in mails. --- .../UTF-8/lang_de.inc.php | 3 +++ .../lang_de.inc.php | 3 +++ .../serendipity_event_spamblock.php | 23 +++++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/plugins/serendipity_event_spamblock/UTF-8/lang_de.inc.php b/plugins/serendipity_event_spamblock/UTF-8/lang_de.inc.php index 0f602b9..e5cf056 100644 --- a/plugins/serendipity_event_spamblock/UTF-8/lang_de.inc.php +++ b/plugins/serendipity_event_spamblock/UTF-8/lang_de.inc.php @@ -65,3 +65,6 @@ @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_URLS_DESC', 'Reguläre Ausdrücke erlaubt, Zeichenkennten durch Semikolon (;) trennen.'); @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS', 'Wortfilter für Autorennamen'); @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS_DESC', 'Reguläre Ausdrücke erlaubt, Zeichenkennten durch Semikolon (;) trennen.'); + + @define('PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL', 'Ungültige E-Mail Adresse'); + @define('PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL', 'Auf ungültige E-Mail Adressen prüfen?'); diff --git a/plugins/serendipity_event_spamblock/lang_de.inc.php b/plugins/serendipity_event_spamblock/lang_de.inc.php index e45bb92..3eef997 100644 --- a/plugins/serendipity_event_spamblock/lang_de.inc.php +++ b/plugins/serendipity_event_spamblock/lang_de.inc.php @@ -65,3 +65,6 @@ @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_URLS_DESC', 'Reguläre Ausdrücke erlaubt, Zeichenkennten durch Semikolon (;) trennen.'); @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS', 'Wortfilter für Autorennamen'); @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS_DESC', 'Reguläre Ausdrücke erlaubt, Zeichenkennten durch Semikolon (;) trennen.'); + + @define('PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL', 'Ungültige E-Mail Adresse'); + @define('PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL', 'Auf ungültige E-Mail Adressen prüfen?'); diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php index 0546344..e6593f1 100644 --- a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php +++ b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php @@ -80,6 +80,9 @@ if (!function_exists('serendipity_serverOffsetHour')) { @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS', 'Wordfilter for author names'); @define('PLUGIN_EVENT_SPAMBLOCK_FILTER_AUTHORS_DESC', 'Regular Expressions allowed, separate strings by semicolons (;).'); +@define('PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL', 'Invalid e-mail address'); +@define('PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL', 'Check e-mail addresses?'); + class serendipity_event_spamblock extends serendipity_event { var $filter_defaults; @@ -99,14 +102,14 @@ var $filter_defaults; 'smarty' => '2.6.7', 'php' => '4.1.0' )); - $propbag->add('version', '1.22'); + $propbag->add('version', '1.23'); $propbag->add('event_hooks', array( 'frontend_saveComment' => true, 'external_plugin' => true, 'frontend_comment' => true, 'fetchcomments' => true )); - $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')); + $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', 'checkmail', 'logtype', 'logfile')); $propbag->add('groups', array('ANTISPAM')); $this->filter_defaults = array( @@ -140,6 +143,13 @@ var $filter_defaults; $propbag->add('default', false); break; + case 'checkmail': + $propbag->add('type', 'boolean'); + $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL); + $propbag->add('description', ''); + $propbag->add('default', false); + break; + case 'bodyclone': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_BODYCLONE); @@ -483,6 +493,15 @@ var $filter_defaults; return false; } } + + // Check invalid email + if ($addData['type'] == 'NORMAL' && serendipity_db_bool($this->get_config('checkmail', false))) { + if (!empty($addData['email']) && strstr($addData['email'], '@') === false) { + $this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL, $addData); + $eventData = array('allow_comments' => false); + $serendipity['messagestack']['comments'][] = PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL; + } + } } return true; -- 2.39.5