pakfire cgi not refreshes after upgrades
[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';
35
36my $errormessage = '';
37my $warnmessage = '';
38
39&Header::showhttpheaders();
40
41#Get GUI values
42&Header::getcgihash(\%settings);
43
44if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
45 $errormessage = $Lang::tr{'new optionsfw later'};
46 delete $settings{'__CGI__'};delete $settings{'x'};delete $settings{'y'};
47 &General::writehash($filename, \%settings); # Save good settings
48 } else {
49 &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed
50 }
51
52&Header::openpage($Lang::tr{'options fw'}, 1, '');
53&Header::openbigbox('100%', 'left', '', $errormessage);
54
55if ($errormessage) {
56 &Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
57 print "<font color='red'>$errormessage&nbsp;</font>";
58 &Header::closebox();
59}
60
61$checked{'DROPNEWNOTSYN'}{'off'} = '';
62$checked{'DROPNEWNOTSYN'}{'on'} = '';
63$checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'";
64$checked{'DROPINPUT'}{'off'} = '';
65$checked{'DROPINPUT'}{'on'} = '';
66$checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'";
67$checked{'DROPOUTPUT'}{'off'} = '';
68$checked{'DROPOUTPUT'}{'on'} = '';
69$checked{'DROPOUTPUT'}{$settings{'DROPOUTPUT'}} = "checked='checked'";
70$checked{'DROPPORTSCAN'}{'off'} = '';
71$checked{'DROPPORTSCAN'}{'on'} = '';
72$checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
73
74&Header::openbox('100%', 'center', $Lang::tr{'options fw'});
75print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
76
77print <<END
78<form method='post' action='$ENV{'SCRIPT_NAME'}'>
79<table width='95%' cellspacing='0'>
80<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
81<tr><td align='left' width='40%'>$Lang::tr{'drop newnotsyn'}</td><td align='left'>on <input type='radio' name='DROPNEWNOTSYN' value='on' $checked{'DROPNEWNOTSYN'}{'on'} />/
82 <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
83<tr><td align='left' width='40%'>$Lang::tr{'drop input'}</td><td align='left'>on <input type='radio' name='DROPINPUT' value='on' $checked{'DROPINPUT'}{'on'} />/
84 <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
85<tr><td align='left' width='40%'>$Lang::tr{'drop output'}</td><td align='left'>on <input type='radio' name='DROPOUTPUT' value='on' $checked{'DROPOUTPUT'}{'on'} />/
86 <input type='radio' name='DROPOUTPUT' value='off' $checked{'DROPOUTPUT'}{'off'} /> off</td></tr>
87<tr><td align='left' width='40%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/
88 <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
89</table>
90<br />
91<table width='10%' cellspacing='0'>
92<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
93 <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
94 <input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td></tr>
95</table>
96</form>
97END
98;
99&Header::closebox();
100&Header::closebigbox();
101&Header::closepage();