From 98fd7aae25335d19e33fd2a4b15aa1ce699d5d74 Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <ericrasmussen1@gmail.com>
Date: Mon, 4 Feb 2013 10:25:16 -0600
Subject: [PATCH] Add email filtering to spam filtering

---
 data/spamRules.php      | 8 ++++++++
 src/UNL/WDN/Comment.php | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/data/spamRules.php b/data/spamRules.php
index d48e9f4..82d928b 100644
--- a/data/spamRules.php
+++ b/data/spamRules.php
@@ -198,6 +198,14 @@ $rules['ua'][] = function($spam) {
     }
 };
 
+$rules['email'][] = function($spam) {
+  if (strpos($spam, 'abqenvironmentalstory.org') !== false
+      || strpos($spam, 'aptel.org') !== false
+      || strpos($spam, 'fluidforce.net') !== false) {
+    return true;
+  }
+};
+
 $rules['url'][] = function($spam) {
     if ($spam == 'http://www1.unl.edu/comments/'
         || $spam == 'http://www1.unl.edu/comments/thanks/'
diff --git a/src/UNL/WDN/Comment.php b/src/UNL/WDN/Comment.php
index 94e30d8..bcdfbba 100644
--- a/src/UNL/WDN/Comment.php
+++ b/src/UNL/WDN/Comment.php
@@ -80,6 +80,10 @@ class UNL_WDN_Comment extends UNL_WDN_Comment_Record
             return false;
         }
 
+        if ($detector->isSpam($this->email, 'email')) {
+            return false;
+        }
+
         if ($detector->isSpam($this->page_address, 'url')) {
             return false;
         }
-- 
GitLab