Handle hostnames with upper-case letters
[webmin.git] / phpini / index.cgi
1 #!/usr/local/bin/perl
2 # Show all editable PHP configuration files
3
4 require './phpini-lib.pl';
5
6 # Get editable files
7 @files = &list_php_configs();
8 if (!@files) {
9         # User doesn't have access to any
10         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
11         &ui_print_endpage($text{'index_eaccess'});
12         }
13 @files = grep { -r $_->[0] } @files;
14 if (!@files) {
15         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
16         if ($access{'noconfig'}) {
17                 &ui_print_endpage($text{'index_efiles'});
18                 }
19         else {
20                 &ui_print_endpage(&text('index_efiles2',
21                                         "../config.cgi?$module_name"));
22                 }
23         }
24
25 if (@files == 1 && !$access{'anyfile'} && $access{'noconfig'}) {
26         # Just re-direct to the one file
27         &redirect("list_ini.cgi?file=".&urlize($files[0]->[0]));
28         }
29 else {
30         # Show a table of config files
31         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
32
33         @tds = ( undef, undef, "width=10% nowrap" );
34         print &ui_columns_start([ $text{'index_file'},
35                                   $text{'index_desc'},
36                                   $text{'index_actions'} ],
37                                 100, 0, \@tds);
38         foreach $f (@files) {
39                 local @acts = ( "<a href='list_ini.cgi?file=".
40                                 &urlize($f->[0])."'>$text{'index_edit'}</a>" );
41                 if ($access{'manual'}) {
42                         push(@acts, "<a href='edit_manual.cgi?file=".
43                             &urlize($f->[0])."'>$text{'index_manual'}</a>");
44                         }
45                 print &ui_columns_row([
46                         "<tt>$f->[0]</tt>",
47                         $f->[1],
48                         join(" | ", @acts)
49                         ], \@tds);
50                 }
51         print &ui_columns_end();
52
53         # Allow entering a file to edit
54         if ($access{'anyfile'}) {
55                 print "<p>\n";
56                 print &ui_form_start("list_ini.cgi");
57                 print "<b>$text{'index_anyfile'}</b>\n";
58                 print &ui_textbox("file", undef, 40)." ".
59                       &file_chooser_button("file")." ".
60                       &ui_submit($text{'index_edit'})."\n";
61                 print &ui_form_end();
62                 }
63
64         &ui_print_footer("/", $text{'index'});
65         }
66