Handle hostnames with upper-case letters
[webmin.git] / apache / files_index.cgi
1 #!/usr/local/bin/perl
2 # files_index.cgi
3 # Display a menu of icons for per-files options
4
5 require './apache-lib.pl';
6 &ReadParse();
7 $access{'global'} || &error($text{'htaccess_ecannot'});
8 &allowed_auth_file($in{'file'}) ||
9         &error($text{'htindex_ecannot'});
10 $conf = &get_htaccess_config($in{'file'});
11 $d = $conf->[$in{'idx'}];
12 $desc = &text('htfile_header', &dir_name($d), "<tt>$in{'file'}</tt>");
13 &ui_print_header($desc, $text{'htfile_title'}, "");
14
15 $sw_icon = { "icon" => "images/show.gif",
16              "name" => $text{'htfile_show'},
17              "link" => "show.cgi?file=".&urlize($in{'file'})."&idx=$in{'idx'}" };
18 if ($access{'types'} eq '*') {
19         $ed_icon = { "icon" => "images/edit.gif",
20                      "name" => $text{'htfile_edit'},
21                      "link" =>
22                         "manual_form.cgi?file=".&urlize($in{'file'})."&idx=$in{'idx'}" };
23         }
24 &config_icons("directory", "edit_files.cgi?file=".&urlize($in{'file'})."&idx=$in{'idx'}&",
25               $sw_icon, $ed_icon ? ( $ed_icon ) : ( ));
26
27 print &ui_hr();
28 print &ui_form_start("change_files.cgi", "post");
29 print &ui_hidden("file", $in{'file'});
30 print &ui_hidden("idx", $in{'idx'});
31 print &ui_table_start($text{'htfile_apply'}, undef, 2);
32
33 $regexp = $d->{'words'}->[0] eq "~" || $d->{'name'} =~ /Match/;
34 print &ui_table_row($text{'htindex_regexp'},
35         &ui_radio("regexp", $regexp ? 1 : 0,
36                   [ [ 0, $text{'htindex_exact'} ],
37                     [ 1, $text{'htindex_re'} ] ]));
38
39 print &ui_table_row($text{'htindex_path'},
40         &ui_textbox("path", 
41                 $d->{'words'}->[0] eq "~" ? $d->{'words'}->[1]
42                                           : $d->{'words'}->[0], 50));
43
44 print &ui_table_end();
45 print &ui_form_end([ [ undef, $text{'save'} ],
46                      [ 'delete', $text{'delete'} ] ]);
47
48 &ui_print_footer("htaccess_index.cgi?file=".&urlize($in{'file'}), $text{'htindex_return'});
49
50