From 72cb6cbd83b39a12fb31fdb4232338dd6d73e8f0 Mon Sep 17 00:00:00 2001 From: henoheno Date: Mon, 29 Dec 2008 00:37:07 +0900 Subject: [PATCH] check_uri_spam(): Simplify: 'area_anchor' + 'area_bbcode' + somthing else = area_pickup() --- spam/spam.php | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/spam/spam.php b/spam/spam.php index 165f448..7216a5f 100644 --- a/spam/spam.php +++ b/spam/spam.php @@ -1,5 +1,5 @@ TRUE) : array(); - $result = area_pickup($target, array($key => TRUE) + $_asap); - if ($result) { - $sum[$key] = $result[$key]; - if (isset($method[$key]) && $sum[$key] > $method[$key]) { - $is_spam[$key] = TRUE; - } + if (! $asap || ! $is_spam) { + + // Method pickup + $_method = array(); + foreach(array( + 'area_anchor', // There's HTML anchor tag + 'area_bbcode', // There's 'BBCode' linking tag + ) as $key) { + if (isset($method[$key])) $_method[$key] = TRUE; } - } - // Area: There's 'BBCode' linking tag - if ((! $asap || ! $is_spam) && isset($method['area_bbcode'])) { - $key = 'area_bbcode'; - $_asap = isset($method['asap']) ? array('asap' => TRUE) : array(); - $result = area_pickup($target, array($key => TRUE) + $_asap); - if ($result) { - $sum[$key] = $result[$key]; - if (isset($method[$key]) && $sum[$key] > $method[$key]) { - $is_spam[$key] = TRUE; + if ($_method) { + $_asap = isset($method['asap']) ? array('asap' => TRUE) : array(); + $_result = area_pickup($target, $_method + $_asap); + } else { + $_result = FALSE; + } + + if ($_result) { + foreach(array_keys($_method) as $key) { + $sum[$key] = $_result[$key]; + if (isset($method[$key]) && $sum[$key] > $method[$key]) { + $is_spam[$key] = TRUE; + } } + $_result = NULL; } } -- 2.11.0