]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - html/cgi-bin/outgoingfw.cgi
Fix outgoing_fw monday checkbox.
[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 #
c791bb2a 5# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
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";
44my $p2pfile = "/var/ipfire/outgoing/p2protocols";
f2fdd0c1
CS
45my $servicefile = "/var/ipfire/outgoing/defaultservices";
46
47my %color = ();
48my %mainsettings = ();
49&General::readhash("${General::swroot}/main/settings", \%mainsettings);
50&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
d9b7aa33
MT
51
52&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
53
54&Header::showhttpheaders();
55
56### Values that have to be initialized
57$outfwsettings{'ACTION'} = '';
58$outfwsettings{'VALID'} = 'yes';
59$outfwsettings{'EDIT'} = 'no';
60$outfwsettings{'NAME'} = '';
61$outfwsettings{'SNET'} = '';
62$outfwsettings{'SIP'} = '';
63$outfwsettings{'SPORT'} = '';
64$outfwsettings{'SMAC'} = '';
65$outfwsettings{'DIP'} = '';
66$outfwsettings{'DPORT'} = '';
67$outfwsettings{'PROT'} = '';
68$outfwsettings{'STATE'} = '';
69$outfwsettings{'DISPLAY_DIP'} = '';
70$outfwsettings{'DISPLAY_DPORT'} = '';
71$outfwsettings{'DISPLAY_SMAC'} = '';
72$outfwsettings{'DISPLAY_SIP'} = '';
1fde937c 73$outfwsettings{'POLICY'} = 'MODE0';
5595bc03 74$outfwsettings{'MODE1LOG'} = 'off';
d9b7aa33 75
39008af7
CS
76$outfwsettings{'TIME_FROM'} = '00:00';
77$outfwsettings{'TIME_TO'} = '00:00';
78
d9b7aa33
MT
79&General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings);
80&Header::getcgihash(\%outfwsettings);
81
2229c89e
CS
82###############
83# DEBUG DEBUG
84#&Header::openbox('100%', 'left', 'DEBUG');
85#my $debugCount = 0;
86#foreach my $line (sort keys %outfwsettings) {
87#print "$line = $outfwsettings{$line}<br />\n";
88# $debugCount++;
89#}
90#print "&nbsp;Count: $debugCount\n";
91#&Header::closebox();
92# DEBUG DEBUG
93###############
94
39008af7
CS
95$selected{'TIME_FROM'}{$outfwsettings{'TIME_FROM'}} = "selected='selected'";
96$selected{'TIME_TO'}{$outfwsettings{'TIME_TO'}} = "selected='selected'";
97
5595bc03
CS
98$checked{'MODE1LOG'}{'off'} = '';
99$checked{'MODE1LOG'}{'on'} = '';
100$checked{'MODE1LOG'}{$outfwsettings{'MODE1LOG'}} = "checked='checked'";
39008af7
CS
101$checked{'TIME_MON'}{'off'} = '';
102$checked{'TIME_MON'}{'on'} = '';
103$checked{'TIME_MON'}{$outfwsettings{'TIME_MON'}} = "checked='checked'";
104$checked{'TIME_TUE'}{'off'} = '';
105$checked{'TIME_TUE'}{'on'} = '';
106$checked{'TIME_TUE'}{$outfwsettings{'TIME_TUE'}} = "checked='checked'";
107$checked{'TIME_WED'}{'off'} = '';
108$checked{'TIME_WED'}{'on'} = '';
109$checked{'TIME_WED'}{$outfwsettings{'TIME_WED'}} = "checked='checked'";
110$checked{'TIME_THU'}{'off'} = '';
111$checked{'TIME_THU'}{'on'} = '';
112$checked{'TIME_THU'}{$outfwsettings{'TIME_THU'}} = "checked='checked'";
113$checked{'TIME_FRI'}{'off'} = '';
114$checked{'TIME_FRI'}{'on'} = '';
115$checked{'TIME_FRI'}{$outfwsettings{'TIME_FRI'}} = "checked='checked'";
116$checked{'TIME_SAT'}{'off'} = '';
117$checked{'TIME_SAT'}{'on'} = '';
118$checked{'TIME_SAT'}{$outfwsettings{'TIME_SAT'}} = "checked='checked'";
119$checked{'TIME_SUN'}{'off'} = '';
120$checked{'TIME_SUN'}{'on'} = '';
121$checked{'TIME_SUN'}{$outfwsettings{'TIME_SUN'}} = "checked='checked'";
5595bc03 122
d9b7aa33
MT
123if ($outfwsettings{'POLICY'} eq 'MODE0'){ $selected{'POLICY'}{'MODE0'} = 'selected'; } else { $selected{'POLICY'}{'MODE0'} = ''; }
124if ($outfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
125if ($outfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
126
2229c89e
CS
127