From 3f8fe51ef093987c5633a9564648b1d3fe2e5087 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Fri, 15 Feb 2013 13:24:34 +0100 Subject: [PATCH] Forward Firewall: When editing a group and deleting an entry, the next mode is also update --- html/cgi-bin/fwhosts.cgi | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index 6db70463d..d39fe124b 100755 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -852,6 +852,8 @@ if ($fwhostsettings{'ACTION'} eq 'delhost') } if ($fwhostsettings{'ACTION'} eq 'deletegrphost') { + my $grpremark; + my $grpname; &General::readhasharray("$configgrp", \%customgrp); foreach my $key (keys %customgrp){ if($customgrp{$key}[0].",".$customgrp{$key}[1].",".$customgrp{$key}[2].",".$customgrp{$key}[3] eq $fwhostsettings{'delhost'}){ @@ -876,11 +878,17 @@ if ($fwhostsettings{'ACTION'} eq 'deletegrphost') } &General::writehasharray("$confighost", \%customhost); } + $grpname=$customgrp{$key}[0]; + $grpremark=$customgrp{$key}[1]; delete $customgrp{$key}; } } &General::writehasharray("$configgrp", \%customgrp); &rules; + if ($fwhostsettings{'update'} eq 'on'){ + $fwhostsettings{'remark'}= $grpremark; + $fwhostsettings{'grp_name'}=$grpname; + } &addgrp; &viewtablegrp; } @@ -934,6 +942,8 @@ if ($fwhostsettings{'ACTION'} eq 'delservicegrp') } if ($fwhostsettings{'ACTION'} eq 'delgrpservice') { + my $grpname; + my $grpremark; &General::readhasharray("$configsrvgrp", \%customservicegrp); &General::readhasharray("$configsrv", \%customservice); foreach my $key (keys %customservicegrp){ @@ -947,11 +957,18 @@ if ($fwhostsettings{'ACTION'} eq 'delgrpservice') } } &General::writehasharray("$configsrv", \%customservice); - delete $customservicegrp{$key} + $grpname=$customservicegrp{$key}[0]; + $grpremark=$customservicegrp{$key}[1]; + delete $customservicegrp{$key}; } } &General::writehasharray("$configsrvgrp", \%customservicegrp); &rules; + if ($fwhostsettings{'updatesrvgrp'} eq 'on'){ + #$fwhostsettings{'updatesrvgrp'}='on'; + $fwhostsettings{'SRVGRP_NAME'}=$grpname; + $fwhostsettings{'SRVGRP_REMARK'}=$grpremark; + } &addservicegrp; &viewtableservicegrp; @@ -1451,7 +1468,7 @@ sub viewtablegrp { $delflag++; } - if($delflag > 1){ + if($delflag > 0){ last; } } @@ -1494,7 +1511,7 @@ sub viewtablegrp if ($delflag > '1' && $ip ne ''){ print""; } - print""; + print""; $helper=$customgrp{$key}[0]; $number++; @@ -1554,7 +1571,6 @@ sub viewtableservicegrp my $helper; my $port; my $protocol; - my $delflag; if (! -z $configsrvgrp){ &Header::openbox('100%', 'left', $Lang::tr{'fwhost cust srvgrp'}); &General::readhasharray("$configsrvgrp", \%customservicegrp); @@ -1605,10 +1621,10 @@ sub viewtableservicegrp } } print"$port$protocol
"; - if ($delflag > '1'){ + if ($number gt '1'){ print""; } - print"
"; + print""; $helper=$customservicegrp{$key}[0]; } print""; -- 2.39.2