This fixes Bug #0000642 - clearer description for p2p-block buttons on outgoing firew...
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / outgoingfw.cgi
CommitLineData
d9b7aa33 1#!/usr/bin/perl
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
fdeaa057 5# Copyright (C) 2005-2010 IPTifre Team #
70df8302
MT
6# #
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. #
11# #
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. #
16# #
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/>. #
19# #
20###############################################################################
d9b7aa33
MT
21
22use strict;
23# enable only the following on debugging purpose
a5754e93
CS
24#use warnings;
25#use CGI::Carp 'fatalsToBrowser';
d9b7aa33
MT
26
27require '/var/ipfire/general-functions.pl';
28require "${General::swroot}/lang.pl";
29require "${General::swroot}/header.pl";
30
31my %outfwsettings = ();
32my %checked = ();
33my %selected= () ;
34my %netsettings = ();
35my $errormessage = "";
36my $configentry = "";
37my @configs = ();
38my @configline = ();
39my $p2pentry = "";
40my @p2ps = ();
41my @p2pline = ();
42
43my $configfile = "/var/ipfire/outgoing/rules";
fdeaa057 44my $configpath = "/var/ipfire/outgoing/groups/";
d9b7aa33 45my $p2pfile = "/var/ipfire/outgoing/p2protocols";
f2fdd0c1
CS
46my $servicefile = "/var/ipfire/outgoing/defaultservices";
47
48my %color = ();
49my %mainsettings = ();
50&General::readhash("${General::swroot}/main/settings", \%mainsettings);
51&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
d9b7aa33
MT
52
53&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
54
55&Header::showhttpheaders();
56
57### Values that have to be initialized
58$outfwsettings{'ACTION'} = '';
59$outfwsettings{'VALID'} = 'yes';
60$outfwsettings{'EDIT'} = 'no';
61$outfwsettings{'NAME'} = '';
62$outfwsettings{'SNET'} = '';
63$outfwsettings{'SIP'} = '';
64$outfwsettings{'SPORT'} = '';
65$outfwsettings{'SMAC'} = '';
66$outfwsettings{'DIP'} = '';
67$outfwsettings{'DPORT'} = '';
68$outfwsettings{'PROT'} = '';
69$outfwsettings{'STATE'} = '';
70$outfwsettings{'DISPLAY_DIP'} = '';
71$outfwsettings{'DISPLAY_DPORT'} = '';
72$outfwsettings{'DISPLAY_SMAC'} = '';
73$outfwsettings{'DISPLAY_SIP'} = '';
1fde937c 74$outfwsettings{'POLICY'} = 'MODE0';
5595bc03 75$outfwsettings{'MODE1LOG'} = 'off';
d9b7aa33 76
39008af7
CS
77$outfwsettings{'TIME_FROM'} = '00:00';
78$outfwsettings{'TIME_TO'} = '00:00';
79
d9b7aa33
MT
80&General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings);
81&Header::getcgihash(\%outfwsettings);
82
2229c89e
CS
83###############
84# DEBUG DEBUG
85#&Header::openbox('100%', 'left', 'DEBUG');
86#my $debugCount = 0;
87#foreach my $line (sort keys %outfwsettings) {
88#print "$line = $outfwsettings{$line}<br />\n";
89# $debugCount++;
90#}
91#print "&nbsp;Count: $debugCount\n";
92#&Header::closebox();
93# DEBUG DEBUG
94###############
95
39008af7
CS
96$selected{'TIME_FROM'}{$outfwsettings{'TIME_FROM'}} = "selected='selected'";
97$selected{'TIME_TO'}{$outfwsettings{'TIME_TO'}} = "selected='selected'";
98
5595bc03
CS
99$checked{'MODE1LOG'}{'off'} = '';
100$checked{'MODE1LOG'}{'on'} = '';
101$checked{'MODE1LOG'}{$outfwsettings{'MODE1LOG'}} = "checked='checked'";
39008af7
CS
102$checked{'TIME_MON'}{'off'} = '';
103$checked{'TIME_MON'}{'on'} = '';
104$checked{'TIME_MON'}{$outfwsettings{'TIME_MON'}} = "checked='checked'";
105$checked{'TIME_TUE'}{'off'} = '';
106$checked{'TIME_TUE'}{'on'} = '';
107$checked{'TIME_TUE'}{$outfwsettings{'TIME_TUE'}} = "checked='checked'";
108$checked{'TIME_WED'}{'off'} = '';
109$checked{'TIME_WED'}{'on'} = '';
110$checked{'TIME_WED'}{$outfwsettings{'TIME_WED'}} = "checked='checked'";
111$checked{'TIME_THU'}{'off'} = '';
112$checked{'TIME_THU'}{'on'} = '';
113$checked{'TIME_THU'}{$outfwsettings{'TIME_THU'}} = "checked='checked'";
114$checked{'TIME_FRI'}{'off'} = '';
115$checked{'TIME_FRI'}{'on'} = '';
116$checked{'TIME_FRI'}{$outfwsettings{'TIME_FRI'}} = "checked='checked'";
117$checked{'TIME_SAT'}{'off'} = '';
118$checked{'TIME_SAT'}{'on'} = '';
119$checked{'TIME_SAT'}{$outfwsettings{'TIME_SAT'}} = "checked='checked'";
120$checked{'TIME_SUN'}{'off'} = '';
121$checked{'TIME_SUN'}{'on'} = '';
122$checked{'TIME_SUN'}{$outfwsettings{'TIME_SUN'}} = "checked='checked'";
5595bc03 123
d9b7aa33
MT
124if ($outfwsettings{'POLICY'} eq 'MODE0'){ $selected{'POLICY'}{'MODE0'} = 'selected'; } else { $selected{'POLICY'}{'MODE0'} = ''; }
125if ($outfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
126if ($outfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
127
2229c89e
CS
128