<?php

// $Id: bayes_stats.inc.php,v 1.1 2006/11/08 15:25:57 perlstalker Exp $

if (!defined('SM_PATH')) { define('SM_PATH' , '../../'); }

include_once(SM_PATH.'include/validate.php');
include_once(SM_PATH.'functions/page_header.php');
include_once(SM_PATH.'include/load_prefs.php');
include_once(SM_PATH.'plugins/sasql/sasql_conf.php');
include_once(SM_PATH.'plugins/sasql/sasql_db.php');

// From sasql_conf.php
global $SABayesDSN;
global $SABayesVarsTable;
global $bayes_vars_cols;

// from SM
global $username;
global $color;

$dbh = sasql_DBConnect ($SABayesDSN);

$counts = sasql_GetBayesStats ($dbh, $SABayesVarsTable, $username);

sasql_DBDisconnect ($dbh);
?>
<table width="100%" border="0" cellpadding="1" cellspacing="1">
  <tr>
   <td align="center" bgcolor="<?php echo $color[4]; ?>">
    <b><?php echo _("Bayes Filter Statistics"); ?></b>
   </td>
  </tr>
  <tr>
   <td align="center" bgcolor="<?php echo $color[4] ?>">
    <p>
     <?php echo _('Below are the number of messages that have been learned as spam and ham (non-spam) by the Bayesian filter. The Bayesian filter does not activate until enough messages have been learned as spam or ham.') ?>
    </p>
    <table border='1' cellspacing="0" cellpadding="2">
     <td align="center" bgcolor="<?php echo $color[4]; ?>">
      <b><?php echo _("Spam Count")?></b>
     </td>
     <td align="right" bgcolor="<?php echo $color[4]; ?>">
      <?php echo $counts['spam_count'] ?>
     </td>
     <td align="center" bgcolor="<?php echo $color[4]; ?>">
      <b><?php echo _("Ham Count")?></b>
     </td>
     <td align="right" bgcolor="<?php echo $color[4]; ?>">
      <?php echo $counts['ham_count'] ?>
     </td>
    </tr>
   </table>
 </tr>
</table>