From f365fa90eb84a32e87773263a95df309e9133578 Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 16:57:50 -0600 Subject: Changed the variable name to dhcpleaseinlocaltime from timeformatchange per jim-p request and moved xml tag into dhcpd. --- usr/local/www/services_dhcp.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 6cc8674..3895268 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -151,7 +151,7 @@ if (is_array($config['dhcpd'][$if])){ $pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip']; $pconfig['netmask'] = $config['dhcpd'][$if]['netmask']; $pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions']; - $pconfig['timeformatchange'] = $config['system']['timeformatchange']; + $pconfig['dhcpleaseinlocaltime'] = $config['dhcpd'][$if]['dhcpleaseinlocaltime']; if (!is_array($config['dhcpd'][$if]['staticmap'])) $config['dhcpd'][$if]['staticmap'] = array(); $a_maps = &$config['dhcpd'][$if]['staticmap']; @@ -381,7 +381,7 @@ if ($_POST) { $config['dhcpd'][$if]['nextserver'] = $_POST['nextserver']; $config['dhcpd'][$if]['filename'] = $_POST['filename']; $config['dhcpd'][$if]['rootpath'] = $_POST['rootpath']; - $config['system']['timeformatchange'] = $_POST['timeformatchange']; + $config['dhcpd'][$if]['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime']; // Handle the custom options rowhelper if(isset($config['dhcpd'][$if]['numberoptions']['item'])) @@ -480,6 +480,7 @@ include("head.inc"); document.iform.domain.disabled = endis; document.iform.domainsearchlist.disabled = endis; document.iform.staticarp.disabled = endis; + document.iform.dhcpleaseinlocaltime.disabled = endis; document.iform.ddnsdomain.disabled = endis; document.iform.ddnsupdate.disabled = endis; document.iform.ntp1.disabled = endis; @@ -736,7 +737,7 @@ include("head.inc");
- > + > -- cgit v1.1 From 138208bf779d341f427cdfbb319d479343c80152 Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 17:18:30 -0600 Subject: Changed the variable name from timeformtchangev6 to dhcpv6leaseinlocaltime per jim-p request and it will now write the xml dhcpv6leaseinlocaltime in the dhcpv6 sub catagory in the config.xml file. --- usr/local/www/services_dhcpv6.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 5a22676..5390dac 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -119,7 +119,7 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['failover_peerip'] = $config['dhcpdv6'][$if]['failover_peerip']; $pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask']; $pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions']; - $pconfig['timeformatchangev6'] = $config['system']['timeformatchangev6']; + $pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime']; if (!is_array($config['dhcpdv6'][$if]['staticmap'])) $config['dhcpdv6'][$if]['staticmap'] = array(); $a_maps = &$config['dhcpdv6'][$if]['staticmap']; @@ -319,7 +319,7 @@ if ($_POST) { $config['dhcpdv6'][$if]['nextserver'] = $_POST['nextserver']; $config['dhcpdv6'][$if]['filename'] = $_POST['filename']; $config['dhcpdv6'][$if]['rootpath'] = $_POST['rootpath']; - $config['system']['timeformatchangev6'] = $_POST['timeformatchangev6']; + $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime']; // Handle the custom options rowhelper if(isset($config['dhcpdv6'][$if]['numberoptions']['item'])) @@ -403,6 +403,7 @@ include("head.inc"); document.iform.maxtime.disabled = endis; document.iform.gateway.disabled = endis; document.iform.failover_peerip.disabled = endis; + document.iform.dhcpv6leaseinlocaltime.disabled = endis; document.iform.domain.disabled = endis; document.iform.domainsearchlist.disabled = endis; document.iform.ddnsdomain.disabled = endis; @@ -666,7 +667,7 @@ include("head.inc");
- > + > -- cgit v1.1 From e085eba5898fa6f351d2b07ed30acece9de8bfc3 Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 18:38:19 -0600 Subject: I now parses the xml tags in the dhcpd to check if an interface for DHCP lease is using local time if not defaults to UTC time. --- usr/local/www/status_dhcp_leases.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index a00c94e..5b65cc9 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -95,18 +95,19 @@ function leasecmp($a, $b) { } function adjust_gmt($dt) { - global $config; - $sysctl = $config['system']; - $timezone = $sysctl['timezone']; - $timeformatchange = $sysctl['timeformatchange']; + global $config; + $dhcpd = $config['dhcpd']; + foreach ($dhcpd as $dhcpleaseinlocaltime) + $dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime']; + $timezone = $config['system']['timezone']; $ts = strtotime($dt . " GMT"); - if ($timeformatchange == "yes") { + if ($dhcpleaseinlocaltime == "yes") { $this_tz = new DateTimeZone($timezone); $dhcp_lt = new DateTime(strftime("%I:%M:%S%p", $ts), $this_tz); $offset = $this_tz->getOffset($dhcp_lt); $ts = $ts + $offset; return strftime("%Y/%m/%d %I:%M:%S%p", $ts); - } + } else return strftime("%Y/%m/%d %H:%M:%S", $ts); } -- cgit v1.1 From ee0f23b4fda71e60d5d2959a9ac484b78799eeec Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 18:58:36 -0600 Subject: I now parses the xml tags in the dhcpdv6 to check if an interface for DHCPv6 lease is using local time if not defaults to UTC time. --- usr/local/www/status_dhcpv6_leases.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php index c4d7aa7..2f2696d 100644 --- a/usr/local/www/status_dhcpv6_leases.php +++ b/usr/local/www/status_dhcpv6_leases.php @@ -96,12 +96,16 @@ function leasecmp($a, $b) { } function adjust_gmt($dt) { - global $config; - $sysctl = $config['system']; - $timezone = $sysctl['timezone']; - $timeformatchangev6 = $sysctl['timeformatchangev6']; + global $config; + $dhcpdv6 = $config['dhcpdv6']; + foreach ($dhcpdv6 as $dhcpv6leaseinlocaltime) { + $dhcpv6leaseinlocaltime = $dhcpv6leaseinlocaltime['dhcpv6leaseinlocaltime']; + if ($dhcpv6leaseinlocaltime == "yes") + break; + } + $timezone = $config['system']['timezone']; $ts = strtotime($dt . " GMT"); - if ($timeformatchangev6 == "yes") { + if ($dhcpv6leaseinlocaltime == "yes") { $this_tz = new DateTimeZone($timezone); $dhcp_lt = new DateTime(strftime("%I:%M:%S%p", $ts), $this_tz); $offset = $this_tz->getOffset($dhcp_lt); -- cgit v1.1 From df321263a43b79580662dbf0d71f7c81f3c3486f Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sat, 25 Feb 2012 19:06:08 -0600 Subject: need to break out of foreach loop once it finds there is a local time has been selected by any interface of DHCP. --- usr/local/www/status_dhcp_leases.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 5b65cc9..f1dec97 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -97,8 +97,11 @@ function leasecmp($a, $b) { function adjust_gmt($dt) { global $config; $dhcpd = $config['dhcpd']; - foreach ($dhcpd as $dhcpleaseinlocaltime) + foreach ($dhcpd as $dhcpleaseinlocaltime) { $dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime']; + if ($dhcpleaseinlocaltime == "yes") + break; + } $timezone = $config['system']['timezone']; $ts = strtotime($dt . " GMT"); if ($dhcpleaseinlocaltime == "yes") { -- cgit v1.1 From adaa3f751ade110cfe8a811b01b080c30d080b5c Mon Sep 17 00:00:00 2001 From: Joecowboy Date: Sun, 26 Feb 2012 00:20:56 -0600 Subject: Commenting those lines out because the form fields are not generated because they are commented out in the code. This fixes javascript error and now will disable all form fields when interface is disabled. --- usr/local/www/services_dhcpv6.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr') diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 5390dac..dc8cbc8 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -401,16 +401,16 @@ include("head.inc"); document.iform.dns2.disabled = endis; document.iform.deftime.disabled = endis; document.iform.maxtime.disabled = endis; - document.iform.gateway.disabled = endis; + //document.iform.gateway.disabled = endis; document.iform.failover_peerip.disabled = endis; document.iform.dhcpv6leaseinlocaltime.disabled = endis; document.iform.domain.disabled = endis; document.iform.domainsearchlist.disabled = endis; document.iform.ddnsdomain.disabled = endis; document.iform.ddnsupdate.disabled = endis; - document.iform.ntp1.disabled = endis; - document.iform.ntp2.disabled = endis; - document.iform.tftp.disabled = endis; + //document.iform.ntp1.disabled = endis; + //document.iform.ntp2.disabled = endis; + //document.iform.tftp.disabled = endis; document.iform.ldap.disabled = endis; document.iform.netboot.disabled = endis; document.iform.nextserver.disabled = endis; -- cgit v1.1