diff --git a/lam/HISTORY b/lam/HISTORY index 84db0271..690a0f06 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -5,6 +5,7 @@ December 2015 5.2 - IMAP: allow to specify initial folders to create - LAM Pro: -> Users: allow to manage IP addresses with ipHost module + -> Self Service: added time zone setting in self service profile 31.08.2015 5.1 diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 7644a142..d1e053ec 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -1293,11 +1293,14 @@ function getTimeZoneOffsetHours() { * @return DateTimeZone time zone */ function getTimeZone() { - if (empty($_SESSION['config'])) { - return new DateTimeZone('UTC'); + $timeZoneName = 'UTC'; + if (!empty($_SESSION['config'])) { + $timeZoneName = $_SESSION['config']->getTimeZone(); } - $timeZone = $_SESSION['config']->getTimeZone(); - return new DateTimeZone($timeZone); + elseif (!empty($_SESSION['selfServiceProfile']->timeZone)) { + $timeZoneName = $_SESSION['selfServiceProfile']->timeZone; + } + return new DateTimeZone($timeZoneName); } /** diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 4275d8bd..fb62f323 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -1133,7 +1133,8 @@ class sambaSamAccount extends baseModule implements passwordService { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideSambaPwdLastSet')) { $sambaPwdLastSet = ''; if (!empty($this->attributes['sambaPwdLastSet'][0])) { - $time = new DateTime('@' . $this->attributes['sambaPwdLastSet'][0], getTimeZone()); + $time = new DateTime('@' . $this->attributes['sambaPwdLastSet'][0], new DateTimeZone('UTC')); + $time->setTimezone(getTimeZone()); $sambaPwdLastSet = $time->format('d.m.Y H:i'); } $return->addElement(new htmlOutputText(_('Last password change'))); @@ -2252,7 +2253,8 @@ class sambaSamAccount extends baseModule implements passwordService { if (in_array('sambaPwdLastSet', $fields)) { $sambaPwdLastSet = ''; if (isset($attributes['sambaPwdLastSet'][0])) { - $time = new DateTime('@' . $attributes['sambaPwdLastSet'][0], getTimeZone()); + $time = new DateTime('@' . $attributes['sambaPwdLastSet'][0], new DateTimeZone('UTC')); + $time->setTimezone(getTimeZone()); $sambaPwdLastSet = $time->format('d.m.Y H:i'); } $row = new htmlResponsiveRow(); @@ -2437,7 +2439,8 @@ class sambaSamAccount extends baseModule implements passwordService { return $return; } $timeVal = $this->attributes['sambaPwdLastSet'][0] + $domains[$i]->maxPwdAge; - $time = new DateTime('@' . $timeVal, getTimeZone()); + $time = new DateTime('@' . $timeVal, new DateTimeZone('UTC')); + $time->setTimezone(getTimeZone()); return $time->format('d.m.Y H:i'); } } @@ -2466,7 +2469,8 @@ class sambaSamAccount extends baseModule implements passwordService { return $return; } $timeVal = $this->attributes['sambaPwdLastSet'][0] + $domains[$i]->minPwdAge; - $time = new DateTime('@' . $timeVal, getTimeZone()); + $time = new DateTime('@' . $timeVal, new DateTimeZone('UTC')); + $time->setTimezone(getTimeZone()); return $time->format('d.m.Y H:i'); } } diff --git a/lam/lib/selfService.inc b/lam/lib/selfService.inc index 5389e0be..e3a79371 100644 --- a/lam/lib/selfService.inc +++ b/lam/lib/selfService.inc @@ -374,6 +374,8 @@ class selfServiceProfile { public $followReferrals = 0; + public $timeZone = 'Europe/London'; + /** * Constructor * @@ -410,6 +412,7 @@ class selfServiceProfile { $this->language = 'en_GB.utf8'; $this->enforceLanguage = true; $this->followReferrals = 0; + $this->timeZone = 'Europe/London'; } } diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index f4c66137..dcddfd99 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -201,7 +201,7 @@ echo "