#!/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 <grhm@grhm.co.uk>
-# - 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 <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
use strict;
# enable only the following on debugging purpose
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) {
&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);
<td width='25%' class='boldbase'><b><font color='${lc_itf}'>$Lang::tr{"$lc_itf interface"}</font></b></td>
<td class='base'>$Lang::tr{'enabled'}
<input type='checkbox' name='ENABLE_${itf}' $checked{'ENABLE'}{'on'} /></td>
- <td width='25%' class='base'>$Lang::tr{'ip address'}/$Lang::tr{'netmask'}:</td><td><b>$netsettings{"${itf}_ADDRESS"}/$netsettings{"${itf}_NETMASK"}</b></td>
+ <td width='25%' class='base'>$Lang::tr{'ip address'}<br />$Lang::tr{'netmask'}:</td><td><b>$netsettings{"${itf}_ADDRESS"}<br />$netsettings{"${itf}_NETMASK"}</b></td>
</tr><tr>
- <td width='25%' class='base'>$Lang::tr{'start address'} <img src='/blob.gif' alt='*' /></td>
+ <td width='25%' class='base'>$Lang::tr{'start address'}</td>
<td width='25%'><input type='text' name='START_ADDR_${itf}' value='$dhcpsettings{"START_ADDR_${itf}"}' /></td>
- <td width='25%' class='base'>$Lang::tr{'end address'} <img src='/blob.gif' alt='*' /></td>
+ <td width='25%' class='base'>$Lang::tr{'end address'}</td>
<td width='25%'><input type='text' name='END_ADDR_${itf}' value='$dhcpsettings{"END_ADDR_${itf}"}' /></td>
</tr><tr>
<td class='base'>$Lang::tr{'default lease time'}</td>
if ($dhcpsettings{'KEY1'} eq $key) {
print "<tr bgcolor='${Header::colouryellow}'>";
} elsif ($key % 2) {
- print "<tr bgcolor='${Header::table2colour}'>";
+ print "<tr bgcolor='$color{'color22'}'>";
} else {
- print "<tr bgcolor='${Header::table1colour}'>";
+ print "<tr bgcolor='$color{'color20'}'>";
}
print <<END
if ($dhcpsettings{'KEY2'} eq $key) {
print "<tr bgcolor='${Header::colouryellow}'>";
} elsif ($key % 2) {
- print "<tr bgcolor='${Header::table2colour}'>";
+ print "<tr bgcolor='$color{'color22'}'>";
} else {
- print "<tr bgcolor='${Header::table1colour}'>";
+ print "<tr bgcolor='$color{'color20'}'>";
}
my $TAG0 = '';
my $TAG1 = '';
&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.
}
}
close FILE;
- system '/usr/local/bin/restartdhcp';
+ 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';
}
#