]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/outgoinggrp.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2005-2010 IPTifre Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
23 # enable only the following on debugging purpose
25 #use CGI::Carp 'fatalsToBrowser';
27 require '/var/ipfire/general-functions.pl';
28 require "${General::swroot}/lang.pl";
29 require "${General::swroot}/header.pl";
31 my %outgrpsettings = ();
34 my $errormessage = "";
36 my $configpath = "/var/ipfire/outgoing/groups/";
37 my $servicefile = "/var/ipfire/outgoing/defaultservices";
40 my %mainsettings = ();
41 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
42 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
44 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
46 &Header
::showhttpheaders
();
48 ### Values that have to be initialized
49 $outgrpsettings{'ACTION'} = '';
50 $outgrpsettings{'ipgroup'} = 'none';
51 $outgrpsettings{'portgroup'} = 'none';
53 &Header
::getcgihash
(\
%outgrpsettings);
54 delete $outgrpsettings{'__CGI__'};delete $outgrpsettings{'x'};delete $outgrpsettings{'y'};
56 $selected{'ipgroup'}{$outgrpsettings{'ipgroup'}} = "selected='selected'";
57 $selected{'portgroup'}{$outgrpsettings{'portgroup'}} = "selected='selected'";
59 &Header
::openpage
($Lang::tr
{'outgoing firewall groups'}, 1, '');
60 &Header
::openbigbox
('100%', 'left', '', $errormessage);
64 # &Header::openbox('100%', 'left', 'DEBUG');
66 # foreach my $line (sort keys %outgrpsettings) {
67 # print "$line = $outgrpsettings{$line}<br />\n";
70 # print " Count: $debugCount\n";
71 # &Header::closebox();
75 ############################################################################################################################
76 ############################################################################################################################
80 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
81 print "<class name='base'>$errormessage\n";
82 print " </class>\n";
86 if ($outgrpsettings{'ACTION'} eq 'newipgroup')
89 } elsif ($outgrpsettings{'ACTION'} eq 'deleteipgroup' ) {
90 unlink("$configpath/ipgroups/$outgrpsettings{'ipgroup'}");
91 } elsif ($outgrpsettings{'ACTION'} eq 'addipgroup') {
92 open (FILE
, ">$configpath/ipgroups/$outgrpsettings{'ipgroup'}") or die "Can't save $outgrpsettings{'ipgroup'} settings $!";
94 print FILE
$outgrpsettings{'ipgroupcontent'}."\n";
98 ############################################################################################################################
99 ############################################################################################################################
101 my @ipgroups = qx(ls
$configpath/ipgroups/);
102 if ($outgrpsettings{'ipgroup'} eq "none" and $#ipgroups >= 0 ){ $outgrpsettings{'ipgroup'} = $ipgroups[0];}
104 my $ipgroupcontent = `cat $configpath/ipgroups/$outgrpsettings{'ipgroup'} 2>/dev/null`;
105 $ipgroupcontent =~ s/\n/<br \/>/g
;
107 &Header
::openbox
('100%', 'center', $Lang::tr
{'outgoing firewall ip groups'});
110 <a name="outgoing showipgroup"</a>
112 <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
113 <table width='95%' cellspacing='0'>
115 <td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'outgoing firewall ip groups'}</b></td>
118 <td colspan='3' align='left'><br /></td>
121 <td align='left' colspan='2'><select name='ipgroup' style="width: 200px">
124 foreach my $member (@ipgroups) {chomp $member;print" <option value='$member' $selected{'ipgroup'}{$member}>$member</option>\n";}
128 <input type='hidden' name='ACTION' value='showipgroup' />
129 <input type='image' alt='$Lang::tr{'outgoing firewall view group'}' title='$Lang::tr{'outgoing firewall view group'}' src='/images/format-justify-fill.png' />
133 <td colspan='3' align='left'><br /></td>
136 <td colspan='3' align='left'><font size=1>$ipgroupcontent</font></td>
139 <td colspan='3' align='left'><br /></td>
142 <td colspan='3' align='center'><font size=1>$Lang::tr{'outgoing firewall ip groups'} - $outgrpsettings{'ipgroup'}</font></td>
146 <table width='10%' cellspacing='0'>
149 <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
150 <input type='hidden' name='ACTION' value='newipgroup' />
151 <input type='image' alt='$Lang::tr{'new'}' title='$Lang::tr{'new'}' src='/images/list-add.png' />
155 <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
156 <input type='hidden' name='ACTION' value='saveipgroup' />
157 <input type='hidden' name='ipgroup' value='$outgrpsettings{'ipgroup'}' />
158 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
162 <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
163 <input type='hidden' name='ACTION' value='deleteipgroup' />
164 <input type='hidden' name='ipgroup' value='$outgrpsettings{'ipgroup'}' />
165 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/user-trash.png' />
175 &Header
::closebigbox
();
176 &Header
::closepage
();
180 &Header
::openbox
('100%', 'center', $Lang::tr
{'outgoing firewall add ip group'});
183 <form method='post' action='$ENV{'SCRIPT_NAME'}#outgoing showipgroup'>
184 <table width='95%' cellspacing='0'>
186 <td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'outgoing firewall add ip group'}</b></td>
189 <td colspan='3' align='left'><br /></td>
192 <td align='left' colspan='2'>
193 <input type='text' name='ipgroup' value='newgroup' size="30" />
196 <input type='hidden' name='ACTION' value='addipgroup' />
197 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' />
201 <td align='left' colspan='3'>
202 <textarea name="ipgroupcontent" cols="20" rows="5" Wrap="off">192.168.1.0/14\n192.168.0.1\n192.168.0.2\n</textarea>
210 &Header
::closebigbox
();
211 &Header
::closepage
();