Mailer continued, sub-id tracking continued:
[mailer.git] / inc / mysql-manager.php
index bc4a920140c6d047b11ca2785128ddf30a0a7447..ce649cdd36ef09f474ece96e26443566451dbc95 100644 (file)
@@ -2314,5 +2314,39 @@ function doGenericListBuilder ($prefix, $listType, $tableName, $columns, $filter
        );
 }
 
+// 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])) {
+               // Check black-list for given URL
+               $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS `blist_timestamp` FROM `{?_MYSQL_PREFIX?}_url_blacklist` WHERE `url`='%s' LIMIT 1",
+                       array($url), __FILE__, __LINE__);
+
+               // Is there an entry?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Jupp, we got one listed
+                       $GLOBALS['blacklist_data'][$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;
+}
+
 // [EOF]
 ?>