<?php
/*
 *      Patrick Bores - WebUserPrefs - SpamAssassin user preferences editor
 *      Copyright (C) 2003  Patrick Bores
 *      This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version 2
 *      of the License, or (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 *	Author: Dirk Datzert
 *
 */
        function bayesian_keys(){
                return array("use_bayes","auto_learn");
        }

        function bayesian_html(){
                $puse_bayes = get_pref("use_bayes");
                $pauto_learn = get_pref("auto_learn");

                // Set Default values
                if($puse_bayes == "") { $puse_bayes = 0; }
                if($pauto_learn == "") { $pauto_learn = 1; }

                $use_bayes = ($puse_bayes == "1") ? "CHECKED" : "";
                $auto_learn = ($pauto_learn == "1") ? "CHECKED" : "";

                echo "<b>Bayes</b><br />
                        The filter can detect spam on a trained baysian filter system. You can control
this behavior here.<br /><br />
                        <input type=\"checkbox\" name=\"use_bayes\" value=\"1\" $use_bayes /> enable
baysian filter <br />
                        <input type=\"checkbox\" name=\"auto_learn\" value=\"1\" $auto_learn /> train the
baysian filter<br /><br />
                ";

        }

        function bayesian_apply(){
                
                $use_bayes = ($_POST[use_bayes] != "") ? "1" : "0";
                $auto_learn = ($_POST[auto_learn] != "") ? "1" : "0";
                set_pref("use_bayes",$use_bayes);
                set_pref("auto_learn",$auto_learn);
        }

?>
