Handle hostnames with upper-case letters
[webmin.git] / webalizer / acl_security.pl
1
2 do 'webalizer-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the webalizer module
6 sub acl_security_form
7 {
8 print "<tr> <td><b>$text{'acl_view'}</b></td>\n";
9 printf "<td nowrap><input type=radio name=view value=1 %s> %s\n",
10         $_[0]->{'view'} ? "checked" : "", $text{'yes'};
11 printf "<input type=radio name=view value=0 %s> %s</td>\n",
12         $_[0]->{'view'} ? "" : "checked", $text{'no'};
13
14 print "<td><b>$text{'acl_global'}</b></td>\n";
15 printf "<td nowrap><input type=radio name=global value=1 %s> %s\n",
16         $_[0]->{'global'} ? "checked" : "", $text{'yes'};
17 printf "<input type=radio name=global value=0 %s> %s</td> </tr>\n",
18         $_[0]->{'global'} ? "" : "checked", $text{'no'};
19
20 print "<tr> <td><b>$text{'acl_add'}</b></td>\n";
21 printf "<td nowrap><input type=radio name=add value=1 %s> %s\n",
22         $_[0]->{'add'} ? "checked" : "", $text{'yes'};
23 printf "<input type=radio name=add value=0 %s> %s</td> </tr>\n",
24         $_[0]->{'add'} ? "" : "checked", $text{'no'};
25
26 print "<tr> <td><b>$text{'acl_user'}</b></td>\n";
27 printf "<td colspan=3><input type=radio name=user_def value=1 %s> %s\n",
28         $_[0]->{'user'} eq "" ? "checked" : "", $text{'acl_this'};
29 printf "<input type=radio name=user_def value=2 %s> %s\n",
30         $_[0]->{'user'} eq "*" ? "checked" : "", $text{'acl_any'};
31 printf "<input type=radio name=user_def value=0 %s>\n",
32         $_[0]->{'user'} eq "*" || $_[0]->{'user'} eq "" ? "" : "checked";
33 printf "<input name=user size=8 value='%s'> %s</td> </tr>\n",
34         $_[0]->{'user'} eq "*" ? "" : $_[0]->{'user'},
35         &user_chooser_button("user");
36
37 print "<tr> <td><b>$text{'acl_dir'}</b></td>\n";
38 print "<td colspan=3><input name=dir size=50 value='$_[0]->{'dir'}'></td> </tr>\n";
39 }
40
41 # acl_security_save(&options)
42 # Parse the form for security options for the shell module
43 sub acl_security_save
44 {
45 $_[0]->{'view'} = $in{'view'};
46 $_[0]->{'global'} = $in{'global'};
47 $_[0]->{'add'} = $in{'add'};
48 $_[0]->{'dir'} = $in{'dir'};
49 $_[0]->{'user'} = $in{'user_def'} == 2 ? "*" :
50                   $in{'user_def'} == 1 ? "" : $in{'user'};
51 }
52