#!/usr/local/bin/perl
# save_report.cgi
# Save report generation options

require './spam-lib.pl';
&error_setup($text{'report_err'});
&can_use_check("report");
&ReadParse();
&lock_spam_files();
$conf = &get_config();

&save_directives($conf, 'clear_report_template',
		$in{'clear_report'} ? [ "" ] : [ ], 1);
$in{'report'} =~ s/\r//g;
@report = split(/\n/, $in{'report'});
&save_directives($conf, 'report', \@report, 1);

&save_directives($conf, 'clear_terse_report_template',
		$in{'clear_terse'} ? [ "" ] : [ ], 1);
$in{'terse'} =~ s/\r//g;
@terse = split(/\n/, $in{'terse'});
&save_directives($conf, 'terse_report', \@terse, 1);

&parse_yes_no($conf, "rewrite_subject");
&parse_opt($conf, "subject_tag", undef);
&parse_yes_no($conf, "report_header");
&parse_yes_no($conf, "use_terse_report");
&parse_yes_no($conf, "fold_headers");
&parse_yes_no($conf, "detailed_phrase_score");
&parse_yes_no($conf, "spam_level_stars");
&parse_opt($conf, "spam_level_char", \&char_check);
&parse_yes_no($conf, "defang_mime");
&parse_yes_no($conf, "report_safe") if (defined($in{'report_safe'}));

&flush_file_lines();
&unlock_spam_files();
&webmin_log("report");
&redirect("");

sub char_check
{
$_[0] =~ /^\S$/ || &error($text{'report_echar'});
}

