Handle hostnames with upper-case letters
[webmin.git] / proftpd / virt_index.cgi
1 #!/usr/local/bin/perl
2 # virt_index.cgi
3 # Display a menu for some specific virtual server, or the default server
4
5 require './proftpd-lib.pl';
6 &ReadParse();
7 ($conf, $v) = &get_virtual_config($in{'virt'});
8 $desc = $in{'virt'} eq '' ? $text{'virt_header2'} :
9               &text('virt_header1', $v->{'value'});
10 &ui_print_header($desc, $text{'virt_title'}, "",
11         undef, undef, undef, undef, &restart_button());
12
13 # Display header and icons
14 print "<h3>$text{'virt_opts'}</h3>\n";
15 $anon_icon = { "icon" => "images/anon.gif",
16                "name" => $text{'virt_anon'},
17                "link" => "anon_index.cgi?virt=$in{'virt'}" };
18 $virt_icon = { "icon" => "images/virt.gif",
19                "name" => $text{'virt_virt'},
20                "link" => "edit_vserv.cgi?virt=$in{'virt'}" };
21 $ed_icon = { "icon" => "images/edit.gif",
22              "name" => $text{'virt_edit'},
23              "link" => "manual_form.cgi?virt=$in{'virt'}" };
24 &config_icons("virtual", "edit_virt.cgi?virt=$in{'virt'}&",
25               $anon_icon, $in{'virt'} ? ( $virt_icon, $ed_icon ) : ( ) );
26
27 # Display per-directory/limit options
28 @dir = ( &find_directive_struct("Directory", $conf) ,
29          &find_directive_struct("Limit", $conf) );
30 if (@dir) {
31         print &ui_hr();
32         print "<h3>$text{'virt_header'}</h3>\n";
33         foreach $d (@dir) {
34                 if ($d->{'name'} eq 'Limit') {
35                         push(@links, "limit_index.cgi?limit=".
36                                      &indexof($d, @$conf)."&virt=$in{'virt'}");
37                         push(@titles, &text('virt_limit', $d->{'value'}));
38                         push(@icons, "images/limit.gif");
39                         }
40                 else {
41                         push(@links, "dir_index.cgi?idx=".
42                                      &indexof($d, @$conf)."&virt=$in{'virt'}");
43                         push(@titles, &text('virt_dir', $d->{'value'}));
44                         push(@icons, "images/dir.gif");
45                         }
46                 }
47         &icons_table(\@links, \@titles, \@icons, 3);
48         }
49
50 print "<table width=100%><tr><td>\n";
51
52 print "<form action=create_dir.cgi>\n";
53 print "<input type=hidden name=virt value='$in{'virt'}'>\n";
54 print "<table border>\n";
55 print "<tr $tb> <td><b>$text{'virt_adddir'}</b></td> </tr>\n";
56 print "<tr $cb> <td><table>\n";
57 print "<tr> <td><b>$text{'virt_path'}</b></td>\n";
58 print "<td><input name=dir size=30>\n";
59 print "<input type=submit value=\"$text{'create'}\"></td> </tr>\n";
60 print "</table></td></tr></table></form>\n";
61
62 print "</td><td>\n";
63
64 print "<form action=create_limit.cgi>\n";
65 print "<input type=hidden name=virt value='$in{'virt'}'>\n";
66 print "<table border>\n";
67 print "<tr $tb> <td><b>$text{'virt_addlimit'}</b></td> </tr>\n";
68 print "<tr $cb> <td><table>\n";
69 print "<tr> <td><b>$text{'virt_cmds'}</b></td>\n";
70 print "<td><input name=cmd size=20>\n";
71 print "<input type=submit value=\"$text{'create'}\"></td> </tr>\n";
72 print "</table></td></tr></table></form>\n";
73
74 print "</td></tr></table>\n";
75
76 &ui_print_footer("", $text{'index_return'});
77