]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Added the ability to edit existing firewall groups and persist changes.
authorChristian Schmidt <maniacikarus@ipfire.org>
Fri, 10 Dec 2010 12:17:13 +0000 (13:17 +0100)
committerChristian Schmidt <maniacikarus@ipfire.org>
Fri, 10 Dec 2010 12:17:13 +0000 (13:17 +0100)
config/rootfiles/core/44/filelists/files
html/cgi-bin/outgoinggrp.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
langs/fr/cgi-bin/fr.pl

index 866acf0bcff7477bdb7216499b06a62044826152..5d0a4d0001b8a1a4ec6a2fce4adb32f91921613c 100644 (file)
@@ -13,6 +13,7 @@ srv/web/ipfire/cgi-bin/speed.cgi
 srv/web/ipfire/cgi-bin/vpnmain.cgi
 srv/web/ipfire/cgi-bin/ids.cgi
 srv/web/ipfire/cgi-bin/outgoingfw.cgi
+srv/web/ipfire/cgi-bin/outgoinggrp.cgi
 srv/web/ipfire/cgi-bin/pppsetup.cgi
 srv/web/ipfire/html/images/urlfilter/copy.gif
 var/ipfire/general-functions.pl
index a00db2a7411e06fb3f6322d8ab534374fc190ac5..e757ca08afb11f2a840f36995c2452e23809f73c 100644 (file)
@@ -65,9 +65,9 @@ $selected{'macgroup'}{$outgrpsettings{'macgroup'}} = "selected='selected'";
 # my $debugCount = 0;
 # foreach my $line (sort keys %outgrpsettings) {
 # print "$line = $outgrpsettings{$line}<br />\n";
- # $debugCount++;
+# $debugCount++;
 # }
-# print "&nbsp;Count: $debugCount\n";
+# print "Count: $debugCount\n";
 # &Header::closebox();
 # DEBUG DEBUG
 ###############
