2 # Allow changing of the rule for delivering spam
4 require './spam-lib.pl';
6 &set_config_file_in(\%in);
7 &can_use_check("procmail");
8 &ui_print_header(undef, $text{'procmail_title'}, "");
10 print &text('procmail_desc', "<tt>$pmrc</tt>"),"<p>\n";
12 # Find the existing recipe
13 &foreign_require("procmail", "procmail-lib.pl");
14 @pmrcs = &get_procmailrc();
15 $pmrc = $pmrcs[$#pmrcs];
16 @recipes = &procmail::parse_procmail_file($pmrc);
17 $spamrec = &find_file_recipe(\@recipes);
22 elsif ($spamrec->{'action'} eq "\$DEFAULT") {
25 elsif ($spamrec->{'action'} eq "/dev/null") {
28 elsif ($spamrec->{'action'} =~ /^(.*)\/$/) {
32 elsif ($spamrec->{'action'} =~ /^(.*)\/\.$/) {
36 elsif ($spamrec->{'type'} eq '!') {
38 $email = $spamrec->{'action'};
42 $file = $spamrec->{'action'};
45 print &ui_form_start("save_procmail.cgi", "post");
46 print &ui_table_start(undef, undef, 2);
49 # Spam destination inputs
50 print &ui_table_row($text{'setup_to'},
51 &ui_radio_table("to", $mode,
52 [ [ 0, $text{'setup_null'} ],
53 [ 4, $text{'setup_default'} ],
54 [ 1, $text{'setup_file'},
55 &ui_textbox("mbox", $mode == 1 ? $file : "", 40) ],
56 [ 2, $text{'setup_maildir'},
57 &ui_textbox("maildir", $mode == 2 ? $file : "", 40) ],
58 [ 3, $text{'setup_mhdir'},
59 &ui_textbox("mhdir", $mode == 3 ? $file : "", 40) ],
60 [ 5, $text{'setup_email'},
61 &ui_textbox("email", $mode == 5 ? $email : "", 40) ] ]));
64 if ($module_info{'usermin'}) {
65 $msg = "$text{'setup_rel'}<p>\n";
68 $msg = "$text{'setup_home'}<p>\n";
70 $msg .= "$text{'setup_head'}<p>\n";
71 print &ui_table_row(undef, $msg, 2);
73 print &ui_table_end();
74 print &ui_form_end([ [ undef, $text{'procmail_ok'} ] ]);
76 &ui_print_footer($redirect_url, $text{'index_return'});