<?php
/**
- * NP_SpamBayes(JP) ($Revision: 1.4 $)
+ * NP_SpamBayes(JP) ($Revision: 1.5 $)
* by hsur ( http://blog.cles.jp/np_cles )
- * $Id: NP_SpamBayes.php,v 1.4 2007-06-24 05:39:01 hsur Exp $
+ * $Id: NP_SpamBayes.php,v 1.5 2007-06-24 08:07:53 hsur Exp $
*
* Copyright (C) 2007 cles All rights reserved.
*/
function getName() { return 'SpamBayes(JP)'; }
function getAuthor() { return 'xiffy + hsur'; }
function getURL() { return 'http://blog.cles.jp/np_cles/category/31/subcatid/17'; }
- function getVersion() { return '1.1.0 jp1.4b'; }
+ function getVersion() { return '1.1.0 jp1.5b'; }
function getDescription() { return 'SpamBayes filter for comment and trackback spam. In adherence with Spam API 1.0 for Nucleus'; }
function supportsFeature($what) {
switch($what) {
$logids = requestIntArray('batch');
$action = requestVar('batchaction');
//debug: var_dump($logids);
- if ($logids) foreach ($logids as $id) {
- switch ($action) {
- case 'tspam':
- case 'tham':
- $ar = $oPluginAdmin->plugin->spambayes->nbs->getLogevent($id);
- $docid = $oPluginAdmin->plugin->spambayes->nbs->nextdocid();
- $cat = substr($action,1);
- $oPluginAdmin->plugin->spambayes->train($docid,$cat,$ar['content']);
- echo 'train '.$cat.': '.$id.'<br />';
- break;
- case 'delete':
- echo 'delete: '.$id.'<br />';
- $oPluginAdmin->plugin->spambayes->nbs->removeLogevent($id);
+ if ($logids){
+ foreach ($logids as $id) {
+ switch ($action) {
+ case 'tspam':
+ case 'tham':
+ $ar = $oPluginAdmin->plugin->spambayes->nbs->getLogevent($id);
+ $docid = $oPluginAdmin->plugin->spambayes->nbs->nextdocid();
+ $cat = substr($action,1);
+ $oPluginAdmin->plugin->spambayes->train($docid,$cat,$ar['content']);
+ echo 'train '.$cat.': '.$id.'<br />';
+ break;
+ case 'delete':
+ echo 'delete: '.$id.'<br />';
+ $oPluginAdmin->plugin->spambayes->nbs->removeLogevent($id);
+ }
}
+ $oPluginAdmin->plugin->spambayes->updateProbabilities();
}
-
echo '--end of batch--';
}
//echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=trainblockednew"),ENT_QUOTES)."\">Train spam with all NEW blocked comments</a></li>\n";
echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=traintbnew"),ENT_QUOTES)."\">Train HAM (not spam) with all NEW trackbacks.</a></li>\n";
echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=trainspamtbnew"),ENT_QUOTES)."\">Train spam with all NEW blocked trackbacks.</a></li>\n";
- //echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=update"),ENT_QUOTES)."\">Update probabilities<span>After some training, you must use this to finalise</span></a></li>\n";
+ echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=update"),ENT_QUOTES)."\">Update probabilities<span>After some training, you must use this to finalise</span></a></li>\n";
echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?page=test"),ENT_QUOTES)."\">Spam Bayes Test<span>Use this to test if a certain message would be considered 'ham' (not spam) or 'spam' message</span></a></li>\n";
echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(dirname(serverVar('PHP_SELF'))."/../../index.php?action=pluginoptions&plugid=".getPlugid()),ENT_QUOTES)."\">Spam Bayes options<span>This will take you to the plugins options page. This menu is NOT available on that page. Sorry for this. Use the quickmenu option to show a quicklink to the admin page!</span></a></li>\n";
echo "</ul>\n";