<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: pukiwiki.php,v 1.13 2006/12/09 08:31:57 henoheno Exp $
+// $Id: pukiwiki.php,v 1.14 2006/12/17 15:39:51 henoheno Exp $
//
// PukiWiki 1.4.*
// Copyright (C) 2002-2006 by PukiWiki Developers Team
// Spam filtering
if ($spam && $method != 'GET') {
// Adjustment
- $_spam = $spam;
+ $_spam = ! empty($spam);
$_plugin = strtolower($plugin);
switch ($_plugin) {
//case 'plugin-name':
$_spam = FALSE;
break;
case 'edit':
- $_page = & $page;
if (isset($vars['add']) && $vars['add']) {
- $_spam = TRUE;
$_plugin = 'add';
- } else {
- // TODO: Add some metrics (quantitiy, non_uniq, badhost etc)
- $_spam = FALSE;
}
+ $_page = & $page;
break;
case 'bugtrack': $_page = & $post['base']; break;
case 'tracker': $_page = & $post['_base']; break;
if ($_spam) {
require(LIB_DIR . 'spam.php');
- pkwk_spamfilter($method . ' to #' . $_plugin, $_page, $vars);
+
+ // Specific $method
+ if (isset($spam['method'][$_plugin])) {
+ $_method = & $spam['method'][$_plugin];
+ } else if ($_plugin == 'edit' && isset($spam['method']['_edit'])) {
+ $_method = & $spam['method']['_edit'];
+ } else if (isset($spam['method']['_default'])) {
+ $_method = & $spam['method']['_default'];
+ } else {
+ $_method = array(); // spam.php Default
+ }
+ if (! is_array($_method)) $_method = array();
+
+ $exitmode = isset($spam['exitmode']) ? $spam['exitmode'] : '';
+
+ pkwk_spamfilter($method . ' to #' . $_plugin, $_page, $vars, $_method, $exitmode);
}
}
<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: pukiwiki.ini.php,v 1.144 2006/12/07 14:47:15 henoheno Exp $
+// $Id: pukiwiki.ini.php,v 1.145 2006/12/17 15:39:23 henoheno Exp $
// Copyright (C)
// 2002-2006 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
$spam = 1; // 1 = On
+if ($spam) {
+ $spam = array();
+
+ // Threshold and rules for insertion (default)
+ $spam['method']['_default'] = array(
+ '_comment' => '_default',
+ 'quantity' => 8,
+ 'non_uniq' => 3,
+ 'area_anchor' => 0,
+ 'area_bbcode' => 0,
+ 'uniqhost' => TRUE,
+ 'badhost' => TRUE,
+ //'asap' => TRUE,
+ );
+
+ // For editing (default)
+ $spam['method']['_edit'] = array(
+ // Supposed(n) * Edit_form_spec(2) * Margin(2)
+ '_comment' => '_edit',
+ 'quantity' => 60 * 4,
+ 'non_uniq' => 5 * 4,
+ 'area_anchor' => 30 * 4,
+ 'area_bbcode' => 15 * 4,
+ 'uniqhost' => TRUE,
+ 'badhost' => TRUE,
+ //'asap' => TRUE,
+ );
+
+ //$spam['exitmode'] = 'dump'; // Dump progress
+}
+
/////////////////////////////////////////////////
// TrackBack feature