Handle hostnames with upper-case letters
[webmin.git] / spam / acl_security.pl
1
2 require 'spam-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the spam module
6 sub acl_security_form
7 {
8 # Allowed features
9 print "<tr> <td valign=top><b>$text{'acl_avail'}</b></td>\n";
10 print "<td><select name=avail rows=6 multiple>\n";
11 local %avail = map { $_, 1 } split(/,/, $_[0]->{'avail'});
12 foreach $a ('white', 'score', 'report', 'user', 'header', 'setup', 'procmail',
13             'db', 'awl') {
14         printf "<option value=%s %s>%s\n",
15                 $a, $avail{$a} ? "selected" : "", $text{$a."_title"};
16         }
17 print "</select></td> </tr>\n";
18
19 # Config file to edit
20 print "<tr> <td><b>$text{'acl_file'}</b></td>\n";
21 print "<td>",&ui_opt_textbox("file", $_[0]->{'file'}, 40, $text{'acl_filedef'}),
22       "</td> </tr>\n";
23
24 # Allowed auto-whitelist users
25 print "<tr> <td><b>$text{'acl_awl'}</b></td>\n";
26 print "<td>",&ui_radio("awl_mode", $_[0]->{'awl_groups'} ? 2 :
27                                     $_[0]->{'awl_users'} ? 1 : 0,
28         [ [ 0, $text{'acl_awl0'}."<br>\n" ],
29           [ 1, &text('acl_awl1',
30                 &ui_textbox("awl_users", $_[0]->{'awl_users'}, 40).
31                 &user_chooser_button("awl_users", 1))."<br>\n" ],
32           [ 2, &text('acl_awl2',
33                 &ui_textbox("awl_groups", $_[0]->{'awl_groups'}, 40).
34                 &group_chooser_button("awl_users", 1))."<br>\n" ],
35         ]),"</td> </tr>\n";
36 }
37
38 # acl_security_save(&options)
39 # Parse the form for security options for the cron module
40 sub acl_security_save
41 {
42 $_[0]->{'avail'} = join(",", split(/\0/, $in{'avail'}));
43 $_[0]->{'file'} = $in{'file_def'} ? undef : $in{'file'};
44 delete($_[0]->{'awl_users'});
45 delete($_[0]->{'awl_groups'});
46 if ($in{'awl_mode'} == 1) {
47         $_[0]->{'awl_users'} = $in{'awl_users'};
48         }
49 elsif ($in{'awl_mode'} == 2) {
50         $_[0]->{'awl_groups'} = $in{'awl_groups'};
51         }
52 }
53