Handle hostnames with upper-case letters
[webmin.git] / usermin / edit_bind.cgi
1 #!/usr/local/bin/perl
2 # edit_bind.cgi
3 # Display port / address form
4
5 require './usermin-lib.pl';
6 $access{'bind'} || &error($text{'acl_ecannot'});
7 &ui_print_header(undef, $text{'bind_title'}, "");
8 &get_usermin_miniserv_config(\%miniserv);
9
10 print $text{'bind_desc2'},"<p>\n";
11
12 print &ui_form_start("change_bind.cgi", "post");
13 print &ui_table_start($text{'bind_header'}, undef, 2, [ "width=30%" ]);
14
15 # Build list of sockets
16 my @sockets = &webmin::get_miniserv_sockets(\%miniserv);
17
18 # Show table of all bound IPs and ports
19 my $stable = &ui_columns_start([ $text{'bind_sip'}, $text{'bind_sport'} ]);
20 my $i = 0;
21 foreach $s (@sockets, [ undef, "*" ]) {
22         # IP address
23         my @cols;
24         push(@cols, &ui_select("ip_def_$i",
25                                $s->[0] eq "" ? 0 :
26                                $s->[0] eq "*" ? 1 : 2,
27                                [ [ 0, "&nbsp;" ],
28                                [ 1, $text{'bind_sip1'} ],
29                                [ 2, $text{'bind_sip2'} ] ])." ".
30                                &ui_textbox("ip_$i",
31                                   $s->[0] eq "*" ? undef : $s->[0], 20));
32
33         # Port
34         push(@cols, &ui_select("port_def_$i", $s->[1] eq "*" ? 0 : 1,
35                   [ $i ? ( [ 0, $text{'bind_sport0'} ] ) : ( ),
36              [ 1, $text{'bind_sport1'} ] ])." ".
37               &ui_textbox("port_$i", $s->[1] eq "*" ? undef : $s->[1],5));
38         $stable .= &ui_columns_row(\@cols, [ "nowrap", "nowrap" ]);
39         $i++;
40         }
41 $stable .= &ui_columns_end();
42 print &ui_table_row($text{'bind_sockets'}, $stable);
43
44 # IPv6 enabled?
45 print &ui_table_row($webmin::text{'bind_ipv6'},
46         &ui_yesno_radio("ipv6", $miniserv{'ipv6'}));
47
48 # Show web server hostname
49 print &ui_table_row($text{'bind_hostname'},
50       &ui_radio("hostname_def", $miniserv{"host"} ? 0 : 1,
51       [ [ 1, $text{'bind_auto'} ],
52       [ 0, &ui_textbox("hostname", $miniserv{"host"}, 25) ] ]));
53
54 print &ui_table_end();
55 print &ui_form_end([ [ "save", $text{'save'} ] ]);
56
57 &ui_print_footer("", $text{'index_return'});
58