]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/blacklist_filter.php
Since Wernis API 0.6-BETA SHA256 is the default now
[mailer.git] / inc / filter / blacklist_filter.php
index 289d27105f374098726d317093d1a37861679fdb..dd9cc43a6ac9cf24e0f22996909ff85a8ca1f789 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -45,7 +45,9 @@ function FILTER_CHECK_EMAIL_BLACKLISTED ($filterData) {
        // Is the email address blacklisted?
        if (($filterData['init_done'] === TRUE) && (isEmailBlacklistEnabled()) && (isEmailBlacklisted($filterData['post_data']['email']))) {
                // Then abort here
-               $filterData['init_done'] = FALSE;
+               $filterData['init_done']   = FALSE;
+               $filterData['blacklisted'] = 'email';
+               $filterData['message']     = '{--EMAIL_IS_BLACKLISTED--}';
 
                // Run filter chain for successful detection (don't rely on other fields than 'email') here
                runFilterChain('post_email_blacklisted', $filterData);
@@ -55,10 +57,38 @@ function FILTER_CHECK_EMAIL_BLACKLISTED ($filterData) {
        return $filterData;
 }
 
+// Filter to check if IP address is blacklisted
+function FILTER_CHECK_IP_BLACKLISTED ($filterData) {
+       // Is the IP address blacklisted?
+       if (($filterData['init_done'] === TRUE) && (isEmailBlacklistEnabled()) && (isIpBlacklisted(determineRealRemoteAddress()))) {
+               // Then abort here
+               $filterData['init_done']   = FALSE;
+               $filterData['blacklisted'] = 'ip';
+               $filterData['message']     = '{--IP_IS_BLACKLISTED--}';
+
+               // Run filter chain for successful detection (don't rely on other fields than 'IP') here
+               runFilterChain('post_ip_blacklisted', $filterData);
+       } // END - if
+
+       // Return filtered data
+       return $filterData;
+}
+
 // Filter for logging blacklisted email addresses, is being called from above filter
 function FILTER_LOG_EMAIL_BLACKLISTED ($filerData) {
        // Make sure, that required data is there
-       assert((isset($filterData['init_done'])) && (isset($filterData['post_data']['email'])));
+       assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'email'));
+
+       // @TODO Insert log entry
+
+       // Return filtered data
+       return $filterData;
+}
+
+// Filter for logging blacklisted IP addresses, is being called from above filter
+function FILTER_LOG_IP_BLACKLISTED ($filerData) {
+       // Make sure, that required data is there
+       assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'ip'));
 
        // @TODO Insert log entry