]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/fireinfo.cgi
99952be2ebb91ac7f0101e43e7bbd906e8ef90cd
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";
31 require '/opt/pakfire/lib/functions.pl';
33 my $configfile = "/var/ipfire/main/send_profile";
35 my %fireinfosettings=();
38 &Header
::showhttpheaders
();
40 $fireinfosettings{'ENABLE_FIREINFO'} = 'off';
41 $fireinfosettings{'ACTION'} = '';
43 &Header
::getcgihash
(\
%fireinfosettings);
45 if ( -e
"$configfile" ) {
46 $fireinfosettings{'ENABLE_FIREINFO'} = 'on';
49 if ("$fireinfosettings{'ACTION'}" eq "trigger") {
50 if ($fireinfosettings{'ENABLE_FIREINFO'} eq 'off') {
51 &General
::log($Lang::tr
{'fireinfo is enabled'});
53 # Write empty configfile.
54 open(FILE
, ">$configfile");
57 $fireinfosettings{'ENABLE_FIREINFO'} = 'on';
59 &General
::log($Lang::tr
{'fireinfo is disabled'});
61 $fireinfosettings{'ENABLE_FIREINFO'} = 'off';
63 &General
::system_background
("/usr/local/bin/fireinfoctrl");
66 &Header
::openpage
('Fireinfo', 1, '');
68 if ($fireinfosettings{'ENABLE_FIREINFO'} ne "on") {
69 &Header
::openbox
("100%", "left", "$Lang::tr{'fireinfo why enable'}");
72 <font color="$Header::colourred">
74 $Lang::tr{'fireinfo why descr1'}
75 $Lang::tr{'fireinfo why descr2'}<a href="https://fireinfo.ipfire.org" target="_blank">$Lang::tr{'fireinfo why read more'}</a>
83 &Header
::openbigbox
('100%', 'left', '', $errormessage);
86 &Header
::openbox
('100%', 'left', "$Lang::tr{'error messages'}");
87 print "<font class='base'>$errormessage </font>\n";
91 # Get IPFire version string.
92 open(FILE
, "/etc/system-release");
93 my $ipfire_version = <FILE
>;
96 my $pakfire_version = &Pakfire
::make_version
();
97 my $kernel_version = &General
::system_output
("uname", "-a");
99 &Header
::openbox
('100%', 'left', $Lang::tr
{'fireinfo system version'});
101 <table cellspacing='1' cellpadding='0' class='tbl'>
103 <td align='center' bgcolor='#F0F0F0' width='15%'>$Lang::tr{'fireinfo ipfire version'}</td>
104 <td bgcolor='#F0F0F0'><code>$ipfire_version</code></td>
107 <td align='center' bgcolor='#D6D6D6' width='15%'>$Lang::tr{'fireinfo pakfire version'}</td>
108 <td bgcolor='#D6D6D6'><code>$pakfire_version</code></td>
111 <td align='center' bgcolor='#F0F0F0' width='15%'>$Lang::tr{'fireinfo kernel version'}</td>
112 <td bgcolor='#F0F0F0'><code>$kernel_version</code></td>
118 # Read pregenerated profile data
119 open(FILE
, "/var/ipfire/fireinfo/profile");
120 my $profile = <FILE
>;
124 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
126 # Read profile ID from file
127 open(FILE
, "/var/ipfire/fireinfo/public_id");
128 my $profile_id = <FILE
>;
132 &Header
::openbox
('100%', 'left', $Lang::tr
{'fireinfo settings'});
134 <input type='hidden' name='ACTION' value='trigger' />
137 <td>$Lang::tr{'fireinfo your profile id'}:</td>
139 <a href="https://fireinfo.ipfire.org/profile/$profile_id" target="_blank">$profile_id</a>
144 <td colspan="2"> </td>
150 if ($fireinfosettings{'ENABLE_FIREINFO'} eq "on") {
151 print "<font color='$Header::colourgreen'>$Lang::tr{'fireinfo is submitted'}</font>";
153 print "<font color='$Header::colourred'>$Lang::tr{'fireinfo not submitted'}</font>";
158 if ($fireinfosettings{'ENABLE_FIREINFO'} eq "on") {
159 print "<input type='submit' name='submit' value=\"$Lang::tr{'fireinfo is submitted button'}\" />";
161 print "<input type='submit' name='submit' value=\"$Lang::tr{'fireinfo not submitted button'}\" />";
169 <td colspan="2"><font color='$Header::colourgreen'> </font></td>
173 <textarea rows="25" cols="75" readonly="readonly">$profile</textarea>
182 &Header
::closebigbox
();
183 &Header
::closepage
();