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