Forward Firewall: Fixed Bug: When deleting a rule, only the last entry in the list...
[people/teissler/ipfire-2.x.git] / html / cgi-bin / optionsfw.cgi
CommitLineData
5595bc03
CS
1#!/usr/bin/perl
2#
3# SmoothWall CGIs
4#
5# This code is distributed under the terms of the GPL
6#
7# (c) The SmoothWall Team
8#
9# Copyright (C) 01-02-2002 Graham Smith <grhm@grhm.co.uk>
10#
11# $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
12#
13#
14
15# enable only the following on debugging purpose
16#use warnings;
17#use CGI::Carp 'fatalsToBrowser';
18
19require '/var/ipfire/general-functions.pl';
20require "${General::swroot}/lang.pl";
21require "${General::swroot}/header.pl";
22
23
24my %checked =(); # Checkbox manipulations
25
26# File used
27my $filename = "${General::swroot}/optionsfw/settings";
28
29our %settings=();
30$settings{'DISABLEPING'} = 'NO';
31$settings{'DROPNEWNOTSYN'} = 'on';
32$settings{'DROPINPUT'} = 'on';
33$settings{'DROPOUTPUT'} = 'on';
34$settings{'DROPPORTSCAN'} = 'on';
42dc0090
CS
35$settings{'DROPWIRELESSINPUT'} = 'on';
36$settings{'DROPWIRELESSFORWARD'} = 'on';
5595bc03
CS
37
38my $errormessage = '';
39my $warnmessage = '';
40
41&Header::showhttpheaders();
42
43#Get GUI values
44&Header::getcgihash(\%settings);
45
46if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
47 $errormessage = $Lang::tr{'new optionsfw later'};
48 delete $settings{'__CGI__'};delete $settings{'x'};delete $settings{'y'};
49 &General::writehash($filename, \%settings); # Save good settings
50 } else {
51 &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed
52 }
53
54&Header::openpage($Lang::tr{'options fw'}, 1, '');
55&Header::openbigbox('100%', 'left', '', $errormessage);
56
57if ($errormessage) {
58 &Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
59 print "<font color='red'>$errormessage&nbsp;</font>";
60 &Header::closebox();
61}
62
63$checked{'DROPNEWNOTSYN'}{'off'} = '';
64$checked{'DROPNEWNOTSYN'}{'on'} = '';
65$checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'";
66$checked{'DROPINPUT'}{'off'} = '';
67$checked{'DROPINPUT'}{'on'} = '';
68$checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'";
69$checked{'DROPOUTPUT'}{'off'} = '';
70$checked{'DROPOUTPUT'}{'on'} = '';
71$checked{'DROPOUTPUT'}{$settings{'DROPOUTPUT'}} = "checked='checked'";
72$checked{'DROPPORTSCAN'}{'off'} = '';
73$checked{'DROPPORTSCAN'}{'on'} = '';
74$checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
42dc0090
CS
75$checked{'DROPWIRELESSINPUT'}{'off'} = '';
76$checked{'DROPWIRELESSINPUT'}{'on'} = '';
77$checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'";
78$checked{'DROPWIRELESSFORWARD'}{'off'} = '';
79$checked{'DROPWIRELESSFORWARD'}{'on'} = '';
80$checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'";
0aaef8e9
CS
81$checked{'DROPPROXY'}{'off'} = '';
82$checked{'DROPPROXY'}{'on'} = '';
83$checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'";
84$checked{'DROPSAMBA'}{'off'} = '';
85$checked{'DROPSAMBA'}{'on'} = '';
86$checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'";
5595bc03
CS
87
88&Header::openbox('100%', 'center', $Lang::tr{'options fw'});
89print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
90
91print <<END
92<form method='post' action='$ENV{'SCRIPT_NAME'}'>
93<table width='95%' cellspacing='0'>
94<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
0b06ad05 95<tr><td align='left' width='60%'>$Lang::tr{'drop newnotsyn'}</td><td align='left'>on <input type='radio' name='DROPNEWNOTSYN' value='on' $checked{'DROPNEWNOTSYN'}{'on'} />/
5595bc03 96 <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
0b06ad05 97<tr><td align='left' width='60%'>$Lang::tr{'drop input'}</td><td align='left'>on <input type='radio' name='DROPINPUT' value='on' $checked{'DROPINPUT'}{'on'} />/
5595bc03 98 <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
0b06ad05 99<tr><td align='left' width='60%'>$Lang::tr{'drop output'}</td><td align='left'>on <input type='radio' name='DROPOUTPUT' value='on' $checked{'DROPOUTPUT'}{'on'} />/
5595bc03 100 <input type='radio' name='DROPOUTPUT' value='off' $checked{'DROPOUTPUT'}{'off'} /> off</td></tr>
0b06ad05 101<tr><td align='left' width='60%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/
5595bc03 102 <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
0b06ad05 103<tr><td align='left' width='60%'>$Lang::tr{'drop wirelessinput'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSINPUT' value='on' $checked{'DROPWIRELESSINPUT'}{'on'} />/
42dc0090 104 <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr>
0b06ad05 105<tr><td align='left' width='60%'>$Lang::tr{'drop wirelessforward'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSFORWARD' value='on' $checked{'DROPWIRELESSFORWARD'}{'on'} />/
42dc0090 106 <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr>
5595bc03
CS
107</table>
108<br />
0aaef8e9
CS
109<table width='95%' cellspacing='0'>
110<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw blue'}</b></td></tr>
0b06ad05 111<tr><td align='left' width='60%'>$Lang::tr{'drop proxy'}</td><td align='left'>on <input type='radio' name='DROPPROXY' value='on' $checked{'DROPPROXY'}{'on'} />/
0aaef8e9 112 <input type='radio' name='DROPPROXY' value='off' $checked{'DROPPROXY'}{'off'} /> off</td></tr>
0b06ad05 113<tr><td align='left' width='60%'>$Lang::tr{'drop samba'}</td><td align='left'>on <input type='radio' name='DROPSAMBA' value='on' $checked{'DROPSAMBA'}{'on'} />/
0aaef8e9
CS
114 <input type='radio' name='DROPSAMBA' value='off' $checked{'DROPSAMBA'}{'off'} /> off</td></tr>
115</table>
116<br />
5595bc03
CS
117<table width='10%' cellspacing='0'>
118<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
119 <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
120 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td></tr>
121</table>
122</form>
123END
124;
125&Header::closebox();
126&Header::closebigbox();
127&Header::closepage();