Handle hostnames with upper-case letters
[webmin.git] / dovecot / edit_net.cgi
1 #!/usr/local/bin/perl
2 # Show networking options
3
4 require './dovecot-lib.pl';
5 &ui_print_header(undef, $text{'net_title'}, "");
6 $conf = &get_config();
7
8 print &ui_form_start("save_net.cgi", "post");
9 print &ui_table_start($text{'net_header'}, "width=100%", 4);
10
11 # Mail protocols
12 @supported_protocols = &get_supported_protocols();
13 @protos = split(/\s+/, &find_value("protocols", $conf));
14 print &ui_table_row($text{'net_protocols'},
15             &ui_select("protocols", \@protos,
16                 [ map { [ $_, $text{'net_'.$_} ] } @supported_protocols ],
17                 scalar(@supported_protocols), 1, 1));
18
19 # SSL supported?
20 $sslopt = &find("ssl_disable", $conf, 2) ? "ssl_disable" : "ssl";
21 $dis = &find_value($sslopt, $conf);
22 if ($sslopt eq "ssl") {
23         @opts = ( [ "yes", $text{'yes'} ], [ "no", $text{'no'} ] );
24         }
25 else {
26         @opts = ( [ "no", $text{'yes'} ], [ "yes", $text{'no'} ] );
27         }
28 print &ui_table_row($text{'net_ssl_disable'},
29             &ui_radio($sslopt, $dis,
30                       [ @opts,
31                         [ "", &getdef($sslopt, \@opts) ] ]));
32
33 @listens = &find("imap_listen", $conf, 2) ?
34                 ("imap_listen", "pop3_listen", "imaps_listen", "pop3s_listen") :
35                 ("listen", "ssl_listen");
36 foreach $l (@listens) {
37         $listen = &find_value($l, $conf);
38         $mode = !$listen ? 0 :
39                 $listen eq "[::]" ? 1 :
40                 $listen eq "*" ? 2 : 3,
41         print &ui_table_row($text{'net_'.$l},
42                 &ui_radio($l."_mode", $mode,
43                           [ [ 0, $text{'net_listen0'} ],
44                             [ 1, $text{'net_listen1'} ],
45                             [ 2, $text{'net_listen2'} ],
46                             [ 3, $text{'net_listen3'} ] ])."\n".
47                 &ui_textbox($l, $mode == 3 ? $listen : "", 20), 3);
48         }
49
50 print &ui_table_end();
51 print &ui_form_end([ [ "save", $text{'save'} ] ]);
52
53 &ui_print_footer("", $text{'index_return'});
54