OSDN Git Service

Functions to functions
[pukiwiki/pukiwiki_sandbox.git] / spam / checker.php
index 0eee711..eb139ff 100644 (file)
@@ -1,16 +1,16 @@
 <?php
-// $Id: checker.php,v 1.2 2007/07/03 14:51:07 henoheno Exp $
+// $Id: checker.php,v 1.9 2011/01/25 13:16:35 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
 
 error_reporting(E_ALL); // Debug purpose
 
+if (! defined('CONTENT_CHARSET')) define('CONTENT_CHARSET', 'ISO-8859-1');
 require('spam.php');
-require('spam_pickup.php');
 
 // Recursive array_map()
-// e.g. Sanitilze ALL values (Debug purpose): var_dump(recursive_map('htmlspecialchars', $array));
+// e.g. Sanitilze ALL values (Debug purpose): var_dump(recursive_map('htmlsc', $array));
 function recursive_map($func, $array)
 {
        if (is_array($array)) {
@@ -26,7 +26,7 @@ function recursive_map($func, $array)
 
 function show_form($string, $asap = FALSE, $progress = TRUE, $pickup = TRUE)
 {
-       $string   = htmlspecialchars($string);
+       $string   = htmlsc($string);
        $asap     = $asap     ? ' checked' : '';
        $progress = $progress ? ' checked' : '';
        $pickup   = $pickup   ? ' checked' : '';
@@ -62,7 +62,7 @@ $asap   = isset($_POST['asap'])     ? TRUE : FALSE;
 $prog   = isset($_POST['progress']) ? TRUE : FALSE;
 $pickup = isset($_POST['pickup'])   ? TRUE : FALSE;
 
-echo show_form($msg, $asap, $prog, $pickup);
+echo show_form(stripslashes($msg), $asap, $prog, $pickup);
 echo '<br/>';
 
 
@@ -89,14 +89,15 @@ echo '<br/>';
        // Any rules will lock contents that have NG things already.
        $spam['method']['edit'] = array(
                // Supposed_by_you(n) * Edit_form_spec(2) * Margin(1.5)
-               '_comment'     => 'edit',
-               //'quantity'     => 60 * 3,
-               //'non_uniquri'  =>  5 * 3,
-               //'non_uniqhost' => 50 * 3,
-               //'area_anchor'  => 30 * 3,
-               //'area_bbcode'  => 15 * 3,
-               'uniqhost'     => TRUE,
-               'badhost'      => TRUE,
+               '_comment'       => 'edit',
+               'quantity'       => 150 * 1.5,
+               'non_uniq'       =>   5 * 1.5,
+               //'non_uniquri'  =>   5 * 1.5,
+               //'non_uniqhost' =>  50 * 1.5,
+               'area_anchor'    =>   3 * 1.5,
+               'area_bbcode'    =>   1 * 1.5,
+               'uniqhost'       => TRUE,
+               'badhost'        => TRUE,
                //'asap'         => TRUE,
        );
        
@@ -135,29 +136,31 @@ if (! empty($progress)) {
                $tmp = summarize_detail_badhost($progress);
                if ($tmp != '') {
                        echo 'DETAIL_BADHOST: ' . 
-                               str_replace('  ', '&nbsp; ', nl2br(htmlspecialchars($tmp). "\n"));
+                               str_replace('  ', '&nbsp; ', nl2br(htmlsc($tmp). "\n"));
                }
        }
 
        $tmp = summarize_detail_newtral($progress);
        if (! $asap && $tmp != '') {
                echo 'DETAIL_NEUTRAL_HOST: ' . 
-                               str_replace('  ', '&nbsp; ', nl2br(htmlspecialchars($tmp). "\n"));
+                               str_replace('  ', '&nbsp; ', nl2br(htmlsc($tmp). "\n"));
        }
        
        if ($prog) {
                echo '<pre>';
                echo '$progress:' . "\n";
-               echo htmlspecialchars(var_export($progress, TRUE));
+               echo htmlsc(var_export($progress, TRUE));
                echo '</pre>';
        }
 }
 
 if ($pickup) {
        echo '<pre>';
-       $results = uri_pickup_normalize(spam_uri_pickup($msg));
+       $results = spam_uri_pickup($msg);
+       $results = uri_pickup_normalize($results);
+       $results = uri_pickup_normalize_pathfile($results);
        echo '$results:' . "\n";
-       echo htmlspecialchars(var_export($results, TRUE));
+       echo htmlsc(var_export($results, TRUE));
        echo '</pre>';
 }
 ?>