Handle hostnames with upper-case letters
[webmin.git] / squid / list_headeracc.cgi
1 #!/usr/local/bin/perl
2 # list_headeracc.cgi
3 # Display all header access control restrictions
4
5 require './squid-lib.pl';
6 $access{'headeracc'} || &error($text{'header_ecannot'});
7 &ui_print_header(undef, $text{'header_title'}, "", "list_headeracc", 0, 0, 0, &restart_button());
8 $conf = &get_config();
9
10 # Work out what header access directives we support
11 @types = $squid_version >= 3.0 ?
12         ("request_header_access", "reply_header_access") : ("header_access");
13
14 # Show a table for each
15 foreach $t (@types) {
16         @headeracc = &find_config($t, $conf);
17         @links = ( "<a href='edit_headeracc.cgi?new=1&type=$t'>".
18                    "$text{'header_add'}</a>" );
19         print &ui_subheading($text{'header_'.$t}),"<p>\n"
20                 if ($t ne "header_access");
21         if (@headeracc) {
22                 print &ui_links_row(\@links);
23                 print &ui_columns_start([ $text{'header_name'},
24                                           $text{'header_act'},
25                                           $text{'header_acls'},
26                                           $text{'eacl_move'} ]);
27                 $hc = 0;
28                 foreach $h (@headeracc) {
29                         @v = @{$h->{'values'}};
30                         @cols = ( );
31                         push(@cols, "<a href='edit_headeracc.cgi?type=$t&".
32                                     "index=$h->{'index'}'>$v[0]</a>");
33                         push(@cols, $v[1] eq 'allow' ? $text{'eacl_allow'}
34                                                      : $text{'eacl_deny'});
35                         push(@cols, join(" ", @v[2..$#v]));
36                         push(@cols, &ui_up_down_arrows(
37                                 "move_headeracc.cgi?$hc+-1+$t",
38                                 "move_headeracc.cgi?$hc+1+$t",
39                                 $hc != 0, $hc != @headeracc-1));
40                         print &ui_columns_row(\@cols);
41                         $hc++;
42                         }
43                 print &ui_columns_end();
44                 }
45         else {
46                 print "$text{'header_none'}<p>\n";
47                 }
48         print &ui_links_row(\@links);
49         print "<hr>" if ($t ne $types[$#types]);
50         }
51
52 &ui_print_footer("", $text{'index_return'});
53