]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/optionsfw.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
9 # Copyright (C) 01-02-2002 Graham Smith <grhm@grhm.co.uk>
11 # $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
15 # enable only the following on debugging purpose
17 #use CGI::Carp 'fatalsToBrowser';
19 require '/var/ipfire/general-functions.pl';
20 require "${General::swroot}/lang.pl";
21 require "${General::swroot}/header.pl";
24 my %checked =(); # Checkbox manipulations
27 my $filename = "${General::swroot}/optionsfw/settings";
31 $settings{'DISABLEPING'} = 'NO';
32 $settings{'ACTION'} = ''; # add/edit/remove
34 my $errormessage = '';
37 &Header
::showhttpheaders
();
40 &Header
::getcgihash
(\
%settings);
42 if ($settings{'ACTION'} eq $Lang::tr
{'save'}) {
43 if ($settings{'DISABLEPING'} !~ /^(NO|ONLYRED|ALL)$/) {
44 $errormessage = $Lang::tr
{'invalid input'};
46 unless ($errormessage) { # Everything is ok, save settings
47 &General
::writehash
($filename, \
%settings); # Save good settings
48 $settings{'ACTION'} = $Lang::tr
{'save'}; # Recreate 'ACTION'
49 system('/usr/local/bin/setfilters');
52 ERROR
: # Leave the faulty field untouched
54 &General
::readhash
($filename, \
%settings); # Get saved settings and reset to good if needed
56 $checked{'DISABLEPING'}{'NO'} = '';
57 $checked{'DISABLEPING'}{'ONLYRED'} = '';
58 $checked{'DISABLEPING'}{'ALL'} = '';
59 $checked{'DISABLEPING'}{$settings{'DISABLEPING'}} = "checked='checked'";
61 &Header
::openpage
($Lang::tr
{'options fw'}, 1, '');
62 &Header
::openbigbox
('100%', 'left', '', $errormessage);
65 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
66 print "<font class='base'>$errormessage </font>";
70 &Header
::openbox
('100%', 'left', $Lang::tr
{'options fw'});
71 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
76 <td class='base' width='100%' colspan='3'><b>$Lang::tr{'ping disabled'}</b></td>
79 <td class='base'><input type='radio' name='DISABLEPING' value='NO' $checked{'DISABLEPING'}{'NO'} />$Lang::tr{'no'}</td>
83 <td><input type='radio' name='DISABLEPING' value='ONLYRED' $checked{'DISABLEPING'}{'ONLYRED'} />$Lang::tr{'only red'}</td>
84 <td width='80%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
87 <td><input type='radio' name='DISABLEPING' value='ALL' $checked{'DISABLEPING'}{'ALL'} />$Lang::tr{'all interfaces'}</td>
88 <td class='base' width='10%' align='right'><!-- Space for future online help link --></td>
96 &Header
::closebigbox
();