]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/forwardfw.cgi
Forward Firewall: added newlines between groups in tablerule
[people/teissler/ipfire-2.x.git] / html / cgi-bin / forwardfw.cgi
index 195205875ed050d55868465af5cf256d7fa4999d..3e170a1d93249e41a70138b0f9a8b60887e77a5e 100755 (executable)
@@ -342,35 +342,33 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
 }
 if ($fwdfwsettings{'ACTION'} eq $Lang::tr{'reset'})
 {
-       &General::readhasharray("$configfwdfw", \%configfwdfw);
-       foreach my $key (sort keys %configfwdfw){
-               &checkcounter($configfwdfw{$key}[3],$configfwdfw{$key}[4],,);
-               &checkcounter($configfwdfw{$key}[5],$configfwdfw{$key}[6],,);
-               &checkcounter($configfwdfw{$key}[14],$configfwdfw{$key}[15],,);
-       }
-               &General::readhasharray("$configinput", \%configinputfw);
-       foreach my $key (sort keys %configinputfw){
-               &checkcounter($configinputfw{$key}[3],$configinputfw{$key}[4],,);
-               &checkcounter($configinputfw{$key}[5],$configinputfw{$key}[6],,);
-               &checkcounter($configinputfw{$key}[14],$configinputfw{$key}[15],,);
-       }
-       
-       system("rm ${General::swroot}/forward/config");
-       system("rm ${General::swroot}/forward/input");
-       &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
-       unless (-e "${General::swroot}/forward/config")         { system("touch ${General::swroot}/forward/config"); }
-       unless (-e "${General::swroot}/forward/input")          { system("touch ${General::swroot}/forward/input"); }
-       my $MODE1=$fwdfwsettings{'POLICY1'};
-       %fwdfwsettings = ();
-       $fwdfwsettings{'POLICY'}='MODE2';
-       $fwdfwsettings{'POLICY1'}=$MODE1;
-       &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
-       &reread_rules;
-
-}
-if ($fwdfwsettings{'ACTION'} eq 'resetoutgoing')
-{
-       &General::readhasharray("$configoutgoing", \%configoutgoingfw);
+       if($fwdfwsettings{'poltype'} eq 'forward'){
+               &General::readhasharray("$configfwdfw", \%configfwdfw);
+               foreach my $key (sort keys %configfwdfw){
+                       &checkcounter($configfwdfw{$key}[3],$configfwdfw{$key}[4],,);
+                       &checkcounter($configfwdfw{$key}[5],$configfwdfw{$key}[6],,);
+                       &checkcounter($configfwdfw{$key}[14],$configfwdfw{$key}[15],,);
+               }
+                       &General::readhasharray("$configinput", \%configinputfw);
+               foreach my $key (sort keys %configinputfw){
+                       &checkcounter($configinputfw{$key}[3],$configinputfw{$key}[4],,);
+                       &checkcounter($configinputfw{$key}[5],$configinputfw{$key}[6],,);
+                       &checkcounter($configinputfw{$key}[14],$configinputfw{$key}[15],,);
+               }
+               
+               system("rm ${General::swroot}/forward/config");
+               system("rm ${General::swroot}/forward/input");
+               &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
+               unless (-e "${General::swroot}/forward/config")         { system("touch ${General::swroot}/forward/config"); }
+               unless (-e "${General::swroot}/forward/input")          { system("touch ${General::swroot}/forward/input"); }
+               my $MODE1=$fwdfwsettings{'POLICY1'};
+               %fwdfwsettings = ();
+               $fwdfwsettings{'POLICY'}='MODE2';
+               $fwdfwsettings{'POLICY1'}=$MODE1;
+               &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
+               &reread_rules;
+       }else{
+               &General::readhasharray("$configoutgoing", \%configoutgoingfw);
        foreach my $key (sort keys %configoutgoingfw){
                &checkcounter($configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],,);
                &checkcounter($configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],,);
@@ -385,7 +383,7 @@ if ($fwdfwsettings{'ACTION'} eq 'resetoutgoing')
        $fwdfwsettings{'POLICY1'}='MODE2';
        &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
        &reread_rules;
-
+       }
 }
 if ($fwdfwsettings{'ACTION'} eq $Lang::tr{'fwdfw newrule'})
 {
@@ -589,8 +587,8 @@ sub base
 print <<END;
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
        <table width='100%' border='0'>
-               <tr><td colspan='3' style='font-weight:bold;color:red;'>FORWARD </td></tr>
-               <tr><td colspan='3'>$Lang::tr{'fwdfw pol text'}</td></tr>
+               <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>FORWARD </td></tr>
+               <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text'}</td></tr>
                <tr><td colspan='3'><hr /></td></tr>
                <tr><td width='15%' align='left'>       <select name='POLICY' style="width: 100px">
                <option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
@@ -598,22 +596,22 @@ print <<END;
            <input type='submit' name='ACTION' value=$Lang::tr{'save'} /></td><td width='45%' align='right'>
            
 END
-       print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value='$Lang::tr{'reset'}' /></td></tr>";
+       print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value='$Lang::tr{'reset'}' /><input type='hidden' name='poltype' value='forward' /></td></tr>";
        print "</table></form>";
        print"<br><br>";
        print <<END;
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
        <table width='100%' border='0'>
-               <tr><td colspan='3' style='font-weight:bold;color:red;'>OUTGOING </td></tr>
-               <tr><td colspan='3'>$Lang::tr{'fwdfw pol text1'}</td></tr>
+               <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>OUTGOING </td></tr>
+               <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text1'}</td></tr>
                <tr><td colspan='3'><hr /></td></tr>
                <tr><td width='15%' align='left'>       <select name='POLICY1' style="width: 100px">
                <option value='MODE1' $selected{'POLICY1'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
                <option value='MODE2' $selected{'POLICY1'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
-           <input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td><td width='45%' align='right'></form><form method='post' >
+           <input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td><td width='45%' align='right'>
            
 END
-       print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' value='$Lang::tr{'reset'}' /><input type='hidden' name='ACTION' value='resetoutgoing' /></tr>";
+       print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value='$Lang::tr{'reset'}' /><input type='hidden' name='poltype' value='outgoing' /></tr>";
        print "</table></form>";
        &Header::closebox();
 }
@@ -1836,6 +1834,7 @@ sub viewtablenew
        &General::get_aliases(\%aliases);
        &General::readhasharray("$config", $hash);
        if( ! -z $config){
+               if ($title1 eq $Lang::tr{'external access'} || $title1 eq 'Outgoing'){print"<br><br>";}
                &Header::openbox('100%', 'left',$title);
                my $count=0;
                my ($gif,$log);
@@ -1846,7 +1845,7 @@ sub viewtablenew
                my $coloryellow='';
                print"<b>$title1</b><br>";
                print"<table width='100%' cellspacing='1'  rules='none'; padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;'>";
-               print"<tr><td align='center'><b>#</td><td ></td><td align='center'><b>$Lang::tr{'fwdfw source'}</td><td><b>Log</td><td align='center'><b>$Lang::tr{'fwdfw target'}</td><td align='center'><b>$Lang::tr{'protocol'}</b></td><td align='center'><b>$Lang::tr{'remark'}</td><td align='center' colspan='6'><b>$Lang::tr{'fwdfw action'}</td></tr>";
+               print"<tr><td align='center'><b>#</td><td ></td><td align='center'><b>$Lang::tr{'fwdfw source'}</td><td><b>Log</td><td align='center'><b>$Lang::tr{'fwdfw target'}</td><td align='center'><b>$Lang::tr{'protocol'}</b></td><td align='center'><b>$Lang::tr{'fwdfw time'}</td><td align='center' colspan='6'><b>$Lang::tr{'fwdfw action'}</td></tr>";
                foreach my $key (sort  {$a <=> $b} keys %$hash){
                        $tdcolor='';
                        @tmpsrc=();
@@ -1980,7 +1979,7 @@ END
                                        print"<td align='center' width='100'>$weekdays &nbsp $$hash{$key}[26] - $$hash{$key}[27]</td>";
                                }
                        }else{
-                                       print"<td></td>";
+                                       print"<td align='center'>24/7</td>";
                                }
                        if($$hash{$key}[2] eq 'ON'){
                                $gif="/images/on.gif"
@@ -2073,6 +2072,8 @@ sub getcolor
                        $tdcolor="style='border: 2px solid $Header::colourorange;'";
                }elsif ($val eq 'BLUE'){
                        $tdcolor="style='border: 2px solid $Header::colourblue;'";
+               }elsif ($val eq 'RED'){
+                       $tdcolor="style='border: 2px solid $Header::colourred;'";
                }elsif ($val eq 'IPFire' ){
                        $tdcolor="style='border: 2px solid $Header::colourred;'";
                }elsif($val =~ /^(.*?)\/(.*?)$/){