<?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.
 */
	function subject_keys(){
		return array("rewrite_subject","subject_tag");
	}

	function subject_html(){
		$rewrite_checked = (get_pref("rewrite_subject") == "1") ? "CHECKED" : "";

		$init_subject_string = get_pref("subject_tag");
		if($init_subject_string == "") $init_subject_string = "*****SPAM*****";

		echo "<b>Subject Rewrite</b><br />
			When a message is identified as spam, the filter can append some text to the subject of the message.
			<br /><br /> <input type=\"checkbox\" name=\"rewrite_control\" $rewrite_checked /> Tag Subject lines
			<br /><br /> with this text: <input type=\"text\" name=\"subject_tag_control\"
			 value=\"$init_subject_string\" />
		";
	}

	function subject_apply(){

		$rewrite = ($_POST[rewrite_control] != "") ? "1" : "0";
		set_pref("rewrite_subject",$rewrite);

		if($_POST[subject_tag_control] != ""){
			set_pref("subject_tag",$_POST[subject_tag_control]);
		}
	}

?>
