<?php
/*
 *      Patrick Bores - WebUserPrefs - SpamAssassin user_prefs file 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.
 *
 *      This drop in module was coded by Oden Eriksson <oden.eriksson@imega.se>
 *      Copyright (C) 2003 Oden Eriksson - [ imega ] System AB
 *      http://www.imega.se
 *
 */
	function rbl_keys(){
		return array("skip_rbl_checks","rbl_timeout","num_check_received");
	}

	function rbl_html(){

		$init_rbl	= get_pref("skip_rbl_checks");
		if($init_rbl == "") $init_rbl = "0";

		$init_rbl_timeout = (get_pref("rbl_timeout") != "") ? get_pref("rbl_timeout") : "30";
		$init_num_check_received = (get_pref("num_check_received") != "") ? get_pref("num_check_received") : "2";

		$rbl_checked = ($init_rbl == "0") ? "CHECKED" : "";

		echo "<b><a href=\"http://mail.abuse.net/rbl\">Realtime Blackhole List</a></b><br /><br />

			<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" />

			    <tr>
			      <td align=\"right\" />Use RBL:</td>
			      <td><input type=\"checkbox\" name=\"rbl_control\" value=\"1\" $rbl_checked /></td>
			    </tr>

			    <tr>
			      <td align=\"right\" />RBL Timeout:</td>
			      <td><input type=\"text\" name=\"rbl_timeout_control\" value=\"$init_rbl_timeout\" size=\"4\" maxlength=\"10\" /></td>
			    </tr>

			    <tr>
			      <td align=\"right\" />Num Check Received:</td>
			      <td><input type=\"text\" name=\"num_check_received_control\" value=\"$init_num_check_received\" size=\"4\" maxlength=\"10\" /></td>
			    </tr>

			</table>
		";

	}

	function rbl_apply(){
	
		$rbl = ($_POST[rbl_control] != "") ? "0" : "1";

		set_pref("skip_rbl_checks",$rbl);

		if($_POST[rbl_timeout_control] != ""){
			set_pref("rbl_timeout",$_POST[rbl_timeout_control]);
		}

		if($_POST[num_check_received_control] != ""){
			set_pref("num_check_received",$_POST[num_check_received_control]);
		}

	}

?>
