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 return insertGenericInBlacklist ('email', $email, NULL, $provider); } // Inserts a given IP (pattern) in blacklist if not found function insertIpInBlacklist ($ip, $provider = 'BLACKLIST') { // Call inner function return insertGenericInBlacklist ('ip', $ip, NULL, $provider); } // Inserts a given URL (pattern) in blacklist if not found function insertUrlInBlacklist ($url, $poolId, $provider = 'BLACKLIST') { // Call inner function return 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... :) sqlQueryEscaped("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 // Return insert id for debugging/reporting pursposes return getSqlInsertId(); } // ---------------------------------------------------------------------------- // 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__]; } // Getter for url_blacklist function getUrlBlacklist () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('url_blacklist'); } // 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__] = (getUrlBlacklist() == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Getter for email_blacklist function getEmailBlacklist () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('email_blacklist'); } // 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__] = (getEmailBlacklist() == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Getter for ip_blacklist function getIpBlacklist () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = getConfig('ip_blacklist'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // Wrapper to check if ip_blacklist is enabled function isIpBlacklistEnabled () { // Is there cache? if (!isset($GLOBALS[__FUNCTION__])) { // Determine it $GLOBALS[__FUNCTION__] = (getIpBlacklist() == 'Y'); } // END - if // Return cache return $GLOBALS[__FUNCTION__]; } // [EOF] ?>