]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/aliases.cgi
Add setup to core38 (it is branded with version number).
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / aliases.cgi
index d32d842f7054e965b926e194ddd271d71bf91f59..9043962c2df17d1df660845b1a6baddb709b8937 100644 (file)
@@ -1,23 +1,36 @@
 #!/usr/bin/perl
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program 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 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 #
-# IPFire CGI's - aliases.cgi
+# this cgi is base on IPCop CGI - aliases.cgi
 #
-# This code is distributed under the terms of the GPL
-#
-# (c) Steve Bootes 2002/04/13 - Manage IP Aliases
-#
-# $Id: aliases.cgi,v 1.5.2.14 2006/01/13 20:14:48 eoberlander Exp $
-
 
 # to fully troubleshot your code, uncomment diagnostics, Carp and cluck lines
 #use diagnostics; # need to add the file /usr/lib/perl5/5.8.x/pods/perldiag.pod before to work
 # next look at /var/log/httpd/error_log , http://www.perl.com/pub/a/2002/05/07/mod_perl.html may help
-use warnings;
+#use warnings;
 use strict;
 #use Carp ();
 #local $SIG{__WARN__} = \&Carp::cluck;
 
-require 'CONFIG_ROOT/general-functions.pl';    # replace CONFIG_ROOT with /var/ipfire in case of manual install
+require '/var/ipfire/general-functions.pl';    # replace /var/ipcop with /var/ipcop in case of manual install
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
@@ -106,7 +119,8 @@ if ($settings{'ACTION'} eq $Lang::tr{'toggle enable disable'}) {
     #move out new line
     chomp(@current[$settings{'KEY1'}]);
     my @temp = split(/\,/,@current[$settings{'KEY1'}]);
-    $temp[1] = $temp[1] eq 'on' ? '' : 'on';           # Toggle the field
+    $temp[1] = $temp[1] eq 'on' ? 'off' : 'on';                # Toggle the field
+    $temp[2] = '' if ( $temp[2] eq '' );
     @current[$settings{'KEY1'}] = join (',',@temp)."\n";
     $settings{'KEY1'} = '';                            # End edit mode
     
@@ -230,7 +244,7 @@ if ($errormessage) {
     print "<font class='base'>$errormessage&nbsp;</font>";
     &Header::closebox();
 }
-unless (( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ ) && ($netsettings{'RED_TYPE'} eq 'STATIC'))
+unless (( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ ) && ($netsettings{'RED_TYPE'} eq 'STATIC'))
 {
     &Header::openbox('100%', 'left', $Lang::tr{'capswarning'});
     print <<END
@@ -247,7 +261,7 @@ END
 #
 # Second check box is for editing the list
 #
-$checked{'ENABLED'}{'on'} = ($settings{'ENABLED'} eq '') ? '' :  "checked='checked'";
+$checked{'ENABLED'}{'on'} = ($settings{'ENABLED'} eq 'on') ? "checked='checked'" : '' ;
 
 my $buttontext = $Lang::tr{'add'};
 if ($settings{'KEY1'} ne '') {
@@ -274,8 +288,10 @@ print <<END
 <hr />
 <table width='100%'>
 <tr>
-    <td class='base' width='50%'><img src='/blob.gif' align='top' alt='*' />&nbsp;$Lang::tr{'this field may be blank'}</td>
-    <td width='50%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
+    <td class='base' width='55%'><img src='/blob.gif' align='top' alt='*' />&nbsp;$Lang::tr{'this field may be blank'}</td>
+    <td width='40%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
+    <td width='5%' align='right'> 
+    </td>
 </tr>
 </table>
 </form>
@@ -283,6 +299,20 @@ END
 ;
 &Header::closebox();
 
+# Add visual indicators to column headings to show sort order - EO
+my $sortarrow1 = '';
+my $sortarrow2 = '';
+
+if ($netsettings{'SORT_ALIASES'} eq 'NAMERev') {
+       $sortarrow1 = $Header::sortdn;
+} elsif ($netsettings{'SORT_ALIASES'} eq 'NAME') {
+       $sortarrow1 = $Header::sortup;
+} elsif ($netsettings{'SORT_ALIASES'} eq 'IPRev') {
+       $sortarrow2 = $Header::sortdn;
+} else {
+       $sortarrow2 = $Header::sortup;
+}
+
 #
 # Third box shows the list, in columns
 #
@@ -292,9 +322,9 @@ END
 print <<END
 <table width='100%'>
 <tr>
-    <td width='50%' align='center'><a href='$ENV{'SCRIPT_NAME'}?NAME'><b>$Lang::tr{'name'}</b></a></td>
-    <td width='40%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IP'><b>$Lang::tr{'alias ip'}</b></a></td>
-    <td width='10%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></td>
+    <td width='50%' align='center'><a href='$ENV{'SCRIPT_NAME'}?NAME'><b>$Lang::tr{'name'}</b></a> $sortarrow1</td>
+    <td width='45%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IP'><b>$Lang::tr{'alias ip'}</b></a> $sortarrow2</td>
+    <td width='5%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></td>
 </tr>
 END
 ;