]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/dial/index.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
12 # enable only the following on debugging purpose
14 #use CGI::Carp 'fatalsToBrowser';
16 require '/var/ipfire/general-functions.pl';
17 require "${General::swroot}/lang.pl";
18 require "${General::swroot}/header.pl";
29 &Header
::showhttpheaders
();
31 $cgiparams{'ACTION'} = '';
32 &Header
::getcgihash
(\
%cgiparams);
33 $pppsettings{'VALID'} = '';
34 $pppsettings{'PROFILENAME'} = 'None';
35 &General
::readhash
("${General::swroot}/ppp/settings", \
%pppsettings);
36 &General
::readhash
("${General::swroot}/modem/settings", \
%modemsettings);
37 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
38 &General
::readhash
("${General::swroot}/ddns/settings", \
%ddnssettings);
42 if ($cgiparams{'ACTION'} eq $Lang::tr
{'shutdown'}) {
44 &General
::log($Lang::tr
{'shutting down ipfire'});
45 system '/usr/local/bin/ipfirereboot down';
46 } elsif ($cgiparams{'ACTION'} eq $Lang::tr
{'reboot'}) {
48 &General
::log($Lang::tr
{'rebooting ipfire'});
49 system '/usr/local/bin/ipfirereboot boot';
52 my $connstate = &Header
::connectionstatus
();
53 if ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e
"${General::swroot}/main/refreshindex") {
54 $refresh = "<meta http-equiv='refresh' content='30;'>";
55 } elsif ($connstate =~ /$Lang::tr{'connecting'}/) {
56 $refresh = "<meta http-equiv='refresh' content='5;'>";
61 my @profilenames = ();
63 for ($c = 1; $c <= $maxprofiles; $c++)
65 my %temppppsettings = ();
66 $temppppsettings{'PROFILENAME'} = '';
67 &General
::readhash
("${General::swroot}/ppp/settings-$c", \
%temppppsettings);
68 $profilenames[$c] = $temppppsettings{'PROFILENAME'};
71 for ($c = 1; $c <= $maxprofiles; $c++) {
72 $selected{'PROFILE'}{$c} = '';
74 $selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'";
75 my $dialButtonDisabled = "disabled='disabled'";
78 &Header
::openpagewithoutmenu
($Lang::tr
{'main page'}, 1, $refresh);
79 &Header
::openbigbox
('', 'center');
80 &Header
::openbox
('100%', 'center', &Header
::cleanhtml
(`/bin/uname -n`,"y"));
82 if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
83 if (open(IPADDR
,"${General::swroot}/ddns/ipcache")) {
88 if (open(IPADDR
,"${General::swroot}/red/local-ipaddress")) {
89 my $ipaddr = <IPADDR
>;
93 } elsif ($modemsettings{'VALID'} eq 'no') {
94 print "$Lang::tr{'modem settings have errors'}\n </b></font>\n";
96 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
99 if ( $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) {
100 $ipaddr = $netsettings{'RED_ADDRESS'};
106 <td align='center'><form method='post' action="$ENV{'SCRIPT_NAME'}">
107 <input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' />
111 <!-- Table of networks -->
112 <table border='0' width=80%>
113 <tr> <th bgcolor='lightgrey'>$Lang::tr{'network'}
114 <th bgcolor='lightgrey'>IP
115 <th bgcolor='lightgrey'>$Lang::tr{'status'}
116 <tr> <td bgcolor='$Header::colourred' width='25%'><font size='2' color='white'><b>$Lang::tr{'internet'}:</b></font><br>
117 <td width='30%'>$ipaddr
118 <td width='45%'>$connstate
120 <form method='post' action='/cgi-bin/dial/dial.cgi'>$Lang::tr{'profile'}:
121 <select name='PROFILE'>
123 for ($c = 1; $c <= $maxprofiles; $c++)
125 if ($profilenames[$c] ne '') {
126 $dialButtonDisabled = "";
127 print "\t<option value='$c' $selected{'PROFILE'}{$c}>$c. $profilenames[$c]</option>\n";
130 $dialButtonDisabled = "disabled='disabled'" if (-e
'/var/run/ppp-ipcop.pid' || -e
"${General::swroot}/red/active");
131 if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
134 <input type='submit' name='ACTION' value='$Lang::tr{'dial profile'}' $dialButtonDisabled />
137 <table width='100%' border='0'>
139 <td width='50%' align='right'> <form method='post' action='/cgi-bin/dial/dial.cgi'>
140 <input type='submit' name='ACTION' value='$Lang::tr{'dial'}'>
142 <td width='50%' align='left'> <form method='post' action='/cgi-bin/dial/dial.cgi'>
143 <input type='submit' name='ACTION' value='$Lang::tr{'hangup'}'>
148 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
151 if ( $netsettings{'GREEN_DEV'} ) { print <<END;
152 <tr><td bgcolor='$Header::colourgreen' width='25%'><font size='2' color='white'><b>$Lang::tr{'lan'}:</b></font>
153 <td width='30%'>$netsettings{'GREEN_ADDRESS'}
156 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE=on` ) {
158 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT=on` ) { print " (transparent)"; }
159 } else { print "Proxy aus"; }
161 if ( $netsettings{'BLUE_DEV'} ) { print <<END;
162 <tr><td bgcolor='$Header::colourblue' width='25%'><font size='2' color='white'><b>$Lang::tr{'wireless'}:</b></font><br>
163 <td width='30%'>$netsettings{'BLUE_ADDRESS'}
166 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE_BLUE=on` ) {
168 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT_BLUE=on` ) { print " (transparent)"; }
169 } else { print "Proxy aus"; }
171 if ( $netsettings{'ORANGE_DEV'} ) { print <<END;
172 <tr><td bgcolor='$Header::colourorange' width='25%'><font size='2' color='white'><b>$Lang::tr{'dmz'}:</b></font><br>
173 <td width='30%'>$netsettings{'ORANGE_ADDRESS'}
174 <td width='45%'><font color=$Header::colourgreen>Online</font>
177 if ( `cat /var/ipfire/vpn/settings | grep ^ENABLED=on` ||
178 `cat /var/ipfire/vpn/settings | grep ^ENABLED_BLUE=on` ) {
179 my $ipsecip = `cat /var/ipfire/vpn/settings | grep ^VPN_IP= | cut -c 8-`;
181 <tr><td bgcolor='$Header::colourvpn' width='25%'><font size='2' color='white'><b>$Lang::tr{'vpn'}:</b></font><br>
182 <td width='30%'>$ipsecip
183 <td width='45%'><font color=$Header::colourgreen>Online</font>
186 if ( `cat /var/ipfire/ovpn/settings | grep ^ENABLED=on` ||
187 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_BLUE=on` ||
188 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_ORANGE=on`) {
189 my $ovpnip = `cat /var/ipfire/ovpn/settings | grep ^DOVPN_SUBNET= | cut -c 14- | sed -e 's\/\\/255.255.255.0\/\/'`;
191 <tr><td bgcolor='$Header::colourovpn' width='25%'><font size='2' color='white'><b>OpenVPN:</b></font><br>
192 <td width='30%'>$ovpnip
193 <td width='45%'><font color=$Header::colourgreen>Online</font>
196 if ( $netsettings{'DNS1'} ) { print <<END;
197 <tr><td>DNS-Server: <td>$netsettings{'DNS1'}
200 if ( $netsettings{'DNS2'} ) { print <<END;
201 <td>$netsettings{'DNS2'}
210 &Header
::openbox
('100%', 'left', $Lang::tr
{'shutdown2'});
212 if ($death == 0 && $rebirth == 0) {
214 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
217 <td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
218 <td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
228 $title = $Lang::tr
{'shutting down'};
229 $message = $Lang::tr
{'ipfire has now shutdown'};
231 $title = $Lang::tr
{'rebooting'};
232 $message = $Lang::tr
{'ipfire has now rebooted'};
235 <font size='6'><center>$message</center></font>
242 &Header
::closebigbox
();
244 &Header
::closepage
();