]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/fireinfo.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2011 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 use CGI
::Carp
'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
32 my $configfile = "/var/ipfire/main/send_profile";
34 my %fireinfosettings=();
37 &Header
::showhttpheaders
();
39 $fireinfosettings{'ENABLE_FIREINFO'} = 'off';
40 $fireinfosettings{'ACTION'} = '';
42 &Header
::getcgihash
(\
%fireinfosettings);
44 if ( -e
"$configfile" ) {
45 $fireinfosettings{'ENABLE_FIREINFO'} = 'on';
48 if ("$fireinfosettings{'ACTION'}" eq "trigger") {
49 if ($fireinfosettings{'ENABLE_FIREINFO'} eq 'off') {
50 &General
::log($Lang::tr
{'fireinfo is enabled'});
51 system ('/usr/bin/touch', $configfile);
52 $fireinfosettings{'ENABLE_FIREINFO'} = 'on';
54 &General
::log($Lang::tr
{'fireinfo is disabled'});
56 $fireinfosettings{'ENABLE_FIREINFO'} = 'off';
58 system("/usr/local/bin/fireinfoctrl &");
61 &Header
::openpage
('Fireinfo', 1, '');
63 if ($fireinfosettings{'ENABLE_FIREINFO'} ne "on") {
64 &Header
::openbox
("100%", "left", "$Lang::tr{'fireinfo why enable'}");
67 <font color="$Header::colourred">
69 $Lang::tr{'fireinfo why descr1'}
70 $Lang::tr{'fireinfo why descr2'}<a href="http://fireinfo.ipfire.org" target="_blank">$Lang::tr{'fireinfo why read more'}</a>
78 &Header
::openbigbox
('100%', 'left', '', $errormessage);
81 &Header
::openbox
('100%', 'left', "$Lang::tr{'error messages'}");
82 print "<FONT CLASS='base'>$errormessage </FONT>\n";
86 my $ipfire_version = `cat /etc/system-release`;
87 my $pakfire_version = `cat /opt/pakfire/etc/pakfire.conf | grep "version =" | cut -d\\" -f2`;
88 my $kernel_version = `uname -a`;
90 &Header
::openbox
('100%', 'left', $Lang::tr
{'fireinfo system version'});
94 <td>$Lang::tr{'fireinfo ipfire version'}:</td>
95 <td>$ipfire_version</td>
98 <td>$Lang::tr{'fireinfo pakfire version'}:</td>
99 <td>$pakfire_version</td>
102 <td>$Lang::tr{'fireinfo kernel version'}:</td>
103 <td>$kernel_version</td>
109 # Read pregenerated profile data
110 my $profile = `cat /var/ipfire/fireinfo/profile`;
112 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
114 # Read profile ID from file
115 my $profile_id = `cat /var/ipfire/fireinfo/public_id`;
118 &Header
::openbox
('100%', 'left', $Lang::tr
{'fireinfo settings'});
120 <input type='hidden' name='ACTION' value='trigger' />
123 <td>$Lang::tr{'fireinfo your profile id'}:</td>
125 <a href="http://fireinfo.ipfire.org/profile/$profile_id" target="_blank">$profile_id</a>
130 <td colspan="2"> </td>
136 if ($fireinfosettings{'ENABLE_FIREINFO'} eq "on") {
137 print "<font color='$Header::colourgreen'>$Lang::tr{'fireinfo is submitted'}</font>";
139 print "<font color='$Header::colourred'>$Lang::tr{'fireinfo not submitted'}</font>";
144 if ($fireinfosettings{'ENABLE_FIREINFO'} eq "on") {
145 print "<input type='submit' name='submit' value=\"$Lang::tr{'fireinfo is submitted button'}\" />";
147 print "<input type='submit' name='submit' value=\"$Lang::tr{'fireinfo not submitted button'}\" />";
155 <td colspan="2"><font color='$Header::colourgreen'> </font></td>
159 <textarea rows="25" cols="75" readonly="true">$profile</textarea>
168 &Header
::closebigbox
();
169 &Header
::closepage
();