From 4a75efa5a79a81a9f459e9dc113e474cd2e53df6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 22 Oct 2013 19:08:35 +0200 Subject: [PATCH] p2p-block.cgi: Fix coding style. --- html/cgi-bin/p2p-block.cgi | 104 ++++++++++++++++++++++++------------- langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 1 + 3 files changed, 71 insertions(+), 35 deletions(-) diff --git a/html/cgi-bin/p2p-block.cgi b/html/cgi-bin/p2p-block.cgi index 049f39d442..bb0d0aecdf 100755 --- a/html/cgi-bin/p2p-block.cgi +++ b/html/cgi-bin/p2p-block.cgi @@ -31,36 +31,34 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; -my $errormessage=''; -my $p2pfile = "${General::swroot}/forward/p2protocols"; +my $errormessage = ''; +my $p2pfile = "${General::swroot}/forward/p2protocols"; my @p2ps = (); -my %fwdfwsettings=(); -my %color=(); -my %mainsettings=(); +my %fwdfwsettings = (); +my %color = (); +my %mainsettings = (); -&General::readhash("${General::swroot}/forward/settings", \%fwdfwsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); &Header::showhttpheaders(); &Header::getcgihash(\%fwdfwsettings); -&Header::openpage($Lang::tr{'fwdfw menu'}, 1, ''); +&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"; + open( FILE, "<$p2pfile") or die "Unable to read $p2pfile"; @p2ps = ; close FILE; - open( FILE, "> $p2pfile" ) or die "Unable to write $p2pfile"; - foreach my $p2pentry (sort @p2ps) - { - my @p2pline = split( /\;/, $p2pentry ); + open( FILE, ">$p2pfile") or die "Unable to write $p2pfile"; + foreach my $p2pentry (sort @p2ps) { + my @p2pline = split( /\;/, $p2pentry); if ($p2pline[1] eq $fwdfwsettings{'P2PROT'}) { - if($p2pline[2] eq 'on'){ - $p2pline[2]='off'; - }else{ - $p2pline[2]='on'; + if ($p2pline[2] eq 'on') { + $p2pline[2] = 'off'; + } else { + $p2pline[2] = 'on'; } } print FILE "$p2pline[0];$p2pline[1];$p2pline[2];\n"; @@ -73,34 +71,70 @@ if ($fwdfwsettings{'ACTION'} eq 'togglep2p') { &p2pblock(); } -sub p2pblock -{ +sub p2pblock { my $gif; - open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile"; + + open(FILE, "<$p2pfile") or die "Unable to read $p2pfile"; @p2ps = ; close FILE; - &Header::openbox('100%', 'center', 'P2P-Block'); + + &Header::openbox('100%', 'center', $Lang::tr{'p2p block'}); print < - $Lang::tr{'protocol'}$Lang::tr{'status'} + + + + + END - foreach my $p2pentry (sort @p2ps) - { - my @p2pline = split( /\;/, $p2pentry ); - if($p2pline[2] eq 'on'){ - $gif="/images/on.gif" - }else{ - $gif="/images/off.gif" + + foreach my $p2pentry (sort @p2ps) { + my @p2pline = split( /\;/, $p2pentry); + if ($p2pline[2] eq 'on') { + $gif = "/images/on.gif" + } else { + $gif = "/images/off.gif" } + print < - - + + + + END } - print""; - print"
+ $Lang::tr{'protocol'} + + $Lang::tr{'status'} +
$p2pline[0]:
+ $p2pline[0]: + +
+ + + +
+
$Lang::tr{'outgoing firewall p2p allow'}
$Lang::tr{'outgoing firewall p2p deny'}
"; - print"


$Lang::tr{'fwdfw p2p txt'}
"; + + print < + + + + + $Lang::tr{'outgoing firewall p2p allow'} + + + + + + + + $Lang::tr{'outgoing firewall p2p deny'} + + + +END + &Header::closebox(); } diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index a80987ba1e..877aa8a41d 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1606,6 +1606,7 @@ 'ovpn_processprioVH' => 'Sehr Hoch', 'ovpnstatus log' => 'OVPN-Status-Log', 'ovpnsys log' => 'OVPN-System-Log', +'p2p block' => 'P2P-Block', 'package failed to install' => 'Programmpaket konnte nicht installiert werden.', 'pagerefresh' => 'Seite wird aktualisiert. Bitte warten.', 'pakfire accept all' => 'Möchten Sie der Installation aller Pakete zustimmen?', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 2e91a1d460..752c3d7563 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1635,6 +1635,7 @@ 'ovpn_processprioVH' => 'Very high', 'ovpnstatus log' => 'OVPN-Status-Log', 'ovpnsys log' => 'OVPN-System-Log', +'p2p block' => 'P2P block', 'package failed to install' => 'Package failed to install.', 'pagerefresh' => 'Page is beeing refreshed, please wait.', 'pakfire accept all' => 'Do you want to install all packages?', -- 2.39.2