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