From 35be0e6745eae5daedb2510be6d240e5730ca11c Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 4 Jan 2007 10:14:37 +0000 Subject: [PATCH] Patches from branches/2.5 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5469 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/generic/class_user.inc | 7 ++++++- plugins/personal/posix/class_posixAccount.inc | 20 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 6ecd0e18c..971bec209 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 (!empty($this->dateOfBirth) && !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 77ce8bfdf..de4160a84 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -1067,16 +1067,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"; + } } -- 2.30.2