]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/optionsfw.cgi
HinzugefĆ¼gt:
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / optionsfw.cgi
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
19 require '/var/ipfire/general-functions.pl';
20 require "${General::swroot}/lang.pl";
21 require "${General::swroot}/header.pl";
22
23
24 my %checked =(); # Checkbox manipulations
25
26 # File used
27 my $filename = "${General::swroot}/optionsfw/settings";
28
29 our %settings=();
30 #Settings1
31 $settings{'DISABLEPING'} = 'NO';
32 $settings{'ACTION'} = ''; # add/edit/remove
33
34 my $errormessage = '';
35 my $warnmessage = '';
36
37 &Header::showhttpheaders();
38
39 #Get GUI values
40 &Header::getcgihash(\%settings);
41
42 if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
43 if ($settings{'DISABLEPING'} !~ /^(NO|ONLYRED|ALL)$/) {
44 $errormessage = $Lang::tr{'invalid input'};
45 goto ERROR; }
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');
50 }
51
52 ERROR: # Leave the faulty field untouched
53 } else {
54 &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed
55 }
56 $checked{'DISABLEPING'}{'NO'} = '';
57 $checked{'DISABLEPING'}{'ONLYRED'} = '';
58 $checked{'DISABLEPING'}{'ALL'} = '';
59 $checked{'DISABLEPING'}{$settings{'DISABLEPING'}} = "checked='checked'";
60
61 &Header::openpage($Lang::tr{'options fw'}, 1, '');
62 &Header::openbigbox('100%', 'left', '', $errormessage);
63
64 if ($errormessage) {
65 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
66 print "<font class='base'>$errormessage&nbsp;</font>";
67 &Header::closebox();
68 }
69
70 &Header::openbox('100%', 'left', $Lang::tr{'options fw'});
71 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
72
73 print <<END
74 <table width='100%'>
75 <tr>
76 <td class='base' width='100%' colspan='3'><b>$Lang::tr{'ping disabled'}</b></td>
77 </tr>
78 <tr>
79 <td class='base'><input type='radio' name='DISABLEPING' value='NO' $checked{'DISABLEPING'}{'NO'} />$Lang::tr{'no'}</td>
80 <td>&nbsp;</td>
81 </tr>
82 <tr>
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>
85 </tr>
86 <tr>
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>
89 </tr>
90 </table>
91 </form>
92 END
93 ;
94 &Header::closebox();
95
96 &Header::closebigbox();
97
98 &Header::closepage();