<?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_header");
	}

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

		$init_subject_string = get_pref("rewrite_header");
		if($init_subject_string == "") $init_subject_string = "*****SPAM*****";
		$init_subject_string = str_replace("Subject", "", $init_subject_string);
		$init_subject_string = trim($init_subject_string);
		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 /> Enter text to append or make blank to not append text: <input type=\"text\" name=\"subject_tag_control\"
			 value=\"$init_subject_string\" />
		";
	}

	function subject_apply(){
	  
	  if($_POST[subject_tag_control] != ""){
	    $_POST[subject_tag_control]="Subject ".$_POST[subject_tag_control];
	    set_pref("rewrite_header",$_POST[subject_tag_control]);
	 
	  }
	}

?>
