OSDN Git Service

DETAIL_NEUTRAL_HOST: Sort by domain
authorhenoheno <henoheno>
Sat, 5 May 2007 07:09:33 +0000 (16:09 +0900)
committerhenoheno <henoheno>
Sat, 5 May 2007 07:09:33 +0000 (16:09 +0900)
spam/spam.php
spam/spam_pickup.php

index 3821933..669315d 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam.php,v 1.149 2007/05/05 06:36:50 henoheno Exp $
+// $Id: spam.php,v 1.150 2007/05/05 07:09:33 henoheno Exp $
 // Copyright (C) 2006-2007 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
 //
@@ -1357,7 +1357,7 @@ function summarize_spam_progress($progress = array(), $blockedonly = FALSE)
        return implode(', ', $tmp);
 }
 
-// Very roughly shrink the lines of var_export()
+// Very roughly, shrink the lines of var_export()
 // NOTE: If the same data exists, it must be corrupted.
 function var_export_shrink($expression, $return = FALSE)
 {
@@ -1384,9 +1384,16 @@ function summarize_detail_badhost($progress = array())
 
 function summarize_detail_newtral($progress = array())
 {
-       if (empty($progress['hosts'])) return '';
+       if (! isset($progress['hosts']) || ! is_array($progress['hosts'])) return '';
 
-       return var_export_shrink($progress['hosts'], TRUE);
+       // Sort by domain
+       $tmp = array();
+       foreach($progress['hosts'] as $value) {
+               $tmp[strrev($value)] = $value;
+       }
+       ksort($tmp);
+
+       return implode(', ', $tmp);
 }
 
 
index 88c93bf..52b4fba 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: spam_pickup.php,v 1.46 2007/05/04 13:43:59 henoheno Exp $
+// $Id: spam_pickup.php,v 1.47 2007/05/05 07:09:33 henoheno Exp $
 // Concept-work of spam-uri metrics
 // Copyright (C) 2006-2007 PukiWiki Developers Team
 // License: GPL v2 or (at your option) any later version
@@ -140,8 +140,7 @@ if (! empty($progress)) {
 
        $tmp = summarize_detail_newtral($progress);
        if (! $asap && $tmp != '') {
-               echo 'DETAIL_NEUTRAL_HOST: ' .
-                               str_replace('  ', '&nbsp; ', nl2br("\n" . htmlspecialchars($tmp). "\n"));
+               echo 'DETAIL_NEUTRAL_HOST: ' . htmlspecialchars($tmp);
        }
        
        if ($prog) {