Handle hostnames with upper-case letters
[webmin.git] / proftpd / anon_index.cgi
1 #!/usr/local/bin/perl
2 # anon_index.cgi
3 # Display a menu for anonymous section options
4
5 require './proftpd-lib.pl';
6 &ReadParse();
7 ($conf, $v) = &get_virtual_config($in{'virt'});
8 $anonstr = &find_directive_struct("Anonymous", $conf);
9 if (!$anonstr) {
10         # Go to the anon options page
11         &redirect("edit_aserv.cgi?virt=$in{'virt'}&init=1");
12         exit;
13         }
14 $anon = $anonstr->{'members'};
15
16 # Display header and config icons
17 $desc = $in{'virt'} eq '' ? $text{'anon_header2'} :
18               &text('anon_header1', $v->{'value'});
19 &ui_print_header($desc, $text{'anon_title'}, "", undef, undef, undef, undef, &restart_button());
20
21 print "<h3>$text{'anon_opts'}</h3>\n";
22 $anon_icon = { "icon" => "images/anon.gif",
23                "name" => $text{'anon_anon'},
24                "link" => "edit_aserv.cgi?virt=$in{'virt'}" };
25 &config_icons("anon", "edit_anon.cgi?virt=$in{'virt'}&", $anon_icon);
26
27 # Display per-directory/limit options
28 @dir = ( &find_directive_struct("Directory", $anon) ,
29          &find_directive_struct("Limit", $anon) );
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?virt=$in{'virt'}&".
36                                      "anon=1&limit=".&indexof($d, @$anon));
37                         push(@titles, &text('virt_limit', $d->{'value'}));
38                         push(@icons, "images/limit.gif");
39                         }
40                 else {
41                         push(@links, "dir_index.cgi?virt=$in{'virt'}&".
42                                      "anon=1&idx=".&indexof($d, @$anon));
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 "<input type=hidden name=anon value=1>\n";
55 print "<table border>\n";
56 print "<tr $tb> <td><b>$text{'virt_adddir'}</b></td> </tr>\n";
57 print "<tr $cb> <td><table>\n";
58 print "<tr> <td><b>$text{'virt_path'}</b></td>\n";
59 print "<td><input name=dir size=30>\n";
60 print "<input type=submit value=\"$text{'create'}\"></td> </tr>\n";
61 print "</table></td></tr></table></form>\n";
62
63 print "</td><td>\n";
64
65 print "<form action=create_limit.cgi>\n";
66 print "<input type=hidden name=virt value='$in{'virt'}'>\n";
67 print "<input type=hidden name=anon value=1>\n";
68 print "<table border>\n";
69 print "<tr $tb> <td><b>$text{'virt_addlimit'}</b></td> </tr>\n";
70 print "<tr $cb> <td><table>\n";
71 print "<tr> <td><b>$text{'virt_cmds'}</b></td>\n";
72 print "<td><input name=cmd size=20>\n";
73 print "<input type=submit value=\"$text{'create'}\"></td> </tr>\n";
74 print "</table></td></tr></table></form>\n";
75
76 print "</td></tr></table>\n";
77
78 &ui_print_footer("virt_index.cgi?virt=$in{'virt'}", $text{'virt_return'},
79         "", $text{'index_return'});
80