removed mktime calls

This commit is contained in:
Roland Gruber 2016-07-20 20:19:26 +02:00
parent b2fc9fe4c6
commit 75f7ee43ca
2 changed files with 12 additions and 12 deletions

View File

@ -1792,9 +1792,8 @@ class sambaSamAccount extends baseModule implements passwordService {
} }
// expiration date // expiration date
if (isset($profile['sambaSamAccount_expire_day'][0]) && ($profile['sambaSamAccount_expire_day'][0] != "")) { if (isset($profile['sambaSamAccount_expire_day'][0]) && ($profile['sambaSamAccount_expire_day'][0] != "")) {
$date = mktime(0, 0, 0, intval($profile['sambaSamAccount_expire_mon'][0]), $date = DateTime::createFromFormat('j.n.Y', $profile['sambaSamAccount_expire_day'][0] . '.' . $profile['sambaSamAccount_expire_mon'][0] . '.' . $profile['sambaSamAccount_expire_yea'][0], getTimeZone());
intval($profile['sambaSamAccount_expire_day'][0]), intval($profile['sambaSamAccount_expire_yea'][0])); $this->attributes['sambaKickoffTime'][0] = $date->format('U');
$this->attributes['sambaKickoffTime'][0] = $date;
} }
// domain -> change SID // domain -> change SID
if (isset($this->attributes['sambaSID'][0])) { if (isset($this->attributes['sambaSID'][0])) {
@ -2108,8 +2107,8 @@ class sambaSamAccount extends baseModule implements passwordService {
if ($rawAccounts[$i][$ids['sambaSamAccount_expireDate']] != "") { if ($rawAccounts[$i][$ids['sambaSamAccount_expireDate']] != "") {
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_expireDate']], 'date')) { if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_expireDate']], 'date')) {
$parts = explode("-", $rawAccounts[$i][$ids['sambaSamAccount_expireDate']]); $parts = explode("-", $rawAccounts[$i][$ids['sambaSamAccount_expireDate']]);
$time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $date = DateTime::createFromFormat('j.n.Y', $parts[0] . '.' . $parts[1] . '.' . $parts[2], getTimeZone());
$partialAccounts[$i]['sambaKickoffTime'] = $time; $partialAccounts[$i]['sambaKickoffTime'] = $date->format('U');
} }
else { else {
$errMsg = $this->messages['expireDate'][0]; $errMsg = $this->messages['expireDate'][0];
@ -2761,8 +2760,8 @@ class sambaSamAccount extends baseModule implements passwordService {
unset($this->attributes['sambaKickoffTime']); unset($this->attributes['sambaKickoffTime']);
return; return;
} }
$this->attributes['sambaKickoffTime'][0] = gmmktime(0, 0, 0, intval($month), intval($day), $date = DateTime::createFromFormat('j.n.Y', $day . '.' . $month . '.' . $year, getTimeZone());
intval($year)); $this->attributes['sambaKickoffTime'][0] = $date->format('U');
} }
/** /**

View File

@ -614,7 +614,8 @@ class shadowAccount extends baseModule implements passwordService {
if ($rawAccounts[$i][$ids['shadowAccount_expireDate']] != '') { if ($rawAccounts[$i][$ids['shadowAccount_expireDate']] != '') {
if (get_preg($rawAccounts[$i][$ids['shadowAccount_expireDate']], 'date')) { if (get_preg($rawAccounts[$i][$ids['shadowAccount_expireDate']], 'date')) {
$parts = explode('-', $rawAccounts[$i][$ids['shadowAccount_expireDate']]); $parts = explode('-', $rawAccounts[$i][$ids['shadowAccount_expireDate']]);
$partialAccounts[$i]['shadowExpire'][] = intval(mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2]))/3600/24); $date = DateTime::createFromFormat('j.n.Y', $parts[0] . '.' . $parts[1] . '.' . $parts[2], new DateTimeZone('UTC'));
$partialAccounts[$i]['shadowExpire'][] = intval($date->format('U')/3600/24);
} }
else { else {
$errMsg = $this->messages['shadow_expireDate'][0]; $errMsg = $this->messages['shadow_expireDate'][0];
@ -713,8 +714,8 @@ class shadowAccount extends baseModule implements passwordService {
unset($this->attributes['shadowExpire']); unset($this->attributes['shadowExpire']);
return; return;
} }
$this->attributes['shadowExpire'][0] = intval(gmmktime(0, 0, 0, intval($month), intval($day), $date = DateTime::createFromFormat('j.n.Y', $day . '.' . $month . '.' . $year, new DateTimeZone('UTC'));
intval($year))/3600/24); $this->attributes['shadowExpire'][0] = intval($date->format('U')/3600/24);
} }
/** /**
@ -730,8 +731,8 @@ class shadowAccount extends baseModule implements passwordService {
unset($this->attributes['shadowLastChange']); unset($this->attributes['shadowLastChange']);
return; return;
} }
$this->attributes['shadowLastChange'][0] = intval(gmmktime(0, 0, 0, intval($month), intval($day), $date = DateTime::createFromFormat('j.n.Y', $day . '.' . $month . '.' . $year, new DateTimeZone('UTC'));
intval($year))/3600/24); $this->attributes['shadowLastChange'][0] = intval($date->format('U')/3600/24);
} }
/** /**