require "${General::swroot}/header.pl";
my $errormessage = '';
+my $notice;
my $p2pfile = "${General::swroot}/firewall/p2protocols";
my @p2ps = ();
&Header::showhttpheaders();
&Header::getcgihash(\%fwdfwsettings);
-&Header::openpage($Lang::tr{'p2p block'}, 1, '');
-&Header::openbigbox('100%', 'center', $errormessage);
if ($fwdfwsettings{'ACTION'} eq 'togglep2p') {
open( FILE, "<$p2pfile") or die "Unable to read $p2pfile";
close FILE;
&General::firewall_config_changed();
- &p2pblock();
-} else {
- &p2pblock();
-}
-sub p2pblock {
- my $gif;
-
- open(FILE, "<$p2pfile") or die "Unable to read $p2pfile";
- @p2ps = <FILE>;
- close FILE;
+ $notice = $Lang::tr{'p2p block save notice'};
+}
- &Header::openbox('100%', 'center', $Lang::tr{'p2p block'});
- print <<END;
- <table width='35%' border='0'>
- <tr bgcolor='$color{'color22'}'>
- <td align=center colspan='2' >
- <b>$Lang::tr{'protocol'}</b>
- </td>
- <td align='center'>
- <b>$Lang::tr{'status'}</b>
- </td>
- </tr>
-END
+&Header::openpage($Lang::tr{'p2p block'}, 1, '');
+&Header::openbigbox('100%', 'center', $errormessage);
- foreach my $p2pentry (sort @p2ps) {
- my @p2pline = split( /\;/, $p2pentry);
- if ($p2pline[2] eq 'on') {
- $gif = "/images/on.gif"
- } else {
- $gif = "/images/off.gif"
- }
+if ($notice) {
+ &Header::openbox('100%', 'left', $Lang::tr{'notice'});
+ print "<font class='base'>$notice</font>";
+ &Header::closebox();
+}
- print <<END;
- <tr bgcolor='$color{'color20'}'>
- <td align='center' colspan='2'>
- $p2pline[0]:
- </td>
- <td align='center'>
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='P2PROT' value='$p2pline[1]'>
- <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;'>
- <input type='hidden' name='ACTION' value='togglep2p'>
- </form>
- </td>
- </tr>
+my $gif;
+
+open(FILE, "<$p2pfile") or die "Unable to read $p2pfile";
+@p2ps = <FILE>;
+close FILE;
+
+&Header::openbox('100%', 'center',);
+print <<END;
+ <table width='35%' class='tbl'>
+ <tr>
+ <th align='center' colspan='2' bgcolor='$color{'color22'}' >
+ <b>$Lang::tr{'protocol'}</b>
+ </th>
+ <th align='center' bgcolor='$color{'color22'}' >
+ <b>$Lang::tr{'status'}</b>
+ </th>
+ </tr>
END
+my $lines=0;
+my $col="";
+foreach my $p2pentry (sort @p2ps) {
+ my @p2pline = split( /\;/, $p2pentry);
+ if ($p2pline[2] eq 'on') {
+ $gif = "/images/on.gif"
+ } else {
+ $gif = "/images/off.gif"
}
-
+ if ($lines % 2) {
+ print "<tr>";
+ $col="bgcolor='$color{'color20'}'"; }
+ else {
+ print "<tr>";
+ $col="bgcolor='$color{'color22'}'"; }
print <<END;
- <tr>
- <td>
- <img src='/images/on.gif'>
- </td>
- <td>
- $Lang::tr{'outgoing firewall p2p allow'}
- </td>
- </tr>
- <tr>
- <td>
- <img src='/images/off.gif'>
- </td>
- <td>
- $Lang::tr{'outgoing firewall p2p deny'}
- </td>
- </tr>
- </table>
+ <td align='center' colspan='2' $col>
+ $p2pline[0]:
+ </td>
+ <td align='center' $col>
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <input type='hidden' name='P2PROT' value='$p2pline[1]'>
+ <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;'>
+ <input type='hidden' name='ACTION' value='togglep2p'>
+ </form>
+ </td>
+ </tr>
END
-
- &Header::closebox();
+$lines++;
}
+print <<END;
+</table><table>
+ <tr>
+ <td>
+ <img src='/images/on.gif'>
+ </td>
+ <td>
+ $Lang::tr{'outgoing firewall p2p allow'}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <img src='/images/off.gif'>
+ </td>
+ <td>
+ $Lang::tr{'outgoing firewall p2p deny'}
+ </td>
+ </tr>
+ </table>
+END
+
+&Header::closebox();
+
&Header::closebigbox();
&Header::closepage();