<?php
-// $Id: spam.php,v 1.140 2007/05/01 05:29:19 henoheno Exp $
+// $Id: spam.php,v 1.141 2007/05/02 10:01:19 henoheno Exp $
// Copyright (C) 2006-2007 PukiWiki Developers Team
// License: GPL v2 or (at your option) any later version
//
return implode(', ', $tmp);
}
+function summarize_detail_badhost($is_spam_badhost = array())
+{
+ $badhost = array();
+ foreach($is_spam_badhost as $glob=>$number) {
+ $badhost[] = $glob . '(' . $number . ')';
+ }
+ return implode(', ', $badhost);
+
+}
+
+function summarize_detail_newtral($remains_badhost = array())
+{
+ return count($remains_badhost) .
+ ' (' . implode(', ', array_keys($remains_badhost)) . ')';
+}
+
+
// ---------------------
// Exit
$summary['METRICS'] = summarize_spam_progress($progress);
}
if (isset($progress['is_spam']['badhost'])) {
- $badhost = array();
- foreach($progress['is_spam']['badhost'] as $glob=>$number) {
- $badhost[] = $glob . '(' . $number . ')';
- }
- $summary['DETAIL_BADHOST'] = implode(', ', $badhost);
+ $summary['DETAIL_BADHOST'] = summarize_detail_badhost($progress['is_spam']['badhost']);
}
if (! $asap && $progress['remains']['badhost']) {
- $count = count($progress['remains']['badhost']);
- $summary['DETAIL_NEUTRAL_HOST'] = $count .
- ' (' .
- preg_replace(
- '/[^, a-z0-9.-]/i', '',
- implode(', ', array_keys($progress['remains']['badhost']))
- ) .
- ')';
+ $summary['DETAIL_NEUTRAL_HOST'] = summarize_detail_newtral($progress['remains']['badhost']);
}
$summary['COMMENT'] = $action;
$summary['PAGE'] = '[blocked] ' . (is_pagename($page) ? $page : '');
<?php
-// $Id: spam_pickup.php,v 1.43 2007/03/25 13:46:43 henoheno Exp $
+// $Id: spam_pickup.php,v 1.44 2007/05/02 10:01:19 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
$action = 'Blocked by: ' . summarize_spam_progress($progress, TRUE);
if (isset($progress['is_spam']['badhost'])) {
- $badhost = array();
- foreach($progress['is_spam']['badhost'] as $glob=>$number) {
- $badhost[] = $glob . '(' . $number . ')';
- }
- echo 'DETAIL_BADHOST: ' . htmlspecialchars(implode(', ', $badhost));
+ echo 'DETAIL_BADHOST: ' .
+ htmlspecialchars(summarize_detail_badhost($progress['is_spam']['badhost']));
echo '<br />';
}
}
if (isset($progress['remains']['badhost'])) {
- $count = count($progress['remains']['badhost']);
- echo 'DETAIL_NEUTRAL_HOST: ' . $count .
- ' (' .
- htmlspecialchars(
- preg_replace(
- '/[^, a-z0-9.-]/i',
- '',
- implode(', ', array_keys($progress['remains']['badhost']))
- )
- ) .
- ')';
+ echo 'DETAIL_NEUTRAL_HOST: ' .
+ htmlspecialchars(summarize_detail_newtral($progress['remains']['badhost']));
echo '<br />';
}