black-listed $listed = TRUE; } // Return result return $listed; } // Inserts a given URL in blacklist if not found function insertUrlInBlacklist ($url, $id) { // Is this feature turned on and is the URL not there? if (!isUrlBlacklistEnabled()) { // Not enabled, then please don't call this function reportBug(__FUNCTION__, __LINE__, 'URL blacklisting is disabled, url=' . $url . ',id=' . $id); } elseif (!isUrlBlacklisted($url)) { // Did not find a record so we can add it... :) SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_blacklist` (`data`, `pool_id`, `type`) VALUES ('%s', %s, 'URL')", array( $url, $id ), __FUNCTION__, __LINE__); } // END - if } // Checks whether given URL is blacklisted function isUrlBlacklisted ($url) { // Mark it as not listed by default $listed = FALSE; // Is black-listing enbaled? if (!isUrlBlacklistEnabled()) { // No, then all URLs are not in this list return FALSE; } elseif (!isset($GLOBALS['blacklist_data']['url'][$url])) { // Check black-list for given URL $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`added`) AS `added`, `pool_id` FROM `{?_MYSQL_PREFIX?}_blacklist` WHERE `data`='%s' AND `type`='URL' LIMIT 1", array($url), __FUNCTION__, __LINE__); // Is there an entry? if (SQL_NUMROWS($result) == 1) { // Jupp, we got one listed $GLOBALS['blacklist_data']['url'][$url] = SQL_FETCHARRAY($result); // Mark it as listed $listed = TRUE; } // END - if // Free result SQL_FREERESULT($result); } else { // Is found in cache -> black-listed $listed = TRUE; } // Return result return $listed; } // ---------------------------------------------------------------------------- // Configuration wrapper functions // ---------------------------------------------------------------------------- // 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] ?>