X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Ffilter%2Fblacklist_filter.php;h=edba5885bf2ccb67ab02a6e8d7537aea44fed770;hb=5feba25313d1ef15f35ef29c6b98ae7bc496afa5;hp=289d27105f374098726d317093d1a37861679fdb;hpb=9010b58909d1d5e750cc80c9b9ec9ac8a25f053b;p=mailer.git diff --git a/inc/filter/blacklist_filter.php b/inc/filter/blacklist_filter.php index 289d27105f..edba5885bf 100644 --- a/inc/filter/blacklist_filter.php +++ b/inc/filter/blacklist_filter.php @@ -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,72 @@ 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 to check URL against blacklist +function FILTER_CHECK_URL_BLACKLISTED ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // And shall I check that his URL is not in the black list? + if ((isUrlBlacklistEnabled()) && (isUrlBlacklisted($filterData['url']))) { + // Create redirect-URL + $filterData['redirect'] = 'modules.php?module=login&what=order&code=' . getCode('BLIST_URL') . '&blist=' . $GLOBALS['blacklist_data'][$filterData['url']]['timestamp']; + $GLOBALS['filter_chain_aborted'] = TRUE; + + // Set data for next filter chain + $filterData['init_done'] = FALSE; + $filterData['blacklisted'] = 'url'; + $filterData['message'] = '{--URL_IS_BLACKLISTED--}'; + + // Run filter chain for successful detection (don't rely on other fields than 'IP') here + runFilterChain('post_url_blacklisted', $filterData); + } // END - if + + // Return the data for next filter + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + 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 + + // Return filtered data + return $filterData; +} + +// Filter for logging blacklisted URLs, is being called from above filter +function FILTER_LOG_URL_BLACKLISTED ($filerData) { + // Make sure, that required data is there + assert((isset($filterData['init_done'])) && ($filterData['blacklisted'] == 'url')); // @TODO Insert log entry