black-listed $listed = TRUE; } // Return result return $listed; } // Inserts a given email (pattern) in blacklist if not found function insertEmailInBlacklist ($email, $provider = 'BLACKLIST') { // Call inner function insertGenericInBlacklist ('email', $email, NULL, $provider); } // Inserts a given URL in blacklist if not found function insertUrlInBlacklist ($url, $poolId, $provider = 'BLACKLIST') { // Call inner function insertGenericInBlacklist ('url', $url, $poolId, $provider); } // Inserts a given URL in blacklist if not found function insertGenericInBlacklist ($type, $data, $poolId = NULL, $provider = 'BLACKLIST') { // Is this feature turned on and is the URL not there? if (!isGenericBlacklistEnabled($type)) { // Not enabled, then please don't call this function reportBug(__FUNCTION__, __LINE__, 'Blacklisting of type ' . $type . ' is disabled, data=' . $data . ',poolId=' . convertZeroToNull($poolId)); } elseif (!isUrlBlacklisted($data)) { // Did not find a record so we can add it... :) SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_blacklist` ( `data`, `pool_id`, `provider`, `type` ) VALUES ( '%s', %s, '%s', '%s' )", array( $data, convertZeroToNull($poolId), $provider, strtoupper($type) ), __FUNCTION__, __LINE__); } // END - if } // Checks whether given email is blacklisted function isEmailBlacklisted ($email) { // Call inner function return isGenericBlacklisted('email', $email); } // Checks whether given URL is blacklisted function isUrlBlacklisted ($url) { // Call inner function return isGenericBlacklisted('url', $email); } // ---------------------------------------------------------------------------- // Configuration wrapper functions // ---------------------------------------------------------------------------- // Generic wrapper function isGenericBlacklistEnabled ($type) { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig($type . '_blacklist') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if url_blacklist is enabled function isUrlBlacklistEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('url_blacklist') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if email_blacklist is enabled function isEmailBlacklistEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getConfig('email_blacklist') == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // [EOF] ?>