Handle hostnames with upper-case letters
[webmin.git] / usermin / acl_security.pl
1
2 require 'usermin-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the usermin module
6 sub acl_security_form
7 {
8 print "<tr> <td valign=top><b>$text{'acl_icons'}</b></td>\n";
9 print "<td colspan=3><select name=icons multiple size=10>\n";
10 foreach $i (&get_icons()) {
11         printf "<option value=%s %s>%s\n",
12                 $i, $_[0]->{$i} ? "selected" : "", $text{"${i}_title"};
13         }
14 print "</select></td> </tr>\n";
15
16 print "<tr> <td valign=top><b>$text{'acl_mods'}</b></td> <td colspan=3>\n";
17 printf "<input type=radio name=mods_def value=1 %s> %s\n",
18         $_[0]->{'mods'} eq '*' ? 'checked' : '', $text{'acl_all'};
19 printf "<input type=radio name=mods_def value=0 %s> %s<br>\n",
20         $_[0]->{'mods'} eq '*' ? '' : 'checked', $text{'acl_sel'};
21 local %mods = map { $_, 1 } split(/\s+/, $_[0]->{'mods'});
22 print "<select name=mods multiple size=10>\n";
23 foreach $m (&list_modules()) {
24         printf "<option value=%s %s>%s\n",
25                 $m->{'dir'}, $mods{$m->{'dir'}} ? "selected" : "", $m->{'desc'};
26         }
27 print "</select></td> </tr>\n";
28
29 print "<tr> <td><b>$text{'acl_stop'}</b></td>\n";
30 printf "<td><input type=radio name=stop value=1 %s> %s\n",
31         $_[0]->{'stop'} ? "checked" : "", $text{'yes'};
32 printf "<input type=radio name=stop value=0 %s> %s</td>\n",
33         $_[0]->{'stop'} ? "" : "checked", $text{'no'};
34
35 print "<td><b>$text{'acl_bootup'}</b></td>\n";
36 printf "<td><input type=radio name=bootup value=1 %s> %s\n",
37         $_[0]->{'bootup'} ? "checked" : "", $text{'yes'};
38 printf "<input type=radio name=bootup value=0 %s> %s</td> </tr>\n",
39         $_[0]->{'bootup'} ? "" : "checked", $text{'no'};
40 }
41
42 # acl_security_save(&options)
43 # Parse the form for security options for the usermin module
44 sub acl_security_save
45 {
46 local %icons = map { $_, 1 } split(/\0/, $in{'icons'});
47 foreach $i (&get_icons()) {
48         $_[0]->{$i} = $icons{$i};
49         }
50 $_[0]->{'mods'} = $in{'mods_def'} ? "*" : join(" ", split(/\0/, $in{'mods'}));
51 $_[0]->{'stop'} = $in{'stop'};
52 $_[0]->{'bootup'} = $in{'bootup'};
53 }
54
55 sub get_icons
56 {
57 return ( "access" ,"bind" ,"ui" ,"umods" ,"os" ,"lang" ,"upgrade" ,"session" ,"assignment" ,"categories" ,"themes", "referers", "anon", "ssl" ,"configs" ,"acl" ,"restrict" ,"users" ,"defacl", "sessions", "blocked", "advanced" );
58 }
59