OSDN Git Service

*** empty log message ***
authorhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 24 Jun 2007 08:07:53 +0000 (08:07 +0000)
committerhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 24 Jun 2007 08:07:53 +0000 (08:07 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@579 1ca29b6e-896d-4ea0-84a5-967f57386b96

trunk/NP_SpamBayes/NP_SpamBayes.php
trunk/NP_SpamBayes/spambayes/index.php

index 35c0792..9335c75 100644 (file)
@@ -1,9 +1,9 @@
 <?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.
 */
@@ -144,7 +144,7 @@ class NP_SpamBayes extends NucleusPlugin {
        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) {
index 7dc9e11..94d45d1 100644 (file)
                $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";