Time zone for self service

This commit is contained in:
Roland Gruber 2015-11-07 09:14:48 +00:00
parent 96ae5f85e2
commit f3a6fecab6
5 changed files with 30 additions and 18 deletions

View File

@ -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

View File

@ -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);
}
/**

View File

@ -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');
}
}

View File

@ -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';
}
}

View File

@ -201,7 +201,7 @@ echo "<div style=\"display: none;\">\n";
echo "<input name=\"moduleSettings\" type=\"submit\" value=\" \">";
echo "<input name=\"jobs\" type=\"submit\" value=\" \">";
echo "</div>\n";
// tabs
echo '<div class="ui-tabs ui-widget ui-widget-content ui-corner-all">';
@ -326,6 +326,7 @@ $timezones = array_merge($timezones, DateTimeZone::listIdentifiers(DateTimeZone:
$timezones = array_merge($timezones, DateTimeZone::listIdentifiers(DateTimeZone::EUROPE));
$timezones = array_merge($timezones, DateTimeZone::listIdentifiers(DateTimeZone::INDIAN));
$timezones = array_merge($timezones, DateTimeZone::listIdentifiers(DateTimeZone::PACIFIC));
$timezones = array_merge($timezones, DateTimeZone::listIdentifiers(DateTimeZone::UTC));
$languageSettingsContent->addElement(new htmlTableExtendedSelect('timeZone', $timezones, array($conf->getTimeZone()), _('Time zone'), '213'), true);
$languageSettings = new htmlFieldset($languageSettingsContent, _("Language settings"), '../../graphics/language.png');
$container->addElement($languageSettings, true);
@ -367,31 +368,31 @@ $container->addElement(new htmlSpacer(null, '10px'), true);
// LAM Pro settings
if (isLAMProVersion()) {
$pwdMailContent = new htmlTable();
$pwdMailFrom = new htmlTableExtendedInputField(_('From address'), 'pwdResetMail_from', $conf->getLamProMailFrom(), '550');
$pwdMailContent->addElement($pwdMailFrom, true);
$pwdMailReplyTo = new htmlTableExtendedInputField(_('Reply-to address'), 'pwdResetMail_replyTo', $conf->getLamProMailReplyTo(), '554');
$pwdMailContent->addElement($pwdMailReplyTo, true);
$pwdMailSubject = new htmlTableExtendedInputField(_('Subject'), 'pwdResetMail_subject', $conf->getLamProMailSubject(), '551');
$pwdMailContent->addElement($pwdMailSubject, true);
$pwdMailIsHTML = false;
if ($conf->getLamProMailIsHTML() == 'true') {
$pwdMailIsHTML = true;
}
$pwdMailContent->addElement(new htmlTableExtendedInputCheckbox('pwdResetMail_isHTML',$pwdMailIsHTML , _('HTML format'), '553'), true);
$pwdMailAllowAlternate = true;
if ($conf->getLamProMailAllowAlternateAddress() == 'false') {
$pwdMailAllowAlternate = false;
}
$pwdMailContent->addElement(new htmlTableExtendedInputCheckbox('pwdResetMail_allowAlternate',$pwdMailAllowAlternate , _('Allow alternate address'), '555'), true);
$pwdMailBody = new htmlTableExtendedInputTextarea('pwdResetMail_body', $conf->getLamProMailText(), 50, 4, _('Text'), '552');
$pwdMailContent->addElement($pwdMailBody, true);
$pwdMailFieldset = new htmlFieldset($pwdMailContent, _("Password mail settings"), '../../graphics/mailBig.png');
$container->addElement($pwdMailFieldset, true);
$container->addElement(new htmlSpacer(null, '10px'), true);
@ -583,7 +584,7 @@ function checkInput() {
$conf->setLoginSearchSuffix($_POST['loginSearchSuffix']);
$conf->setLoginSearchPassword($_POST['loginSearchPassword']);
$conf->setLoginSearchDN($_POST['loginSearchDN']);
if ($_POST['loginMethod'] == LAMConfig::LOGIN_SEARCH) { // check only if search method
if ($_POST['loginMethod'] == LAMConfig::LOGIN_SEARCH) { // check only if search method
if (!$conf->setLoginSearchDN($_POST['loginSearchDN'])) {
$errors[] = array("ERROR", _("Please enter a valid bind user."));
}
@ -638,7 +639,7 @@ function checkInput() {
$toolSettings[$toolConfigID] = 'false';
}
}
$conf->setToolSettings($toolSettings);
$conf->setToolSettings($toolSettings);
// check if password was changed
if (isset($_POST['passwd1']) && ($_POST['passwd1'] != '')) {
if ($_POST['passwd1'] != $_POST['passwd2']) {