]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/index.cgi
Merge remote-tracking branch 'ms/thirteen' into kernel-update
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / index.cgi
1 #!/usr/bin/perl
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
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 ###############################################################################
21
22 use strict;
23 use Net::Telnet;
24
25 # enable only the following on debugging purpose
26 #use warnings;
27 #use CGI::Carp 'fatalsToBrowser';
28
29 require '/var/ipfire/general-functions.pl';
30 require "${General::swroot}/lang.pl";
31 require "${General::swroot}/header.pl";
32 require "/opt/pakfire/lib/functions.pl";
33
34 my %cgiparams=();
35 my %pppsettings=();
36 my %modemsettings=();
37 my %netsettings=();
38 my %ddnssettings=();
39 my $warnmessage = '';
40 my $refresh = "";
41 my $ipaddr='';
42
43
44 &Header::showhttpheaders();
45
46 $cgiparams{'ACTION'} = '';
47 &Header::getcgihash(\%cgiparams);
48 $pppsettings{'VALID'} = '';
49 $pppsettings{'PROFILENAME'} = 'None';
50 &General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
51 &General::readhash("${General::swroot}/modem/settings", \%modemsettings);
52 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
53 &General::readhash("${General::swroot}/ddns/settings", \%ddnssettings);
54
55 my %color = ();
56 my %mainsettings = ();
57 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
58 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
59
60 my $connstate = &Header::connectionstatus();
61
62 if ( -e "/var/ipfire/main/gpl-accepted" ) {
63 if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'} || $cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
64 $refresh = "<meta http-equiv='refresh' content='300;'>";
65 } elsif ($connstate =~ /$Lang::tr{'connecting'}/ || /$Lang::tr{'connection closed'}/ ){
66 $refresh = "<meta http-equiv='refresh' content='5;'>";
67 } elsif ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
68 $refresh = "<meta http-equiv='refresh' content='30;'>";
69 }
70 }
71
72 if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
73 {
74 my $profile = $cgiparams{'PROFILE'};
75 my %tempcgiparams = ();
76 $tempcgiparams{'PROFILE'} = '';
77 &General::readhash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
78 \%tempcgiparams);
79
80 # make a link from the selected profile to the "default" one.
81 unlink("${General::swroot}/ppp/settings");
82 link("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
83 "${General::swroot}/ppp/settings");
84 system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings");
85
86 # read in the new params "early" so we can write secrets.
87 %cgiparams = ();
88 &General::readhash("${General::swroot}/ppp/settings", \%cgiparams);
89 $cgiparams{'PROFILE'} = $profile;
90 $cgiparams{'BACKUPPROFILE'} = $profile;
91 &General::writehash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
92 \%cgiparams);
93
94 # write secrets file.
95 open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file.";
96 flock(FILE, 2);
97 my $username = $cgiparams{'USERNAME'};
98 my $password = $cgiparams{'PASSWORD'};
99 print FILE "'$username' * '$password'\n";
100 chmod 0600, "${General::swroot}/ppp/secrets";
101 close FILE;
102
103 &General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}");
104 $cgiparams{'ACTION'} = "$Lang::tr{'dial'}";
105 }
106
107 if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
108 system('/usr/local/bin/redctrl start > /dev/null') == 0
109 or &General::log("Dial failed: $?"); sleep 1;}
110 elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
111 system('/usr/local/bin/redctrl stop > /dev/null') == 0
112 or &General::log("Hangup failed: $?"); sleep 1;}
113
114 my $c;
115 my $maxprofiles = 5;
116 my @profilenames = ();
117
118 for ($c = 1; $c <= $maxprofiles; $c++)
119 {
120 my %temppppsettings = ();
121 $temppppsettings{'PROFILENAME'} = '';
122 &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings);
123 $profilenames[$c] = $temppppsettings{'PROFILENAME'};
124 }
125 my %selected;
126 for ($c = 1; $c <= $maxprofiles; $c++) {
127 $selected{'PROFILE'}{$c} = '';
128 }
129 $selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'";
130 my $dialButtonDisabled = "disabled='disabled'";
131
132
133 &Header::openpage($Lang::tr{'main page'}, 1, $refresh);
134 &Header::openbigbox('', 'center');
135
136 # licence agreement
137 if ($cgiparams{'ACTION'} eq $Lang::tr{'yes'} && $cgiparams{'gpl_accepted'} eq '1') {
138 system('touch /var/ipfire/main/gpl_accepted')
139 }
140 if ( -e "/var/ipfire/main/gpl_accepted" ) {
141 &Header::openbox('100%', 'center', &Header::cleanhtml(`/bin/uname -n`,"y"));
142
143
144 if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
145 if (open(IPADDR,"${General::swroot}/ddns/ipcache")) {
146 $ipaddr = <IPADDR>;
147 close IPADDR;
148 chomp ($ipaddr);
149 }
150 if (open(IPADDR,"${General::swroot}/red/local-ipaddress")) {
151 $ipaddr = <IPADDR>;
152 close IPADDR;
153 chomp ($ipaddr);
154 }
155 } elsif ($modemsettings{'VALID'} eq 'no') {
156 print "$Lang::tr{'modem settings have errors'}\n </b></font>\n";
157 } else {
158 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
159 }
160
161 #if ( $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) {
162 # $ipaddr = $netsettings{'RED_ADDRESS'};
163 #}
164
165 my $death = 0;
166 my $rebirth = 0;
167
168 if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
169 $death = 1;
170 &General::log($Lang::tr{'shutting down ipfire'});
171 system '/usr/local/bin/ipfirereboot down';
172 } elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
173 $rebirth = 1;
174 &General::log($Lang::tr{'rebooting ipfire'});
175 system '/usr/local/bin/ipfirereboot boot';
176 }
177
178 if ($death == 0 && $rebirth == 0) {
179
180 if ($mainsettings{'REBOOTQUESTION'} eq "off") {
181 print <<END
182 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
183 <table width='100%'>
184 <tr>
185 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
186 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
187 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
188 </tr>
189 </table>
190 </form>
191 END
192 ;
193 } else {
194 if ($cgiparams{'ACTION'} eq $Lang::tr{'reboot ask'}) {
195 print <<END
196 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
197 <table width='100%'>
198 <tr>
199 <td colspan="3" align='left'><font color="red">$Lang::tr{'reboot sure'}</font></td>
200 </tr>
201 <tr>
202 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
203 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
204 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown ask'}' /></td>
205 </tr>
206 </table>
207 </form>
208 END
209 ;
210 } elsif ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown ask'}) {
211 print <<END
212 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
213 <table width='100%'>
214 <tr>
215 <td colspan="3" align='right'><font color="red">$Lang::tr{'shutdown sure'}</font></td>
216 </tr>
217 <tr>
218 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot ask'}' /></td>
219 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
220 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
221 </tr>
222 </table>
223 </form>
224 END
225 ;
226 } else {
227 print <<END
228 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
229 <table width='100%'>
230 <tr>
231 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot ask'}' /></td>
232 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
233 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown ask'}' /></td>
234 </tr>
235 </table>
236 </form>
237 END
238 ;
239 }
240 }
241 print <<END;
242
243
244 <!-- Table of networks -->
245 <table border='0' width=80%>
246 <tr> <th bgcolor='$color{'color20'}'>$Lang::tr{'network'}
247 <th bgcolor='$color{'color20'}'>IP
248 <th bgcolor='$color{'color20'}'>$Lang::tr{'status'}
249 <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>
250 <td width='30%' align='center'>$ipaddr
251 <td width='45%' align='center'>$connstate
252 END
253 if ( $netsettings{'RED_TYPE'} ne "STATIC" && $netsettings{'RED_TYPE'} ne "DHCP" ){
254 print `/usr/local/bin/dialctrl.pl show`;
255 print <<END;
256 <tr><td colspan='2'>
257 <form method='post' action='$ENV{'SCRIPT_NAME'}'>$Lang::tr{'profile'}:
258 <select name='PROFILE'>
259 END
260 for ($c = 1; $c <= $maxprofiles; $c++)
261 {
262 if ($profilenames[$c] ne '') {
263 $dialButtonDisabled = "";
264 print "\t<option value='$c' $selected{'PROFILE'}{$c}>$c. $profilenames[$c]</option>\n";
265 }
266 }
267 $dialButtonDisabled = "disabled='disabled'" if (-e '/var/run/ppp-ipfire.pid' || -e "${General::swroot}/red/active");
268 if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
269 print <<END;
270 </select>
271 <input type='submit' name='ACTION' value='$Lang::tr{'dial profile'}' $dialButtonDisabled />
272 </form>
273 <td align='center'>
274 <table width='100%' border='0'>
275 <tr>
276 <td width='50%' align='right'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
277 <input type='submit' name='ACTION' value='$Lang::tr{'dial'}'>
278 </form>
279 <td width='50%' align='left'> <form method='post' action='$ENV{'SCRIPT_NAME'}'>
280 <input type='submit' name='ACTION' value='$Lang::tr{'hangup'}'>
281 </form>
282 </table>
283 END
284 } else {
285 print "$Lang::tr{'profile has errors'}\n </b></font>\n";
286 }
287 }
288 my $HOSTNAME = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
289 if ( "$HOSTNAME" ne "" ) {
290 print <<END;
291 <tr><td><b>Hostname:</b><td align='center'>$HOSTNAME<td>&nbsp;
292 END
293 }
294
295 if ( -e "/var/ipfire/red/remote-ipaddress" ) {
296 my $GATEWAY = `cat /var/ipfire/red/remote-ipaddress`;
297 chomp($GATEWAY);
298 print <<END;
299 <tr><td><b>Gateway:</b><td align='center'>$GATEWAY<td>&nbsp;
300 END
301 }
302
303 my $DNS1 = `cat /var/ipfire/red/dns1`;
304 my $DNS2 = `cat /var/ipfire/red/dns2`;
305 chomp($DNS1);
306 chomp($DNS1);
307
308 if ( $DNS1 ) { print <<END;
309 <tr><td><b>DNS-Server:</b><td align='center'>$DNS1
310 END
311 }
312 if ( $DNS2 ) { print <<END;
313 <td align='center'>$DNS2
314 END
315 } else { print <<END;
316 <td>&nbsp;
317 END
318 }
319
320 if ( $netsettings{'GREEN_DEV'} ) { print <<END;
321 <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>
322 <td width='30%' align='center'>$netsettings{'GREEN_ADDRESS'}
323 <td width='45%' align='center'>
324 END
325 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE=on` ) {
326 print $Lang::tr{'advproxy on'};
327 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT=on` ) { print " (transparent)"; }
328 } else { print $Lang::tr{'advproxy off'}; }
329 }
330 if ( $netsettings{'BLUE_DEV'} ) { print <<END;
331 <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>
332 <td width='30%' align='center'>$netsettings{'BLUE_ADDRESS'}
333 <td width='45%' align='center'>
334 END
335 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE_BLUE=on` ) {
336 print $Lang::tr{'advproxy on'};
337 if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT_BLUE=on` ) { print " (transparent)"; }
338 } else { print $Lang::tr{'advproxy off'}; }
339 }
340 if ( $netsettings{'ORANGE_DEV'} ) { print <<END;
341 <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>
342 <td width='30%' align='center'>$netsettings{'ORANGE_ADDRESS'}
343 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
344 END
345 }
346 if ( `cat /var/ipfire/vpn/settings | grep ^ENABLED=on` ||
347 `cat /var/ipfire/vpn/settings | grep ^ENABLED_BLUE=on` ) {
348 my $ipsecip = `cat /var/ipfire/vpn/settings | grep ^VPN_IP= | cut -c 8-`;
349 my @status = `/usr/local/bin/ipsecctrl I`;
350 my %confighash = ();
351 &General::readhasharray("${General::swroot}/vpn/config", \%confighash);
352 print <<END;
353 <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>
354 <td width='30%' align='center'>$ipsecip
355 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
356 END
357 my $id = 0;
358 my $gif;
359 foreach my $key (sort { uc($confighash{$a}[1]) cmp uc($confighash{$b}[1]) } keys %confighash) {
360 if ($confighash{$key}[0] eq 'on') { $gif = 'on.gif'; } else { $gif = 'off.gif'; }
361
362 if ($id % 2) {
363 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>";
364 } else {
365 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>";
366 }
367
368 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>";
369 if ($confighash{$key}[0] eq 'off') {
370 $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>";
371 } else {
372 foreach my $line (@status) {
373 if (($line =~ /\"$confighash{$key}[1]\".*IPsec SA established/) ||
374 ($line =~/$confighash{$key}[1]\{.*INSTALLED/ ))
375 {
376 $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>";
377 }
378 }
379 }
380 print "<td align='center'>$active</td>";
381 }
382 }
383 if ( `cat /var/ipfire/ovpn/settings | grep ^ENABLED=on` ||
384 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_BLUE=on` ||
385 `cat /var/ipfire/ovpn/settings | grep ^ENABLED_ORANGE=on`) {
386 my $ovpnip = `cat /var/ipfire/ovpn/settings | grep ^DOVPN_SUBNET= | cut -c 14- | sed -e 's\/\\/255.255.255.0\/\/'`;
387 print <<END;
388 <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>
389 <td width='30%' align='center'>$ovpnip
390 <td width='45%' align='center'><font color=$Header::colourgreen>Online</font>
391
392 END
393
394 }
395
396 ###
397 # m.a.d n2n
398 ###
399
400 if ( -d "${General::swroot}/ovpn/n2nconf") {
401 my %confighash=();
402 my $display = '';
403
404 &General::readhasharray("${General::swroot}/ovpn/ovpnconfig", \%confighash);
405 foreach my $dkey (keys %confighash) {
406 if ($confighash{$dkey}[3] eq 'net') {
407
408
409 if (-e "/var/run/$confighash{$dkey}[1]n2n.pid") {
410 my @output = "";
411 my @tustate = "";
412 my $tport = $confighash{$dkey}[22];
413 my $tnet = new Net::Telnet ( Timeout=>5, Errmode=>'return', Port=>$tport);
414 if ($tport ne '') {
415 $tnet->open('127.0.0.1');
416 @output = $tnet->cmd(String => 'state', Prompt => '/(END.*\n|ERROR:.*\n)/');
417 @tustate = split(/\,/, $output[1]);
418 if ( $tustate[1] eq 'CONNECTED')
419 { $display = "<font color=$Header::colourgreen>$Lang::tr{'capsopen'}</font>";
420 } else {
421 $display = "<font color=$Header::colourred>$tustate[1]</font>"; }
422
423 print <<END;
424 <tr><td align='center' bgcolor='$Header::colourovpn' width='25%'><a href="/cgi-bin/ovpnmain.cgi"><font size='2' color='white'><b>OpenVPN n2n</b></font></a><br>
425 <td width='30%' align='center'> $confighash{$dkey}[10]<td width='45%' align='center'> $display
426
427 END
428 ;
429 }
430 }
431 }
432 }
433 }
434
435 ###
436 # m.a.d n2n end
437 ###
438
439 # Fireinfo
440 if ( ! -e "/var/ipfire/main/send_profile") {
441 $warnmessage .= "<li><a style='color: white;' href='fireinfo.cgi'>$Lang::tr{'fireinfo please enable'}</a></li>";
442 }
443
444 # Memory usage warning
445 my @free = `/usr/bin/free`;
446 $free[1] =~ m/(\d+)/;
447 my $mem = $1;
448 $free[2] =~ m/(\d+)/;
449 my $used = $1;
450 my $pct = int 100 * ($mem - $used) / $mem;
451 if ($used / $mem > 90) {
452 $warnmessage .= "<li> $Lang::tr{'high memory usage'}: $pct% !</li>\n";
453 }
454
455 # Diskspace usage warning
456 my @temp=();
457 my $temp2=();
458 my @df = `/bin/df -B M -P -x rootfs`;
459 foreach my $line (@df) {
460 next if $line =~ m/^Filesystem/;
461 if ($line =~ m/root/ ) {
462 $line =~ m/^.* (\d+)M.*$/;
463 @temp = split(/ +/,$line);
464 if ($1<5) {
465 # available:plain value in MB, and not %used as 10% is too much to waste on small disk
466 # and root size should not vary during time
467 $warnmessage .= "<li> $Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$1M</b> !</li>\n";
468 }
469
470 } else {
471 # $line =~ m/^.* (\d+)m.*$/;
472 $line =~ m/^.* (\d+)\%.*$/;
473 if ($1>90) {
474 @temp = split(/ /,$line);
475 $temp2=int(100-$1);
476 $warnmessage .= "<li> $Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$temp2%</b> !</li>\n";
477 }
478 }
479 }
480
481 # S.M.A.R.T. health warning
482 my @files = `/bin/ls /var/run/smartctl_out_hddtemp-* 2>/dev/null`;
483 foreach my $file (@files) {
484 chomp ($file);
485 my $disk=`echo $file | cut -d"-" -f2`;
486 chomp ($disk);
487 if (`/bin/grep "SAVE ALL DATA" $file`) {
488 $warnmessage .= "<li> $Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !</li>\n\n";
489 }
490 }
491
492 # Reiser4 warning
493 my @files = `mount | grep " reiser4 (" 2>/dev/null`;
494 foreach my $disk (@files) {
495 chomp ($disk);
496 $warnmessage .= "<li>$disk - $Lang::tr{'deprecated fs warn'}</li>\n\n";
497 }
498
499
500 if ($warnmessage) {
501 print "<tr><td align='center' bgcolor=$Header::colourred colspan='3'><font color='white'>$warnmessage</font></table>";
502 }
503 print <<END;
504 </table>
505 END
506 ;
507 &Pakfire::dblist("upgrade", "notice");
508 print <<END;
509 END
510 if ( -e "/var/run/need_reboot" ) {
511 print "<br /><br /><font color='red'>$Lang::tr{'needreboot'}!</font>";
512 }
513 } else {
514 my $message='';
515 if ($death) {
516 $message = $Lang::tr{'ipfire has now shutdown'};
517 } else {
518 $message = $Lang::tr{'ipfire has now rebooted'};
519 }
520 print <<END
521 <div align='center'>
522 <table width='100%' bgcolor='#ffffff'>
523 <tr><td align='center'>
524 <br /><br /><img src='/images/IPFire.png' /><br /><br /><br />
525 </td></tr>
526 </table>
527 <br />
528 <font size='6'>$message</font>
529 </div>
530 END
531 ;
532
533 }
534
535 &Header::closebox();
536 }
537
538 else {
539 &Header::openbox('100%', 'left', $Lang::tr{'gpl license agreement'});
540 print <<END;
541 $Lang::tr{'gpl please read carefully the general public license and accept it below'}.
542 <br /><br />
543 END
544 ;
545 if ( -e "/usr/share/doc/licenses/GPLv3" ) {
546 print '<textarea rows=\'25\' cols=\'75\' readonly=\'true\'>';
547 print `cat /usr/share/doc/licenses/GPLv3`;
548 print '</textarea>';
549 }
550 else {
551 print '<br /><a href=\'http://www.gnu.org/licenses/gpl-3.0.txt\' target=\'_blank\'>GNU GENERAL PUBLIC LICENSE</a><br />';
552 }
553 print <<END;
554 <p>
555 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
556 <input type='checkbox' name='gpl_accepted' value='1'/> $Lang::tr{'gpl i accept these terms and conditions'}.
557 <br/ >
558 <input type='submit' name='ACTION' value=$Lang::tr{'yes'} />
559 </form>
560 </p>
561 <a href='http://www.gnu.org/licenses/translations.html' target='_blank'>$Lang::tr{'gpl unofficial translation of the general public license v3'}</a>
562
563 END
564
565 &Header::closebox();
566 }
567
568 &Header::closebigbox();
569 &Header::closepage();