From a9859d09f7c898a087aba31f07aa3c7a177a8205 Mon Sep 17 00:00:00 2001 From: henoheno Date: Sun, 28 Dec 2008 00:11:37 +0900 Subject: [PATCH] get_blocklist(): Added a comment, and blank lines --- spam/spam.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/spam/spam.php b/spam/spam.php index 0a0fb6f..5b5464d 100644 --- a/spam/spam.php +++ b/spam/spam.php @@ -1,5 +1,5 @@ FALSE; @@ -423,11 +425,19 @@ function get_blocklist($list = '') // '*.blogspot.com', // Blog services's subdomains (only) // 'IANA-examples' => '#^(?:.*\.)?example\.(?:com|net|org)$#', // ); - foreach(array('pre', 'list') as $special) { + + foreach(array( + 'pre', + 'list', + ) as $special) { + if (! isset($blocklist[$special])) continue; + $regexes[$special] = $blocklist[$special]; + foreach(array_keys($blocklist[$special]) as $_list) { if (! isset($blocklist[$_list])) continue; + foreach ($blocklist[$_list] as $key => $value) { if (is_array($value)) { $regexes[$_list][$key] = array(); @@ -445,11 +455,11 @@ function get_blocklist($list = '') } if ($list === '') { - return $regexes; // ALL + return $regexes; // ALL of } else if (isset($regexes[$list])) { - return $regexes[$list]; + return $regexes[$list]; // A part of } else { - return array(); + return array(); // Found nothing } } @@ -457,7 +467,7 @@ function get_blocklist($list = '') function get_blocklist_add(& $array, $key = 0, $value = '*.example.org') { if (is_string($key)) { - $array[$key] = & $value; // Treat $value as a regex + $array[$key] = & $value; // Treat $value as a regex for FQDN(host)s } else { $array[$value] = '/^' . generate_host_regex($value, '/') . '$/i'; } -- 2.11.0