Handle hostnames with upper-case letters
[webmin.git] / pptp-server / edit_conf.cgi
1 #!/usr/local/bin/perl
2 # edit_conf.cgi
3 # Display PPTP server options
4
5 require './pptp-server-lib.pl';
6 $access{'conf'} || &error($text{'conf_ecannot'});
7 &ui_print_header(undef, $text{'conf_title'}, "", "conf");
8
9 # Show actual options
10 $conf = &get_config();
11 print "<form action=save_conf.cgi method=post>\n";
12 print "<table border width=100%>\n";
13 print "<tr $tb> <td><b>$text{'conf_header'}</b></td> </tr>\n";
14 print "<tr $cb> <td><table width=100%>\n";
15
16 # Maximum PPP speed
17 $speed = &find_conf("speed", $conf);
18 print "<tr> <td><b>$text{'conf_speed'}</b></td> <td>\n";
19 printf "<input type=radio name=speed_def value=1 %s> %s\n",
20         $speed ? "" : "checked", $text{'default'};
21 printf "<input type=radio name=speed_def value=0 %s>\n",
22         $speed ? "checked" : "";
23 printf "<input name=speed size=8 value='%s'> %s</td>\n",
24         $speed, $text{'conf_baud'};
25
26 # Listen address
27 $listen = &find_conf("listen", $conf);
28 print "<td><b>$text{'conf_listen'}</b></td> <td>\n";
29 printf "<input type=radio name=listen_def value=1 %s> %s\n",
30         $listen ? "" : "checked", $text{'conf_all'};
31 printf "<input type=radio name=listen_def value=0 %s>\n",
32         $listen ? "checked" : "";
33 printf "<input name=listen size=15 value='%s'></td> </tr>\n",
34         $listen;
35
36 # PPP options file
37 $option = &find_conf("option", $conf);
38 $mode = $option eq $options_pptp ? 1 : $option ? 2 : 0;
39 print "<td><b>$text{'conf_option'}</b></td> <td colspan=3>\n";
40 printf "<input type=radio name=mode value=0 %s> %s\n",
41         $mode == 0 ? "checked" : "", $text{'conf_mode0'};
42 printf "<input type=radio name=mode value=1 %s> %s\n",
43         $mode == 1 ? "checked" : "", $text{'conf_mode1'};
44 printf "<input type=radio name=mode value=2 %s> %s\n",
45         $mode == 2 ? "checked" : "", $text{'conf_mode2'};
46 printf "<input name=option size=25 value='%s'>&nbsp;%s</td> </tr>\n",
47         $mode == 2 ? $option : "", &file_chooser_button("option");
48
49 # Local IP ranges
50 &ip_table("localip");
51
52 # Remote IP ranges
53 &ip_table("remoteip");
54
55 # IPX networks
56 $ipxnets = &find_conf("ipxnets", $conf);
57 ($from, $to) = split(/-/, $ipxnets);
58 print "<td><b>$text{'conf_ipxnets'}</b></td> <td colspan=3>\n";
59 printf "<input type=radio name=ipxnets_def value=1 %s> %s\n",
60         $ipxnets ? "" : "checked", $text{'conf_all'};
61 printf "<input type=radio name=ipxnets_def value=0 %s>\n",
62         $ipxnets ? "checked" : "";
63 printf "<b>%s</b> <input name=from size=8 value='%s'>\n",
64         $text{'conf_from'}, $from;
65 printf "<b>%s</b> <input name=to size=8 value='%s'>\n",
66         $text{'conf_to'}, $from;
67 print "</td> </tr>\n";
68
69 print "</table></td></tr></table>\n";
70 print "<input type=submit value='$text{'save'}'></form>\n";
71
72 &ui_print_footer("", $text{'index_return'});
73
74 sub ip_table
75 {
76 local @ips = split(/,/, &find_conf($_[0], $conf));
77 print "<tr> <td valign=top><b>",$text{'conf_'.$_[0]},
78       "</b></td> <td colspan=2>\n";
79 print "<textarea name=$_[0] rows=3 cols=50>",
80         join("\n", @ips),"</textarea>\n";
81 print "</td>\n";
82 if ($_[0] eq "localip") {
83         print "<td rowspan=2 valign=top>$text{'conf_ipdesc'}</td>\n";
84         }
85 print "</tr>\n";
86 }
87