Handle hostnames with upper-case letters
[webmin.git] / squid / pool_access.cgi
1 #!/usr/local/bin/perl
2 # pool_access.cgi
3 # A form for editing or creating delay pool ACL
4
5 require './squid-lib.pl';
6 $access{'delay'} || &error($text{'delay_ecannot'});
7 &ReadParse();
8 $conf = &get_config();
9
10 if (!defined($in{'index'})) {
11         &ui_print_header(undef, $text{'apool_header'}, "",
12                 undef, 0, 0, 0, &restart_button());
13         }
14 else {
15         &ui_print_header(undef, $text{'apool_header1'}, "",
16                 undef, 0, 0, 0, &restart_button());
17         @delay = @{$conf->[$in{'index'}]->{'values'}};
18         }
19
20 print "<form action=pool_access_save.cgi>\n";
21 if (@delay) {
22         print "<input type=hidden name=index value=$in{'index'}>\n";
23         }
24 print "<input type=hidden name=idx value=$in{'idx'}>\n";
25 print "<table border>\n";
26 print "<tr $tb> <td><b>$text{'apool_pr'}</b></td> </tr>\n";
27 print "<tr $cb> <td><table>\n";
28
29 print "<tr> <td><b>$text{'ahttp_a'}</b></td> <td colspan=3>\n";
30 printf "<input type=radio name=action value=allow %s> $text{'ahttp_a1'}\n",
31         $delay[1] eq "allow" ? "checked" : "";
32 printf "<input type=radio name=action value=deny %s> $text{'ahttp_d'}</td> </tr>\n",
33         $delay[1] eq "allow" ? "" : "checked";
34
35 for($i=2; $i<@delay; $i++) { $match{$delay[$i]}++; }
36 @acls = grep { !$done{$_->{'values'}->[0]}++ } &find_config("acl", $conf);
37 unshift(@acls, { 'values' => [ 'all' ] }) if ($squid_version >= 3);
38 $r = @acls; $r = 10 if ($r > 10);
39
40 print "<tr> <td valign=top><b>$text{'ahttp_ma'}</b></td>\n";
41 print "<td valign=top><select name=yes multiple size=$r width=100>\n";
42 foreach $a (@acls) {
43         printf "<option %s>%s\n",
44                 $match{$a->{'values'}->[0]} ? "selected" : "",
45                 $a->{'values'}->[0];
46         }
47 print "</select></td>\n";
48
49 print "<td valign=top><b>$text{'ahttp_dma'}</b></td>\n";
50 print "<td valign=top><select name=no multiple size=$r width=100>\n";
51 foreach $a (@acls) {
52         printf "<option %s>%s\n",
53                 $match{"!$a->{'values'}->[0]"} ? "selected" : "",
54                 $a->{'values'}->[0];
55         }
56 print "</select></td> </tr>\n";
57
58 print "</table></td></tr></table>\n";
59 print "<input type=submit value='$text{'buttsave'}'>\n";
60 if (@delay) {
61         print "<input type=submit value='$text{'buttdel'}' name=delete>\n";
62         }
63 print "</form>\n";
64
65 &ui_print_footer("edit_pool.cgi?idx=$in{'idx'}", $text{'pool_return'},
66         "", $text{'index_return'});
67