X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fdhcp.cgi;h=9a7d983eefd0233693a9e647a4c692ef2ef05442;hb=bc2b3e9483f37ec497b3460faf0208cfb87cdfc5;hp=1ccaa400310bbd3325e0e8e1cb263686ef003909;hpb=26f58f3d030272b405acbcf1df624d3b98c97d6e;p=ipfire-2.x.git diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi index 1ccaa40031..9a7d983eef 100644 --- a/html/cgi-bin/dhcp.cgi +++ b/html/cgi-bin/dhcp.cgi @@ -1,29 +1,29 @@ #!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# -# Copyright (C) 01-02-2002 Graham Smith -# - Fixed DHCP Leases added -# -# $Id: dhcp.cgi,v 1.14.2.81 2006/01/20 12:05:29 franck78 Exp $ -# -# Franck -rewrite for two or more interface -# nov/2004 -check range is in correct subnet -# -add NTP option -# -add display sorting of actives leases -# dec/2004 -add comment field to fixed leases -# -# to do : choose a correct format for displaying dates -# +############################################################################### +# # +# 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 . # +# # +############################################################################### + use strict; # enable only the following on debugging purpose -use warnings; -use CGI::Carp 'fatalsToBrowser'; +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; @@ -44,12 +44,14 @@ our $filename3 = "${General::swroot}/dhcp/advoptions-list"; # Describe the allow my $errormessage = ''; my $warnNTPmessage = ''; my @nosaved=(); +my %color = (); #Basic syntax allowed for new Option definition. Not implemented: RECORDS & array of RECORDS our $OptionTypes = 'boolean|((un)?signed )?integer (8|16|32)|ip-address|text|string|encapsulate \w+|array of ip-address'; &Header::showhttpheaders(); -our @ITFs=('GREEN','BLUE'); +our @ITFs=('GREEN'); +if (&Header::blue_used()){push(@ITFs,'BLUE');} #Settings1 for the first screen box foreach my $itf (@ITFs) { @@ -101,6 +103,7 @@ foreach my $itf (@ITFs) { &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("${General::swroot}/time/settings", \%timesettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); #Get GUI values &Header::getcgihash(\%dhcpsettings); @@ -541,9 +544,9 @@ print < $Lang::tr{'ip address'}
$Lang::tr{'netmask'}:$netsettings{"${itf}_ADDRESS"}
$netsettings{"${itf}_NETMASK"}
- $Lang::tr{'start address'} * + $Lang::tr{'start address'} - $Lang::tr{'end address'} * + $Lang::tr{'end address'} $Lang::tr{'default lease time'} @@ -587,8 +590,7 @@ print < * $Lang::tr{'this field may be blank'} $warnNTPmessage - -   + @@ -648,7 +650,7 @@ print < * $Lang::tr{'dhcp advopt scope help'} - + @@ -720,9 +722,9 @@ foreach my $line (@current1) { if ($dhcpsettings{'KEY1'} eq $key) { print ""; } elsif ($key % 2) { - print ""; + print ""; } else { - print ""; + print ""; } print < * $Lang::tr{'this field may be blank'} - + @@ -861,15 +863,15 @@ END print < - +
- - - - - - - + + + + + + + END ; @@ -901,6 +903,7 @@ foreach my $line (@current2) { } $key = 0; +my $col=""; foreach my $line (@current2) { my $gif = ''; my $gdesc = ''; @@ -916,11 +919,14 @@ foreach my $line (@current2) { } if ($dhcpsettings{'KEY2'} eq $key) { - print ""; + print ""; + $col="bgcolor='${Header::colouryellow}'"; } elsif ($key % 2) { - print ""; + print ""; + $col="bgcolor='$color{'color20'}'"; } else { - print ""; + print ""; + $col="bgcolor='$color{'color22'}'"; } my $TAG0 = ''; my $TAG1 = ''; @@ -940,14 +946,14 @@ foreach my $line (@current2) { } print <$TAG2$temp[0]$TAG3 - - - - - - - + + + + + + + - -
$Lang::tr{'mac address'}$Lang::tr{'ip address'}$Lang::tr{'remark'}next-serverfilenameroot path$Lang::tr{'action'}$Lang::tr{'mac address'}$Lang::tr{'ip address'}$Lang::tr{'remark'}next-serverfilenameroot path$Lang::tr{'action'}
$TAG0$temp[1]$TAG1$temp[6] $temp[3] $temp[4] $temp[5]  +$TAG2$temp[0]$TAG3$TAG0$temp[1]$TAG1$temp[6] $temp[3] $temp[4] $temp[5] 
@@ -955,7 +961,7 @@ foreach my $line (@current2) {
+
@@ -963,7 +969,7 @@ foreach my $line (@current2) {
+
@@ -1011,33 +1017,6 @@ END &Header::closebox(); -&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); -my @ip = qx(/sbin/ip neigh show | awk '{print \$1}'); -my @mac = qx(/sbin/ip neigh show | awk '{print \$5}'); - -print < - - - - -END -; -my $i=0; - -foreach my $ip(@ip) -{ - print""; - print""; - print""; -} - - -print"
$Lang::tr{'ip address'}$Lang::tr{'mac address'}Optionen
$ip@mac[$i]
"; - -&Header::closebox(); - - foreach my $itf (@ITFs) { if ($dhcpsettings{"ENABLE_${itf}"} eq 'on') { # display leases with a list of actions to do with the global select checkbox. @@ -1199,11 +1178,9 @@ sub buildconf { print FILE "} #$itf\n"; system ('/usr/bin/touch', "${General::swroot}/dhcp/enable_${lc_itf}"); - system ('/usr/local/bin/dhcpctrl enable'); &General::log("DHCP on ${itf}: " . $Lang::tr{'dhcp server enabled'}) } else { unlink "${General::swroot}/dhcp/enable_${lc_itf}"; - system ('/usr/local/bin/dhcpctrl disable'); &General::log("DHCP on ${itf}: " . $Lang::tr{'dhcp server disabled'}) } } @@ -1225,7 +1202,10 @@ sub buildconf { $key++; } } + print FILE "include \"${General::swroot}/dhcp/dhcpd.conf.local\";\n"; close FILE; + if ( $dhcpsettings{"ENABLE_GREEN"} eq 'on' || $dhcpsettings{"ENABLE_BLUE"} eq 'on' ) {system '/usr/local/bin/dhcpctrl enable >/dev/null 2>&1';} + else {system '/usr/local/bin/dhcpctrl disable >/dev/null 2>&1';} system '/usr/local/bin/dhcpctrl restart >/dev/null 2>&1'; }