Update of /cvsroot/php-blog/serendipity/bundled-libs/Net/DNSBL
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29920/bundled-libs/Net/DNSBL
Modified Files:
SURBL.php
Log Message:
updated Net_DNSBL package
bundled Cache_Lite
Index: SURBL.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/bundled-libs/Net/DNSBL/SURBL.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- SURBL.php 2 Dec 2004 10:54:29 -0000 1.3
+++ SURBL.php 2 Dec 2004 14:23:51 -0000 1.4
@@ -29,9 +29,9 @@
* @author Sebastian Nohn <seb...@no...>
* @package Net_DNSBL
* @license http://www.php.net/license/3_0.txt
- * @version 0.3
+ * @version 0.5.4
*/
-require_once 'Cache.php';
+require_once 'Cache/Lite.php';
require_once 'HTTP/Request.php';
require_once 'Net/CheckIP.php';
require_once 'Net/DNSBL.php';
@@ -41,8 +41,7 @@
/**
* Array of blacklists.
*
- * Contain 1-n blacklists to use for checking the status of a
- * host.
+ * Must have one or more elements.
*
* @var string[]
* @access protected
@@ -50,7 +49,7 @@
var $blacklists = array('multi.surbl.org');
/**
- * File containing whitelisted hosts
+ * File containing whitelisted hosts.
*
* There are some whitelisted hosts (co.uk for example). This
* requires the package to not ask the domain name but the host
@@ -63,7 +62,7 @@
var $doubleCcTldFile = 'http://spamcheck.freeapp.net/two-level-tlds';
/**
- * Array of whitelisted hosts
+ * Array of whitelisted hosts.
*
* @var array
* @see $twoLevelCcTldFile
@@ -72,18 +71,22 @@
var $twoLevelCcTld = array();
/**
- * Check if the last two parts of the FQDN are whitelisted
+ * Check if the last two parts of the FQDN are whitelisted.
*
* @param string Host to check if it is whitelisted
* @access protected
* @return boolean True if the host is whitelisted
*/
- function isDoubleCcTld($fqdn) {
- // 30 Day should be way enough
- $options = array('lifeTime' => 2);
+ function isDoubleCcTld($fqdn)
+ {
+ // 30 Days should be way enough
+ $options = array(
+ 'lifeTime' => '2592000',
+ 'automaticSerialization' => true
+ );
$id = md5($this->doubleCcTldFile);
- $cache = new Cache('file', $options);
+ $cache = new Cache_Lite($options);
if ($data = $cache->get($id)) {
// Cache hit
} else {
@@ -94,7 +97,7 @@
}
$data = explode("\n", $data);
$data = array_flip($data);
- $cache->save($id, $data);
+ $cache->save($data, $id);
} // if
if (array_key_exists($fqdn, $data)) {
return true;
@@ -104,7 +107,7 @@
} // function
/**
- * Get Hostname to ask for
+ * Get Hostname to ask for.
*
* Performs the following steps:
*
@@ -114,13 +117,14 @@
* (3b) IS_FQDN Check if is in "CC-2-level-TLD"
* (3b1) IS_IN_2LEVEL: we want the last three names
* (3b2) IS_NOT_2LEVEL: we want the last two names
- * (4) return the FQDN to query
+ * (4) return the FQDN to query.
*
* @param string URL to check.
* @access protected
* @return string Host to lookup
*/
- function getHostForLookup($uri, $blacklist) {
+ function getHostForLookup($uri, $blacklist)
+ {
$host = '';
// (1) Extract the hostname from the given URI
$parsed_uri = parse_url($uri);
@@ -157,4 +161,4 @@
} // function
} // class
-?>
+?>
\ No newline at end of file
|