@@ -78,6 +78,9 @@ $selected{'macgroup'}{$outgrpsettings{'macgroup'}} = "selected='selected'";
 if ($outgrpsettings{'ACTION'} eq 'newipgroup')
 {
        &newipgroup();
+}elsif ($outgrpsettings{'ACTION'} eq 'editipgroup')
+{
+       &editipgroup();
 } elsif ($outgrpsettings{'ACTION'} eq 'deleteipgroup' ) {
        unlink("$configpath/ipgroups/$outgrpsettings{'ipgroup'}");
 } elsif ($outgrpsettings{'ACTION'} eq 'addipgroup') {
@@ -90,6 +93,7 @@ if ($outgrpsettings{'ACTION'} eq 'newipgroup')
                $errormessage =  "$Lang::tr{'outgoing firewall reserved groupname'}";
        } else {
                open (FILE, ">$configpath/ipgroups/$outgrpsettings{'ipgroup'}") or die "Can't save $outgrpsettings{'ipgroup'} settings $!";
+               $outgrpsettings{'ipgroupcontent'} =~ s/\s*$//;
                flock (FILE, 2);
                print FILE $outgrpsettings{'ipgroupcontent'}."\n";
                close FILE;
@@ -99,7 +103,10 @@ if ($outgrpsettings{'ACTION'} eq 'newipgroup')
 if ($outgrpsettings{'ACTION'} eq 'newmacgroup')
 {
        &newmacgroup();
-} elsif ($outgrpsettings{'ACTION'} eq 'deletemacgroup' ) {
+}elsif ($outgrpsettings{'ACTION'} eq 'editmacgroup')
+{
+       &editmacgroup();
+}elsif ($outgrpsettings{'ACTION'} eq 'deletemacgroup' ) {
        unlink("$configpath/macgroups/$outgrpsettings{'macgroup'}");
 } elsif ($outgrpsettings{'ACTION'} eq 'addmacgroup') {
 
@@ -111,6 +118,7 @@ if ($outgrpsettings{'ACTION'} eq 'newmacgroup')
                $errormessage =  "$Lang::tr{'outgoing firewall reserved groupname'}";
        } else {
                open (FILE, ">$configpath/macgroups/$outgrpsettings{'macgroup'}") or die "Can't save $outgrpsettings{'macgroup'} settings $!";
+               $outgrpsettings{'macgroupcontent'} =~ s/\s*$//;
                flock (FILE, 2);
                print FILE $outgrpsettings{'macgroupcontent'}."\n";
                close FILE;
@@ -176,20 +184,27 @@ print <<END
 <table width='10%' cellspacing='0'>
 <tr>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                       <input type='hidden' name='ACTION' value='editipgroup' />
+                       <input type='hidden' name='ipgroup' value='$outgrpsettings{'ipgroup'}' />
+                       <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
+               </form>
+       </td>
+       <td align='center'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='newipgroup' />
                        <input type='image' alt='$Lang::tr{'new'}' title='$Lang::tr{'new'}' src='/images/list-add.png' />
                </form>
        </td>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='saveipgroup' />
                        <input type='hidden' name='ipgroup' value='$outgrpsettings{'ipgroup'}' />
                        <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
                </form>
        </td>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='deleteipgroup' />
                        <input type='hidden' name='ipgroup' value='$outgrpsettings{'ipgroup'}' />
                        <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
@@ -253,20 +268,27 @@ print <<END
 <table width='10%' cellspacing='0'>
 <tr>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showmacgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+                       <input type='hidden' name='ACTION' value='editmacgroup' />
+                       <input type='hidden' name='macgroup' value='$outgrpsettings{'macgroup'}' />
+                       <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
+               </form>
+       </td>
+       <td align='center'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='newmacgroup' />
                        <input type='image' alt='$Lang::tr{'new'}' title='$Lang::tr{'new'}' src='/images/list-add.png' />
                </form>
        </td>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showmacgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='savemacgroup' />
                        <input type='hidden' name='macgroup' value='$outgrpsettings{'macgroup'}' />
                        <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
                </form>
        </td>
        <td align='center'>
-               <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showmacgroup'>
+               <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <input type='hidden' name='ACTION' value='deletemacgroup' />
                        <input type='hidden' name='macgroup' value='$outgrpsettings{'macgroup'}' />
                        <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
@@ -302,7 +324,7 @@ print <<END
                </tr>
                <tr>
                        <td  align='left' colspan='2'>
-                               <input type='text' name='ipgroup' value='newgroup' size="30" />
+                               <input type='text' name='ipgroup' value='newipgroup' size="30" />
                        </td>
                        <td  align='left'>
                                <input type='hidden' name='ACTION' value='addipgroup' />
@@ -311,7 +333,46 @@ print <<END
                </tr>
                <tr>
                        <td  align='left' colspan='3'>
-                               <textarea name="ipgroupcontent" cols="20" rows="5" Wrap="off">192.168.1.0/24\n192.168.3.0/255.255.255.0\n192.168.0.1\n192.168.0.2\n</textarea>
+                               <textarea name="ipgroupcontent" cols="40" rows="5" Wrap="off">192.168.1.0/24\n192.168.3.0/255.255.255.0\n192.168.0.1\n192.168.0.2\n</textarea>
+                       </td>
+               </tr>
+       </table>
+       </form>
+END
+;
+       &Header::closebox();
+       &Header::closebigbox();
+       &Header::closepage();
+       exit 0;
+}
+
+sub editipgroup
+{
+my $ipgroupcontent = `cat $configpath/ipgroups/$outgrpsettings{'ipgroup'} 2>/dev/null`;
+
+       &Header::openbox('100%', 'center', $Lang::tr{'outgoing firewall edit ip group'});
+
+print <<END
+       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+       <table width='95%' cellspacing='0'>
+               <tr>
+                       <td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'outgoing firewall edit ip group'}</b></td>
+               </tr>
+               <tr>
+                       <td colspan='3'  align='left'><br /></td>
+               </tr>
+               <tr>
+                       <td  align='left' colspan='2'>
+                               <input type='text' name='ipgroup' value='$outgrpsettings{'ipgroup'}' size='30' readonly style='color:$color{'color20'}'/>
+                       </td>
+                       <td  align='left'>
+                               <input type='hidden' name='ACTION' value='addipgroup' />
+                               <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
+                       </td>
+               </tr>
+               <tr>
+                       <td  align='left' colspan='3'>
+                               <textarea name="ipgroupcontent" cols="40" rows="5" Wrap="off">$ipgroupcontent</textarea>
                        </td>
                </tr>
        </table>
@@ -339,7 +400,7 @@ print <<END
                </tr>
                <tr>
                        <td  align='left' colspan='2'>
-                               <input type='text' name='macgroup' value='newgroup' size="30" />
+                               <input type='text' name='macgroup' value='newmacgroup' size="30" />
                        </td>
                        <td  align='left'>
                                <input type='hidden' name='ACTION' value='addmacgroup' />
@@ -359,4 +420,43 @@ END
        &Header::closebigbox();
        &Header::closepage();
        exit 0;
-}
\ No newline at end of file
+}
+
+sub editmacgroup
+{
+my $macgroupcontent = `cat $configpath/macgroups/$outgrpsettings{'macgroup'} 2>/dev/null`;
+
+       &Header::openbox('100%', 'center', $Lang::tr{'outgoing firewall edit mac group'});
+
+print <<END
+       <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing editmacgroup'>
+       <table width='95%' cellspacing='0'>
+               <tr>
+                       <td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'outgoing firewall edit mac group'}</b></td>
+               </tr>
+               <tr>
+                       <td colspan='3'  align='left'><br /></td>
+               </tr>
+               <tr>
+                       <td  align='left' colspan='2'>
+                               <input type='text' name='macgroup' value='$outgrpsettings{'macgroup'}' size='30' readonly style='color:$color{'color20'}'/>
+                       </td>
+                       <td  align='left'>
+                               <input type='hidden' name='ACTION' value='addmacgroup' />
+                               <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
+                       </td>
+               </tr>
+               <tr>
+                       <td  align='left' colspan='3'>
+                               <textarea name="macgroupcontent" cols="20" rows="5" Wrap="off">$macgroupcontent</textarea>
+                       </td>
+               </tr>
+       </table>
+       </form>
+END
+;
+       &Header::closebox();
+       &Header::closebigbox();
+       &Header::closepage();
+       exit 0;
+}
index 8bdc1007af1c9d0f85ba66581281dc5fe3ad8dea..35650da5af4faec875214d76c057537c6a289516 100644 (file)
 'outgoing firewall' => 'Ausgehende Firewall',
 'outgoing firewall add ip group' => 'IP Adressgruppen hinzufügen',
 'outgoing firewall add mac group' => 'MAC Adressgruppen hinzufügen',
