mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 11:04:42 +00:00
Fix dhcp leasetime ( timezone ) display
Config for dhcpleaseinlocaltime was not being wrtten to the config. Corrected leasetine display routine.
This commit is contained in:
parent
03d06437b3
commit
6ecee71a6b
@ -427,6 +427,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (!empty($pconfig['ntp2'])) {
|
||||
$dhcpdconf['ntpserver'][] = $pconfig['ntp2'];
|
||||
}
|
||||
if (!empty($pconfig['dhcpleaseinlocaltime'])) {
|
||||
$dhcpdconf['ntpserver'][] = $pconfig['dhcpleaseinlocaltime'];
|
||||
}
|
||||
|
||||
// handle changes
|
||||
if (!isset($pool) && $act != "newpool") {
|
||||
|
||||
@ -37,18 +37,30 @@ function adjust_gmt($dt)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$dhcpleaseinlocaltime = 'no';
|
||||
$dhcpd = array();
|
||||
if (isset($config['dhcpd'])) {
|
||||
|
||||
if (is_array($config['dhcpd'])) {
|
||||
$dhcpd = $config['dhcpd'];
|
||||
}
|
||||
|
||||
foreach ($dhcpd as $dhcpditem) {
|
||||
if (isset($dhcpditem['dhcpleaseinlocaltime']) && $dhcpleaseinlocaltime == "yes") {
|
||||
$ts = strtotime($dt . " GMT");
|
||||
return strftime("%Y/%m/%d %I:%M:%S%p", $ts);
|
||||
foreach ($dhcpd as $dhcpleaseinlocaltime) {
|
||||
$dhcpleaseinlocaltime = $dhcpleaseinlocaltime['dhcpleaseinlocaltime'];
|
||||
if ($dhcpleaseinlocaltime == "yes") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$timezone = $config['system']['timezone'];
|
||||
$ts = strtotime($dt . " GMT");
|
||||
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);
|
||||
}
|
||||
return $dt;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user