]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - html/cgi-bin/index.cgi
ipsec: change ipsecctrl for status and reload of charon.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / index.cgi
CommitLineData
ac1cfefa 1#!/usr/bin/perl
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
e85d32bb 5# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
ac1cfefa
MT
21
22use strict;
23
24# enable only the following on debugging purpose
cb5e9c6c
CS
25#use warnings;
26#use CGI::Carp 'fatalsToBrowser';
ac1cfefa 27
e383179b 28require '/var/ipfire/general-functions.pl';
ac1cfefa
MT
29require "${General::swroot}/lang.pl";
30require "${General::swroot}/header.pl";
2b38ab5c 31require "/opt/pakfire/lib/functions.pl";
ac1cfefa
MT
32
33my %cgiparams=();
34my %pppsettings=();
35my %modemsettings=();
36my %netsettings=();
37my %ddnssettings=();
38my $warnmessage = '';
c85ec3b4 39my $refresh = "";
e383179b 40my $ipaddr='';
ac1cfefa 41
337305ef 42
ac1cfefa
MT
43&Header::showhttpheaders();
44
45$cgiparams{'ACTION'} = '';
46&Header::getcgihash(\%cgiparams);
47$pppsettings{'VALID'} = '';
48$pppsettings{'PROFILENAME'} = 'None';
49&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
50&General::readhash("${General::swroot}/modem/settings", \%modemsettings);
51&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
52&General::readhash("${General::swroot}/ddns/settings", \%ddnssettings);
53
f2fdd0c1
CS
54my %color = ();
55my %mainsettings = ();
56&General::readhash("${General::swroot}/main/settings", \%mainsettings);
57&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
58
ac1cfefa 59my $connstate = &Header::connectionstatus();
56b7a3e2 60
e85d32bb 61 if ( -e "/var/ipfire/main/gpl-accepted" ) {
56b7a3e2
CS
62if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'} || $cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
63 $refresh = "<meta http-equiv='refresh' content='300;'>";
8a5898e7 64} elsif ($connstate =~ /$Lang::tr{'connecting'}/ || /$Lang::tr{'connection closed'}/ ){
ac1cfefa 65 $refresh = "<meta http-equiv='refresh' content='5;'>";
56b7a3e2
CS
66} elsif ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
67 $refresh = "<meta http-equiv='refresh' content='30;'>";
ac1cfefa 68}
f341a168 69}
ac1cfefa 70
957363eb
CS
71if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
72{
73 my $profile = $cgiparams{'PROFILE'};
74 my %tempcgiparams = ();
75 $tempcgiparams{'PROFILE'} = '';
76 &General::readhash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
77 \%tempcgiparams);
78
79 # make a link from the selected profile to the "default" one.
80 unlink("${General::swroot}/ppp/settings");
81 link("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
82 "${General::swroot}/ppp/settings");
83 system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings");
84
85 # read in the new params "early" so we can write secrets.
86 %cgiparams = ();
87 &General::readhash("${General::swroot}/ppp/settings", \%cgiparams);
88 $cgiparams{'PROFILE'} = $profile;
89 $cgiparams{'BACKUPPROFILE'} = $profile;
90 &General::writehash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
91 \%cgiparams);
92
93 # write secrets file.
94 open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file.";
95 flock(FILE, 2);
96 my $username = $cgiparams{'USERNAME'};
97 my $password = $cgiparams{'PASSWORD'};
98 print FILE "'$username' * '$password'\n";
99 chmod 0600, "${General::swroot}/ppp/secrets";
100 close FILE;
101
102 &General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}");
103 $cgiparams{'ACTION'} = "$Lang::tr{'dial'}";
104}
105
106if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
a56b5be4 107 system('/usr/local/bin/redctrl start > /dev/null') == 0
957363eb
CS
108 or &General::log("Dial failed: $?"); sleep 1;}
109elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
a56b5be4 110 system('/usr/local/bin/redctrl stop > /dev/null') == 0
957363eb
CS
111 or &General::log("Hangup failed: $?"); sleep 1;}
112
e383179b
MT
113my $c;
114my $maxprofiles = 5;
115my @profilenames = ();
116
117for ($c = 1; $c <= $maxprofiles; $c++)
118{
119 my %temppppsettings = ();
120 $temppppsettings{'PROFILENAME'} = '';
121 &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings);
122 $profilenames[$c] = $temppppsettings{'PROFILENAME'};
123}
124my %selected;
125for ($c = 1; $c <= $maxprofiles; $c++) {
126 $selected{'PROFILE'}{$c} = '';
127}
128$selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'";
129my $dialButtonDisabled = "disabled='disabled'";
130
131
ac1cfefa
MT
132&Header::openpage($Lang::tr{'main page'}, 1, $refresh);
133&Header::openbigbox('', 'center');
ac1cfefa 134
7fa7c7dd 135# licence agreement
0cac94cc 136if ($cgiparams{'ACTION'} eq $Lang::tr{'yes'} && $cgiparams{'gpl_accepted'} eq '1') {
7fa7c7dd
JPT
137 system('touch /var/ipfire/main/gpl_accepted')
138}
f341a168 139if ( -e "/var/ipfire/main/gpl_accepted" ) {
7fa7c7dd 140&Header::openbox('100%', 'center', &Header::cleanhtml(`/bin/uname -n`,"y"));
3489ebac
MT
141
142
a08a5f33 143if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
986e08d9
MT
144 if (open(IPADDR,"${General::swroot}/ddns/ipcache")) {
145 $ipaddr = <IPADDR>;
146 close IPADDR;
147 chomp ($ipaddr);
148 }
149 if (open(IPADDR,"${General::swroot}/red/local-ipaddress")) {
786f2c8a 150 $ipaddr = <IPADDR>;
986e08d9
MT
151 close IPADDR;
152 chomp ($ipaddr);
153 }
ac1cfefa
MT
154} elsif ($modemsettings{'VALID'} eq 'no') {
155 print "$Lang::tr{'modem settings have errors'}\n </b></font>\n";
156} else {
157 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
158}
159
3489ebac
MT
160#if ( $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) {
161# $ipaddr = $netsettings{'RED_ADDRESS'};
162#}
e383179b 163
a56b5be4
CS
164my $death = 0;
165my $rebirth = 0;
166
167if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
168 $death = 1;
169 &General::log($Lang::tr{'shutting down ipfire'});
170 system '/usr/local/bin/ipfirereboot down';
171} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
172 $rebirth = 1;
173 &General::log($Lang::tr{'rebooting ipfire'});
174 system '/usr/local/bin/ipfirereboot boot';
175}
176
177if ($death == 0 && $rebirth == 0) {
0ab4385a
JPT
178
179if ($mainsettings{'REBOOTQUESTION'} eq "off") {
180print <<END
181 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
182 <table width='100%'>
183 <tr>
184 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
185 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
186 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
187 </tr>
188 </table>
189 </form>
c853dcce
JPT
190END
191;
0ab4385a
JPT
192} else {
193 if ($cgiparams{'ACTION'} eq $Lang::tr{'reboot ask'}) {
194print <<END
195 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
196 <table width='100%'>
197 <tr>
198 <td colspan="3" align='left'><font color="red">$Lang::tr{'reboot sure'}</font></td>
199 </tr>
200 <tr>
201 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
202 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
203 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown ask'}' /></td>
204 </tr>
205 </table>
206 </form>
b4ad0027
JPT
207END
208;
0ab4385a 209 } elsif ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown ask'}) {
a56b5be4 210print <<END
0ab4385a
JPT
211 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
212 <table width='100%'>
213 <tr>
214 <td colspan="3" align='right'><font color="red">$Lang::tr{'shutdown sure'}</font></td>
215 </tr>
216 <tr>
217 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot ask'}' /></td>
218 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
219 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
220 </tr>
221 </table>
222 </form>
a56b5be4
CS
223END
224;
0ab4385a
JPT
225 } else {
226print <<END
227 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
228 <table width='100%'>
229 <tr>
230 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot ask'}' /></td>
231 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
232 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown ask'}' /></td>
233 </tr>
234 </table>
235 </form>
236END
237;
238 }
b4ad0027 239}
a56b5be4 240print <<END;
e383179b 241
0ab4385a 242
e383179b
MT
243<!-- Table of networks -->
244<table border='0' width=80%>
f2fdd0c1
CS
245 <tr> <th bgcolor='$color{'color20'}'>$Lang::tr{'network'}
246 <th bgcolor='$color{'color20'}'>IP
247 <th bgcolor='$color{'color20'}'>$Lang::tr{'status'}
33e1f48c 248 <tr> <td align='center' bgcolor='$Header::colourred' width='25%'><a href="/cgi-bin/pppsetup.cgi"><font size='2' color='white'><b>$Lang::tr{'internet'}</b></font></a><br>
c85ec3b4
CS
249 <td width='30%' align='center'>$ipaddr
250 <td width='45%' align='center'>$connstate
f3bbb213 251END
c85ec3b4 252if ( $netsettings{'RED_TYPE'} ne "STATIC" && $netsettings{'RED_TYPE'} ne "DHCP" ){
f3bbb213
MT
253print `/usr/local/bin/dialctrl.pl show`;
254print <<END;
e383179b 255 <tr><td colspan='2'>
957363eb 256 <form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'profile'}:
e383179b
MT
257 <select name='PROFILE'>
258END
259 for ($c = 1; $c <= $maxprofiles; $c++)
260 {
261 if ($profilenames[$c] ne '') {
262 $dialButtonDisabled = "";
263 print "\t<option value='$c' $selected{'PROFILE'}{$c}>$c. $profilenames[$c]</option>\n";
264 }
265 }
c6aa4ac1 266 $dialButtonDisabled = "disabled='disabled'" if (-e '/var/run/ppp-ipfire.pid' || -e "${General::swroot}/red/active");
a08a5f33 267 if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
e383179b
MT
268 print <<END;
269 </select>
270 <input type='submit' name='ACTION' value='$Lang::tr{'dial profile'}' $dialButtonDisabled />
271 </form>
272 <td align='center'>
273 <table width='100%' border='0'>
274 <tr>
957363eb 275 <td width='50%' align='right'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
e383179b
MT
276 <input type='submit' name='ACTION' value='$Lang::tr{'dial'}'>
277 </form>
957363eb 278 <td width='50%' align='left'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
e383179b
MT
279 <input type='submit' name='ACTION' value='$Lang::tr{'hangup'}'>
280 </form>
281 </table>
282END
283 } else {
284 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
285 }
c85ec3b4 286}
786f2c8a
MT
287 my $HOSTNAME = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
288 if ( "$HOSTNAME" ne "" ) {
289 print <<END;
c85ec3b4 290 <tr><td><b>Hostname:</b><td align='center'>$HOSTNAME<td>&nbsp;
786f2c8a
MT
291END
292 }
293
294 if ( -e "/var/ipfire/red/remote-ipaddress" ) {
295 my $GATEWAY = `cat /var/ipfire/red/remote-ipaddress`;
296 chomp($GATEWAY);
297 print <<END;
c85ec3b4 298 <tr><td><b>Gateway:</b><td align='center'>$GATEWAY<td>&nbsp;
786f2c8a
MT
299END
300 }
301
c6aa4ac1
MT
302 my $DNS1 = `cat /var/ipfire/red/dns1`;
303 my $DNS2 = `cat /var/ipfire/red/dns2`;
304 chomp($DNS1);
305 chomp($DNS1);
306
307 if ( $DNS1 ) { print <<END;
c85ec3b4 308 <tr><td><b>DNS-Server:</b><td align='center'>$DNS1
c6aa4ac1
MT
309END
310 }
311 if ( $DNS2 ) { print <<END;
c85ec3b4 312 <td align='center'>$DNS2
c6aa4ac1
MT
313END
314 } else { print <<END;
315 <td>&nbsp;
316END
317 }
318
072cd997 319 if ( $netsettings{'GREEN_DEV'} ) { print <<END;
33e1f48c 320 <tr><td align='center' bgcolor='$Header::colourgreen' width='25%'><a href="/cgi-bin/dhcp.cgi"><font size='2' color='white'><b>$Lang::tr{'lan'}</b></font></a>
c85ec3b4
CS
321 <td width='30%' align='center'>$netsettings{'GREEN_ADDRESS'}
322 <td width='45%' align='center'>
e383179b 323END
072cd997 324 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE=on` ) {
ef482d53 325 print $Lang::tr{'advproxy on'};
072cd997 326 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT=on` ) { print " (transparent)"; }
ef482d53 327 } else { print $Lang::tr{'advproxy off'}; }
072cd997
MT
328 }
329 if ( $netsettings{'BLUE_DEV'} ) { print <<END;
33e1f48c 330 <tr><td align='center' bgcolor='$Header::colourblue' width='25%'><a href="/cgi-bin/wireless.cgi"><font size='2' color='white'><b>$Lang::tr{'wireless'}</b></font></a><br>
c85ec3b4
CS
331 <td width='30%' align='center'>$netsettings{'BLUE_ADDRESS'}
332 <td width='45%' align='center'>
e383179b 333END
072cd997 334 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE_BLUE=on` ) {
ef482d53 335 print $Lang::tr{'advproxy on'};
072cd997 336 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT_BLUE=on` ) { print " (transparent)"; }
ef482d53 337 } else { print $Lang::tr{'advproxy off'}; }
072cd997 338 }
39a7cc11 339 if ( $netsettings{'ORANGE_DEV'} ) { print <<END;
33e1f48c 340 <tr><td align='center' bgcolor='$Header::colourorange' width='25%'><a href="/cgi-bin/dmzholes.cgi"><font size='2' color='white'><b>$Lang::tr{'dmz'}</b></font></a><br>
c85ec3b4
CS
341 <td width='30%' align='center'>$netsettings{'ORANGE_ADDRESS'}
342 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
e383179b 343END
072cd997 344 }
39a7cc11
MT
345 if ( `cat /var/ipfire/vpn/settings | grep ^ENABLED=on` ||
346 `cat /var/ipfire/vpn/settings | grep ^ENABLED_BLUE=on` ) {
072cd997 347 my $ipsecip = `cat /var/ipfire/vpn/settings | grep ^VPN_IP= | cut -c 8-`;
db073a10 348 my @status = `/usr/local/bin/ipsecctrl I`;
e455cafe
MT
349 my %confighash = ();
350 &General::readhasharray("${General::swroot}/vpn/config", \%confighash);
072cd997 351 print <<END;
33e1f48c 352 <tr><td align='center' bgcolor='$Header::colourvpn' width='25%'><a href="/cgi-bin/vpnmain.cgi"><font size='2' color='white'><b>$Lang::tr{'vpn'}</b></font></a><br>
c85ec3b4
CS
353 <td width='30%' align='center'>$ipsecip
354 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
e383179b 355END
e455cafe
MT
356 my $id = 0;
357 my $gif;
358 foreach my $key (keys %confighash) {
359 if ($confighash{$key}[0] eq 'on') { $gif = 'on.gif'; } else { $gif = 'off.gif'; }
360
361 if ($id % 2) {
9a2a723e 362 print "<tr><td align='left' nowrap='nowrap' bgcolor='$color{'color20'}'>$confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")</td><td align='center'>$confighash{$key}[11]</td>";
e455cafe 363 } else {
9a2a723e 364 print "<tr></td><td align='left' nowrap='nowrap' bgcolor='$color{'color22'}'>$confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")</td><td align='center'>$confighash{$key}[11]</td>";
e455cafe 365 }
fe6cda92 366
e455cafe
MT
367 my $active = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourred}' width='100%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'capsclosed'}</font></b></td></tr></table>";
368 if ($confighash{$key}[0] eq 'off') {
369 $active = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourblue}' width='100%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'capsclosed'}</font></b></td></tr></table>";
370 } else {
371 foreach my $line (@status) {
372 if ($line =~ /\"$confighash{$key}[1]\".*IPsec SA established/) {
f2fdd0c1 373 $active = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourgreen}' width='100%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'capsopen'}</font></b></td></tr></table>";
e455cafe
MT
374 }
375 }
376 }
377 print "<td align='center'>$active</td>";
378 }
072cd997
MT
379 }
380 if ( `cat /var/ipfire/ovpn/settings | grep ^ENABLED=on` ||
381 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_BLUE=on` ||
382 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_ORANGE=on`) {
383 my $ovpnip = `cat /var/ipfire/ovpn/settings | grep ^DOVPN_SUBNET= | cut -c 14- | sed -e 's\/\\/255.255.255.0\/\/'`;
384 print <<END;
33e1f48c 385 <tr><td align='center' bgcolor='$Header::colourovpn' width='25%'><a href="/cgi-bin/ovpnmain.cgi"><font size='2' color='white'><b>OpenVPN</b></font></a><br>
c85ec3b4
CS
386 <td width='30%' align='center'>$ovpnip
387 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
072cd997
MT
388END
389 }
ac1cfefa 390
579a39d0
MT
391# Fireinfo
392if ( ! -e "/var/ipfire/main/send_profile") {
393 $warnmessage .= "<li><a style='color: white;' href='fireinfo.cgi'>$Lang::tr{'fireinfo please enable'}</a></li>";
394}
395
ac1cfefa
MT
396# Memory usage warning
397my @free = `/usr/bin/free`;
398$free[1] =~ m/(\d+)/;
399my $mem = $1;
400$free[2] =~ m/(\d+)/;
401my $used = $1;
402my $pct = int 100 * ($mem - $used) / $mem;
403if ($used / $mem > 90) {
404 $warnmessage .= "<li> $Lang::tr{'high memory usage'}: $pct% !</li>\n";
405}
406
407# Diskspace usage warning
408my @temp=();
409my $temp2=();
8955b5a7 410my @df = `/bin/df -B M -P -x rootfs`;
ac1cfefa
MT
411foreach my $line (@df) {
412 next if $line =~ m/^Filesystem/;
413 if ($line =~ m/root/ ) {
414 $line =~ m/^.* (\d+)M.*$/;
415 @temp = split(/ +/,$line);
416 if ($1<5) {
417 # available:plain value in MB, and not %used as 10% is too much to waste on small disk
418 # and root size should not vary during time
62f1526a 419 $warnmessage .= "<li> $Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$1M</b> !</li>\n";
ac1cfefa
MT
420 }
421
422 } else {
423 # $line =~ m/^.* (\d+)m.*$/;
424 $line =~ m/^.* (\d+)\%.*$/;
425 if ($1>90) {
426 @temp = split(/ /,$line);
427 $temp2=int(100-$1);
62f1526a 428 $warnmessage .= "<li> $Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$temp2%</b> !</li>\n";
ac1cfefa
MT
429 }
430 }
431}
432
c1712013 433# S.M.A.R.T. health warning
73c7eff8 434my @files = `/bin/ls /var/run/smartctl_out_hddtemp-* 2>/dev/null`;
c1712013
AF
435foreach my $file (@files) {
436 chomp ($file);
437 my $disk=`echo $file | cut -d"-" -f2`;
438 chomp ($disk);
439 if (`/bin/grep "SAVE ALL DATA" $file`) {
62f1526a 440 $warnmessage .= "<li> $Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !</li>\n\n";
c1712013
AF
441 }
442}
443
ac1cfefa 444if ($warnmessage) {
02dc0a76 445 print "<tr><td align='center' bgcolor=$Header::colourred colspan='3'><font color='white'>$warnmessage</font></table>";
ac1cfefa 446}
02dc0a76
MT
447print <<END;
448</table>
2b38ab5c
JPT
449END
450;
451&Pakfire::dblist("upgrade", "notice");
452print <<END;
02dc0a76 453END
f341a168 454if ( -e "/var/run/need_reboot" ) {
7274a673 455 print "<br /><br /><font color='red'>$Lang::tr{'needreboot'}!</font>";
337305ef 456}
8de160ff
MT
457} else {
458 my $message='';
459 if ($death) {
460 $message = $Lang::tr{'ipfire has now shutdown'};
461 } else {
462 $message = $Lang::tr{'ipfire has now rebooted'};
463 }
464 print <<END
465<div align='center'>
466<table width='100%' bgcolor='#ffffff'>
467<tr><td align='center'>
94ec137d 468<br /><br /><img src='/images/IPFire.png' /><br /><br /><br />
8de160ff
MT
469</td></tr>
470</table>
471<br />
472<font size='6'>$message</font>
473</div>
474END
475;
b4ad0027
JPT
476
477}
478
ac1cfefa 479&Header::closebox();
7fa7c7dd
JPT
480}
481
482else {
483&Header::openbox('100%', 'left', $Lang::tr{'gpl license agreement'});
484print <<END;
7fa7c7dd
JPT
485 $Lang::tr{'gpl please read carefully the general public license and accept it below'}.
486 <br /><br />
7274a673
JPT
487END
488;
f341a168 489if ( -e "/usr/share/doc/licenses/GPLv3" ) {
7274a673
JPT
490 print '<textarea rows=\'25\' cols=\'75\' readonly=\'true\'>';
491 print `cat /usr/share/doc/licenses/GPLv3`;
92209271 492 print '</textarea>';
7274a673
JPT
493}
494else {
92209271 495 print '<br /><a href=\'http://www.gnu.org/licenses/gpl-3.0.txt\' target=\'_blank\'>GNU GENERAL PUBLIC LICENSE</a><br />';
7274a673
JPT
496}
497print <<END;
7fa7c7dd
JPT
498 <p>
499 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
500 <input type='checkbox' name='gpl_accepted' value='1'/> $Lang::tr{'gpl i accept these terms and conditions'}.
501 <br/ >
502 <input type='submit' name='ACTION' value=$Lang::tr{'yes'} />
503 </form>
504 </p>
7274a673 505 <a href='http://www.gnu.org/licenses/translations.html' target='_blank'>$Lang::tr{'gpl unofficial translation of the general public license v3'}</a>
7fa7c7dd
JPT
506
507END
508
509&Header::closebox();
510}
511
ac1cfefa 512&Header::closebigbox();
ac1cfefa 513&Header::closepage();