From: <ow...@us...> - 2009-06-28 16:03:28
|
Revision: 3148 http://ipcop.svn.sourceforge.net/ipcop/?rev=3148&view=rev Author: owes Date: 2009-06-28 16:02:28 +0000 (Sun, 28 Jun 2009) Log Message: ----------- Defaults should also be (re-)shown after changing sort, deleting, etc. Remove some dead code. BTW: I am considering moving hosts to 'Network' menu section. Modified Paths: -------------- ipcop/trunk/html/cgi-bin/hosts.cgi Modified: ipcop/trunk/html/cgi-bin/hosts.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/hosts.cgi 2009-06-28 15:56:28 UTC (rev 3147) +++ ipcop/trunk/html/cgi-bin/hosts.cgi 2009-06-28 16:02:28 UTC (rev 3148) @@ -1,9 +1,21 @@ #!/usr/bin/perl # -# IPCop CGIs +# This file is part of the IPCop Firewall. # -# This code is distributed under the terms of the GPL +# IPCop is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # +# IPCop is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with IPCop; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# # (c) Alan Hourihane <al...@fa...> # # $Id$ @@ -26,10 +38,6 @@ require '/usr/lib/ipcop/lang.pl'; require '/usr/lib/ipcop/header.pl'; -#workaround to suppress a warning when a variable is used only once -my @dummy = (${Header::colouryellow}); -undef(@dummy); - # Files used my $settingsfilename = '/var/ipcop/main/settings'; our $datafile = '/var/ipcop/main/hosts'; #(our: used in subroutine) @@ -41,7 +49,7 @@ #Settings2 for editing the multi-line list #Must not be saved ! -$settings{'EN'} = ''; # reuse for dummy field in position zero +$settings{'EN'} = ''; # reuse for dummy field in position zero $settings{'IP'} = ''; $settings{'HOST'} = ''; $settings{'DOM'} = ''; @@ -68,7 +76,6 @@ close(FILE); } -## Settings1 Box not used... &General::readhash($settingsfilename, \%settings); ## Now manipulate the multi-line list with Settings2 @@ -122,7 +129,6 @@ } else { @current[ $settings{'KEY1'} ] = "$settings{'EN'},$settings{'IP'},$settings{'HOST'},$settings{'DOM'}\n"; - $settings{'KEY1'} = ''; # End edit mode &General::log($Lang::tr{'hosts config changed'}); } @@ -130,7 +136,7 @@ &SortDataFile; # sort newly added/modified entry &BuildConfiguration; # then re-build new host - #map ($settings{$_}='' ,@nosaved); # Clear fields + map ($settings{$_}='' ,@nosaved, 'ACTION', 'KEY1'); # Clear fields } } @@ -151,10 +157,10 @@ open(FILE, ">$datafile") or die 'hosts datafile error'; print FILE @current; close(FILE); - $settings{'KEY1'} = ''; # End remove mode &General::log($Lang::tr{'hosts config changed'}); &BuildConfiguration; # then re-build conf which use new data + map ($settings{$_} = '', @nosaved, 'ACTION', 'KEY1'); # and reinit vars to empty } ## Check if sorting is asked @@ -175,7 +181,6 @@ map (delete($settings{$_}), (@nosaved, 'ACTION', 'KEY1')); # Must never be saved &General::writehash($settingsfilename, \%settings); &SortDataFile; - $settings{'ACTION'} = 'SORT'; # Create an 'ACTION' map ($settings{$_} = '', @nosaved, 'KEY1'); # and reinit vars to empty } @@ -195,36 +200,6 @@ &Header::closebox(); } -# -# Remove if no Setting1 needed -# -#if ($warnmessage) { -# $warnmessage = "<font color=${Header::colourred}><b>$Lang::tr{'capswarning'}</b></font>: $warnmessage"; -#} -#&Header::openbox('100%', 'left', $Lang::tr{'settings'}); -#print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>"; -#print <<END -#<table width='100%'> -#<tr> -# <td class='base'>$Lang::tr{'domain name'} : $settings{'DOMAINNAME'}</td> -#</table> -# -#END -#; -# -#print <<END -#<table width='100%'> -#<hr /> -#<tr> -# <td class='base' width='25%'><!--<img src='/blob.gif' align='top' alt='*' /> $Lang::tr{'this field may be blank'}</td>--> -# <td class='base' width='25%'>$warnmessage</td> -# <td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' disabled='disabled' /></td> -#</tr> -#</table> -#</form> -#END -#; -#&Header::closebox(); # end of Settings1 # # Second check box is for editing the list @@ -297,7 +272,7 @@ } # -# Third box shows the list, in columns +# Box to show the list, in columns # # Columns headers may content a link. In this case it must be named in $sortstring # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |