]>
git.ipfire.org Git - people/ms/ipfire-2.x.git/blob - html/cgi-bin/p2p-block.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
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 ###############################################################################
21 # Author: Alexander Marx (Amarx@ipfire.org) #
22 ###############################################################################
25 no warnings
'uninitialized';
26 # enable only the following on debugging purpose
28 #use CGI::Carp 'fatalsToBrowser';
30 require '/var/ipfire/general-functions.pl';
31 require "${General::swroot}/lang.pl";
32 require "${General::swroot}/header.pl";
34 my $errormessage = '';
36 my $p2pfile = "${General::swroot}/firewall/p2protocols";
39 my %fwdfwsettings = ();
41 my %mainsettings = ();
43 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
44 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
46 &Header
::showhttpheaders
();
47 &Header
::getcgihash
(\
%fwdfwsettings);
49 if ($fwdfwsettings{'ACTION'} eq 'togglep2p') {
50 open( FILE
, "<$p2pfile") or die "Unable to read $p2pfile";
53 open( FILE
, ">$p2pfile") or die "Unable to write $p2pfile";
54 foreach my $p2pentry (sort @p2ps) {
55 my @p2pline = split( /\;/, $p2pentry);
56 if ($p2pline[1] eq $fwdfwsettings{'P2PROT'}) {
57 if ($p2pline[2] eq 'on') {
63 print FILE
"$p2pline[0];$p2pline[1];$p2pline[2];\n";
67 &General
::firewall_config_changed
();
69 $notice = $Lang::tr
{'p2p block save notice'};
72 &Header
::openpage
($Lang::tr
{'p2p block'}, 1, '');
73 &Header
::openbigbox
('100%', 'center', $errormessage);
76 &Header
::openbox
('100%', 'left', $Lang::tr
{'notice'});
77 print "<font class='base'>$notice</font>";
83 open(FILE
, "<$p2pfile") or die "Unable to read $p2pfile";
87 &Header
::openbox
('100%', 'center',);
89 <table width='35%' class='tbl'>
91 <th align='center' colspan='2' bgcolor='$color{'color22'}' >
92 <b>$Lang::tr{'protocol'}</b>
94 <th align='center' bgcolor='$color{'color22'}' >
95 <b>$Lang::tr{'status'}</b>
101 foreach my $p2pentry (sort @p2ps) {
102 my @p2pline = split( /\;/, $p2pentry);
103 if ($p2pline[2] eq 'on') {
104 $gif = "/images/on.gif"
106 $gif = "/images/off.gif"
110 $col="bgcolor='$color{'color20'}'"; }
113 $col="bgcolor='$color{'color22'}'"; }
115 <td align='center' colspan='2' $col>
118 <td align='center' $col>
119 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
120 <input type='hidden' name='P2PROT' value='$p2pline[1]'>
121 <input type='image' img src='$gif' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw toggle'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;'>
122 <input type='hidden' name='ACTION' value='togglep2p'>
134 <img src='/images/on.gif'>
137 $Lang::tr{'outgoing firewall p2p allow'}
142 <img src='/images/off.gif'>
145 $Lang::tr{'outgoing firewall p2p deny'}
153 &Header
::closebigbox
();
154 &Header
::closepage
();