+'outgoing firewall edit ip group' => 'IP Adressgruppen bearbeiten',
+'outgoing firewall edit mac group' => 'MAC Adressgruppen bearbeiten',
 'outgoing firewall group error' => 'Eine Gruppe mit dem selben Namen existiert bereits.',
 'outgoing firewall groups' => 'Firewall Gruppen',
 'outgoing firewall ip groups' => 'Ausgehende Firewall IP Adressgruppen',
index 035c9c7a85c54d316aab402b6e1914cd194c25d7..86044330db2f8f5a04973dae34df945a072da451 100644 (file)
 'outgoing firewall' => 'Outgoing Firewall',
 'outgoing firewall add ip group' => 'Add IP Address Group',
 'outgoing firewall add mac group' => 'Add MAC Address Group',
+'outgoing firewall edit ip group' => 'Edit IP Address Group',
+'outgoing firewall edit mac group' => 'Edit MAC Address Group',
 'outgoing firewall group error' => 'A group with the same name exists.',
 'outgoing firewall groups' => 'Firewall Groups',
 'outgoing firewall ip groups' => 'Outgoing Firewall IP Address Groups',
index ff1b743e642c3c056774179d4cb6ef36e8ba9192..160bb1ba88c8e0e7a785d2ef9eb804ac32679785 100644 (file)
 'outgoing firewall' => 'Pare-feu sortant',
 'outgoing firewall add ip group' => 'Ajouter un groupe d\'adresses IP',
 'outgoing firewall add mac group' => 'Ajouter un groupe d\'adresses MAC',
+'outgoing firewall edit ip group' => 'Modifier un groupe d\'adresses IP',
+'outgoing firewall edit mac group' => 'Modifier un groupe d\'adresses MAC',
 'outgoing firewall group error' => 'Un groupe portant le même nom existe.',
 'outgoing firewall groups' => 'Groupes de pare-feu',
 'outgoing firewall ip groups' => 'Groupes d\'adresses IP du pare-feu sortant',