3 # Display a form for editing spam scoring options
5 require './spam-lib.pl';
7 &set_config_file_in(\%in);
8 &can_use_check("score");
9 &ui_print_header($header_subtext, $text{'score_title'}, "");
10 $conf = &get_config();
11 @plugins = &list_spamassassin_plugins();
13 print "$text{'score_desc'}<p>\n";
14 &start_form("save_score.cgi", $text{'score_header'});
16 # Required score before considering spam
17 $hits_param = &version_atleast(3.0) ? "required_score" : "required_hits";
18 $hits = &find($hits_param, $conf);
19 print &ui_table_row($text{'score_hits'},
20 &opt_field($hits_param, $hits, 5, "5"));
22 # Auto-whitelist factor
23 $auto = &find("auto_whitelist_factor", $conf);
24 print &ui_table_row($text{'score_auto'},
25 &opt_field("auto_whitelist_factor", $auto, 5, "0.5"));
27 # Enable bayesian learning
28 $bayes = &find("use_bayes", $conf);
29 print &ui_table_row($text{'score_bayes'},
30 &yes_no_field("use_bayes", $bayes, 1));
33 $mx = &find("check_mx_attempts", $conf);
34 print &ui_table_row($text{'score_mx'},
35 &opt_field("check_mx_attempts", $mx, 4, "2"));
37 # Delay between MX checks
38 $mxdelay = &find("check_mx_delay", $conf);
39 print &ui_table_row($text{'score_mxdelay'},
40 &opt_field("check_mx_delay", $mxdelay, 4, "2"));
43 $rbl = &find("skip_rbl_checks", $conf);
44 print &ui_table_row($text{'score_rbl'},
45 &yes_no_field("skip_rbl_checks", $rbl, 0));
48 $timeout = &find("rbl_timeout", $conf);
49 print &ui_table_row($text{'score_timeout'},
50 &opt_field("rbl_timeout", $timeout, 5, "30"));
52 # Received headers to check
53 $received = &find("num_check_received", $conf);
54 print &ui_table_row($text{'score_received'},
55 &opt_field("num_check_received", $received, 5, 2));
57 if (&indexof("Mail::SpamAssassin::Plugin::TextCat", @plugins) >= 0) {
60 # Acceptable languages
61 @langs = &find_value("ok_languages", $conf);
62 %langs = map { $_, 1 } split(/\s+/, join(" ", @langs));
63 $lmode = !@langs ? 2 : $langs{'all'} ? 1 : 0;
64 delete($langs{'all'});
65 print &ui_table_row($text{'score_langs'},
66 &ui_radio("langs_def", $lmode,
67 [ [ 2, $text{'default'}.
68 " (".$text{'score_langsall'}.")" ],
69 [ 1, $text{'score_langsall'} ],
70 [ 0, $text{'score_langssel'} ] ])."<br>\n".
71 &ui_select("langs", [ keys %langs ],
72 [ &list_spamassassin_languages() ], 10, 1, 1));
75 @locales = &find_value("ok_locales", $conf);
76 %locales = map { $_, 1 } split(/\s+/, join(" ", @locales));
77 $lmode = !@locales ? 2 : $locales{'all'} ? 1 : 0;
78 delete($locales{'all'});
79 print &ui_table_row($text{'score_locales'},
80 &ui_radio("locales_def", $lmode,
81 [ [ 2, $text{'default'}.
82 " (".$text{'score_localesall'}.")" ],
83 [ 1, $text{'score_localesall'} ],
84 [ 0, $text{'score_localessel'} ] ])."<br>\n".
85 &ui_select("locales", [ keys %locales ],
86 [ &list_spamassassin_locales() ], 5, 1, 1));
89 &end_form(undef, $text{'save'});
90 &ui_print_footer($redirect_url, $text{'index_return'});