From: janw Date: Thu, 4 Jan 2007 08:35:10 +0000 (+0000) Subject: Fixed problem related to template-based user-creation and dates (dateOfBirth, shadowE... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=631bd9cc6030a0ef458139b0e68f6f1c93b92d0d;p=gosa.git Fixed problem related to template-based user-creation and dates (dateOfBirth, shadowExpire). git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5467 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 46ecbc77d..063a974c3 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -219,7 +219,12 @@ class user extends plugin } else { if(is_array($this->dateOfBirth)){ $date = $this->dateOfBirth; - }else{ + + // Trigger on dates like 1985-04-01, getdate only understands timestamps + } else if (!is_numeric($this->dateOfBirth)){ + $date= getdate(strtotime($this->dateOfBirth)); + + } else { $date = getdate($this->dateOfBirth); } } diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 901caa244..847f8dafe 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -1053,16 +1053,28 @@ class posixAccount extends plugin } /* Adjust shadow checkboxes */ - foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive", - "shadowExpire") as $val){ - + foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive") as $val){ if ($this->$val != 0){ $oval= "use_".$val; $this->$oval= "1"; } } - $this->shadowExpire= $this->convertToSeconds($this->shadowExpire); + /* FIXME: NEED review of this section */ + /* Need to check shadowExpire separately */ + + /* + * If shadowExpire is not enabled in the template, it's a UNIX timestamp - so don't convert it to seconds. + * The check is a hack - if difference between timestamp generated above and here is max 1 day. + */ + if(abs($this->shadowExpire - time())>86400) { + $this->shadowExpire= $this->convertToSeconds($this->shadowExpire); + } + + /* Only enable checkbox, if shadowExpire is in the future */ + if($this->shadowExpire > time()) { + $this->use_shadowExpire= "1"; + } } function get_next_id($attrib)