summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@dds.nl>2012-02-25 13:37:42 -0800
committerSeth Mos <seth.mos@dds.nl>2012-02-25 13:37:42 -0800
commitf426a6fdd40a5f530e901cae430cbccbb0a61a9b (patch)
tree13cb6e7cd5a2555cad68602d3b929aef0afb005b
parent350471d5452ff3766a3c6d6bd9c03a14a4cf7625 (diff)
parent468618f0da3cd02bf6e10144fc1d696e9fa40737 (diff)
downloadpfsense-f426a6fdd40a5f530e901cae430cbccbb0a61a9b.zip
pfsense-f426a6fdd40a5f530e901cae430cbccbb0a61a9b.tar.gz
Merge pull request #58 from Joecowboy/Time-format-change
Time format change
-rw-r--r--conf.default/config.xml2
-rwxr-xr-xusr/local/www/services_dhcp.php27
-rw-r--r--usr/local/www/services_dhcpv6.php27
-rwxr-xr-xusr/local/www/status_dhcp_leases.php17
-rw-r--r--usr/local/www/status_dhcpv6_leases.php15
5 files changed, 85 insertions, 3 deletions
diff --git a/conf.default/config.xml b/conf.default/config.xml
index a75b33e..db86104 100644
--- a/conf.default/config.xml
+++ b/conf.default/config.xml
@@ -174,6 +174,8 @@
<nextuid>2000</nextuid>
<nextgid>2000</nextgid>
<timezone>Etc/UTC</timezone>
+ <timeformatchange/>
+ <timeformatchangev6/>
<time-update-interval>300</time-update-interval>
<timeservers>0.pfsense.pool.ntp.org</timeservers>
<webgui>
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index c887026..6cc8674 100755
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -151,6 +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'];
if (!is_array($config['dhcpd'][$if]['staticmap']))
$config['dhcpd'][$if]['staticmap'] = array();
$a_maps = &$config['dhcpd'][$if]['staticmap'];
@@ -380,6 +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'];
// Handle the custom options rowhelper
if(isset($config['dhcpd'][$if]['numberoptions']['item']))
@@ -729,6 +731,31 @@ include("head.inc");
</td>
</tr>
<tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td>
+ <input name="timeformatchange" type="checkbox" id="timeformatchange" value="yes" <?php if ($pconfig['timeformatchange']) echo "checked"; ?>>
+ </td>
+ <td>
+ <strong>
+ <?=gettext("Change DHCP display lease time from UTC to local time."); ?>
+ </strong>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>
+ <span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCP leases are displayed in UTC time. By checking this
+ box DHCP lease time will be displayed in local time and set to time zone selected. This will be used for all DHCP interfaces lease time."); ?>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
<td width="78%" class="vtable">
<div id="showddnsbox">
diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php
index 33ad647..5a22676 100644
--- a/usr/local/www/services_dhcpv6.php
+++ b/usr/local/www/services_dhcpv6.php
@@ -119,6 +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'];
if (!is_array($config['dhcpdv6'][$if]['staticmap']))
$config['dhcpdv6'][$if]['staticmap'] = array();
$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
@@ -318,6 +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'];
// Handle the custom options rowhelper
if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
@@ -659,6 +661,31 @@ include("head.inc");
</td>
</tr>
<tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td>
+ <input name="timeformatchangev6" type="checkbox" id="timeformatchangev6" value="yes" <?php if ($pconfig['timeformatchangev6']) echo "checked"; ?>>
+ </td>
+ <td>
+ <strong>
+ <?=gettext("Change DHCPv6 display lease time from UTC to local time."); ?>
+ </strong>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>
+ <span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCPv6 leases are displayed in UTC time. By checking this
+ box DHCPv6 lease time will be displayed in local time and set to time zone selected. This will be used for all DHCPv6 interfaces lease time."); ?>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
<td width="78%" class="vtable">
<div id="showddnsbox">
diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php
index ba18b72..a00c94e 100755
--- a/usr/local/www/status_dhcp_leases.php
+++ b/usr/local/www/status_dhcp_leases.php
@@ -44,6 +44,7 @@
##|-PRIV
require("guiconfig.inc");
+require_once("config.inc");
$pgtitle = array(gettext("Status"),gettext("DHCP leases"));
@@ -94,8 +95,20 @@ function leasecmp($a, $b) {
}
function adjust_gmt($dt) {
- $ts = strtotime($dt . " GMT");
- return strftime("%Y/%m/%d %H:%M:%S", $ts);
+ global $config;
+ $sysctl = $config['system'];
+ $timezone = $sysctl['timezone'];
+ $timeformatchange = $sysctl['timeformatchange'];
+ $ts = strtotime($dt . " GMT");
+ if ($timeformatchange == "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);
}
function remove_duplicate($array, $field)
diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php
index 6153259..c4d7aa7 100644
--- a/usr/local/www/status_dhcpv6_leases.php
+++ b/usr/local/www/status_dhcpv6_leases.php
@@ -45,6 +45,7 @@
##|-PRIV
require("guiconfig.inc");
+require_once("config.inc");
$pgtitle = array(gettext("Status"),gettext("DHCPv6 leases"));
@@ -95,8 +96,20 @@ function leasecmp($a, $b) {
}
function adjust_gmt($dt) {
+ global $config;
+ $sysctl = $config['system'];
+ $timezone = $sysctl['timezone'];
+ $timeformatchangev6 = $sysctl['timeformatchangev6'];
$ts = strtotime($dt . " GMT");
- return strftime("%Y/%m/%d %H:%M:%S", $ts);
+ if ($timeformatchangev6 == "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);
}
function remove_duplicate($array, $field) {
OpenPOWER on IntegriCloud