OSDN Git Service

Correct recursing check_uri_spam()
authorhenoheno <henoheno>
Sun, 26 Nov 2006 14:41:51 +0000 (23:41 +0900)
committerhenoheno <henoheno>
Sun, 26 Nov 2006 14:41:51 +0000 (23:41 +0900)
spam.php
spam/spam.php
spam/spam_pickup.php
spam_pickup.php

index bdf77c4..9b9f333 100644 (file)
--- a/spam.php
+++ b/spam.php
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam.php,v 1.48 2006/11/26 14:25:24 henoheno Exp $
+// $Id: spam.php,v 1.49 2006/11/26 14:41:51 henoheno Exp $
 // Copyright (C) 2006 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
 
@@ -574,7 +574,13 @@ function check_uri_spam($target = '', $method = array(), $asap = TRUE)
                        $progress['uniqhost']       += $_progress['uniqhost'];
                        $progress['badhost']        += $_progress['badhost'];
                        foreach($_progress['_action'] as $key => $value) {
-                               $progress['_action'][$key] = TRUE;
+                               if (is_array($value)) {
+                                       foreach(array_keys($value) as $_key) {
+                                               $progress['_action'][$key][$_key] = TRUE;
+                                       }
+                               } else {
+                                       $progress['_action'][$key] = TRUE;
+                               }
                        }
                        if ($is_spam && $asap) break;
                }
index bdf77c4..9b9f333 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam.php,v 1.48 2006/11/26 14:25:24 henoheno Exp $
+// $Id: spam.php,v 1.49 2006/11/26 14:41:51 henoheno Exp $
 // Copyright (C) 2006 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
 
@@ -574,7 +574,13 @@ function check_uri_spam($target = '', $method = array(), $asap = TRUE)
                        $progress['uniqhost']       += $_progress['uniqhost'];
                        $progress['badhost']        += $_progress['badhost'];
                        foreach($_progress['_action'] as $key => $value) {
-                               $progress['_action'][$key] = TRUE;
+                               if (is_array($value)) {
+                                       foreach(array_keys($value) as $_key) {
+                                               $progress['_action'][$key][$_key] = TRUE;
+                                       }
+                               } else {
+                                       $progress['_action'][$key] = TRUE;
+                               }
                        }
                        if ($is_spam && $asap) break;
                }
index ede44af..c4f3e2d 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam_pickup.php,v 1.18 2006/11/26 14:25:24 henoheno Exp $
+// $Id: spam_pickup.php,v 1.19 2006/11/26 14:41:51 henoheno Exp $
 // Concept-work of spam-uri metrics
 // Copyright (C) 2006 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
@@ -60,7 +60,7 @@ echo '<pre>';
 $pickup = TRUE;
 
 list($is_spam, $progress) = check_uri_spam($msg, array(), FALSE);
-//list($is_spam, $progress) = check_uri_spam(array('a', $msg, $msg, 'b), array(), FALSE);
+//list($is_spam, $progress) = check_uri_spam(array('a', $msg, $msg, 'b'), array(), FALSE);
 if ($is_spam) {
        $action = 'Blocked by: ' . summarize_check_uri_spam_progress($progress);
        var_dump($action);
index ede44af..c4f3e2d 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam_pickup.php,v 1.18 2006/11/26 14:25:24 henoheno Exp $
+// $Id: spam_pickup.php,v 1.19 2006/11/26 14:41:51 henoheno Exp $
 // Concept-work of spam-uri metrics
 // Copyright (C) 2006 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
@@ -60,7 +60,7 @@ echo '<pre>';
 $pickup = TRUE;
 
 list($is_spam, $progress) = check_uri_spam($msg, array(), FALSE);
-//list($is_spam, $progress) = check_uri_spam(array('a', $msg, $msg, 'b), array(), FALSE);
+//list($is_spam, $progress) = check_uri_spam(array('a', $msg, $msg, 'b'), array(), FALSE);
 if ($is_spam) {
        $action = 'Blocked by: ' . summarize_check_uri_spam_progress($progress);
        var_dump($action);