<?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 dns_keys(){
		return array("check_mx_attempts","check_mx_delay","dns_available");
	}

	function dns_html(){

		$init_dns_available	= get_pref("dns_available");
		if($init_dns_available == "") $init_dns_available = "yes";

		eval("\$ns$init_dns_available = \"CHECKED\";");

		$init_check_mx_attempts = (get_pref("check_mx_attempts") != "") ? get_pref("check_mx_attempts") : "2";
		$init_check_mx_delay = (get_pref("check_mx_delay") != "") ? get_pref("check_mx_delay") : "5";


		echo "<b>DNS Options</b><br /><br />

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

			    <tr>
			      <td align=\"right\" />DNS Available:</td>
			      <td><input type=\"radio\" name=\"dns_available_control\" value=\"yes\" $nsyes /> Yes | 
				<input type=\"radio\" name=\"dns_available_control\" value=\"no\" $nsno /> No | 
				<input type=\"radio\" name=\"dns_available_control\" value=\"test\" $nstest /> Test
			    </tr>

			    <tr>
			      <td align=\"right\" />Check MX Attempts:</td>
			      <td><input type=\"text\" name=\"check_mx_attempts_control\" value=\"$init_check_mx_attempts\" size=\"4\" maxlength=\"10\" /></td>
			    </tr>

			    <tr>
			      <td align=\"right\" />Check MX Delay:</td>
			      <td><input type=\"text\" name=\"check_mx_delay_control\" value=\"$init_check_mx_delay\" size=\"4\" maxlength=\"10\" /></td>
			    </tr>

			</table>
		";

	}

	function dns_apply(){

		set_pref("dns_available",$_POST[dns_available_control]);

		if($_POST[check_mx_attempts_control] != ""){
			set_pref("check_mx_attempts",$_POST[check_mx_attempts_control]);
		}

		if($_POST[check_mx_delay_control] != ""){
			set_pref("check_mx_delay",$_POST[check_mx_delay_control]);
		}
	}

?>
