From f9a7b34d6dd08d730a171fcc59eec9e3558d4146 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 23 Feb 2006 08:22:22 +0000 Subject: [PATCH] fixed warnings about mktime() --- lam/HISTORY | 1 + lam/lib/modules/sambaAccount.inc | 14 ++++++++------ lam/lib/modules/sambaSamAccount.inc | 25 ++++++++++++++----------- lam/lib/modules/shadowAccount.inc | 9 +++++---- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lam/HISTORY b/lam/HISTORY index 7bf93660..4bdea011 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -8,6 +8,7 @@ -> fixed login problems for AD servers -> improved sorting of account lists -> fixed language setting in default configuration profile + -> fixed PHP5 warnings (getdate() and mktime()) 08.02.2006 1.0.rc2 - new translation: Dutch diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index a305edec..f63d4e88 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -549,10 +549,12 @@ class sambaAccount extends baseModule { } // check values for user account if ($this->scope == 'user') { - $this->attributes['pwdCanChange'][0] = mktime($post['pwdCanChange_h'], $post['pwdCanChange_m'], $post['pwdCanChange_s'], - $post['pwdCanChange_mon'], $post['pwdCanChange_day'], $post['pwdCanChange_yea']); - $this->attributes['pwdMustChange'][0] = mktime($post['pwdMustChange_h'], $post['pwdMustChange_m'], $post['pwdMustChange_s'], - $post['pwdMustChange_mon'], $post['pwdMustChange_day'], $post['pwdMustChange_yea']); + $this->attributes['pwdCanChange'][0] = mktime(intval($post['pwdCanChange_h']), intval($post['pwdCanChange_m']), + intval($post['pwdCanChange_s']), intval($post['pwdCanChange_mon']), intval($post['pwdCanChange_day']), + intval($post['pwdCanChange_yea'])); + $this->attributes['pwdMustChange'][0] = mktime(intval($post['pwdMustChange_h']), intval($post['pwdMustChange_m']), + intval($post['pwdMustChange_s']), intval($post['pwdMustChange_mon']), intval($post['pwdMustChange_day']), + intval($post['pwdMustChange_yea'])); $this->attributes['smbHome'][0] = $post['smbHome']; $this->attributes['homeDrive'][0] = $post['homeDrive']; $this->attributes['scriptPath'][0] = $post['scriptPath']; @@ -963,7 +965,7 @@ class sambaAccount extends baseModule { if ($rawAccounts[$i][$ids['sambaAccount_pwdCanChange']] != "") { if (get_preg($rawAccounts[$i][$ids['sambaAccount_pwdCanChange']], 'date')) { $parts = explode("-", $rawAccounts[$i][$ids['sambaAccount_pwdCanChange']]); - $time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]); + $time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $partialAccounts[$i]['pwdCanChange'] = $time; } else { @@ -976,7 +978,7 @@ class sambaAccount extends baseModule { if ($rawAccounts[$i][$ids['sambaAccount_pwdMustChange']] != "") { if (get_preg($rawAccounts[$i][$ids['sambaAccount_pwdMustChange']], 'date')) { $parts = explode("-", $rawAccounts[$i][$ids['sambaAccount_pwdMustChange']]); - $time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]); + $time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $partialAccounts[$i]['pwdMustChange'] = $time; } else { diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index b0b3a0e1..61c28dc3 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -564,12 +564,15 @@ class sambaSamAccount extends baseModule { } // user attributes if ($_SESSION[$this->base]->type=='user') { - $this->attributes['sambaPwdCanChange'][0] = mktime($post['sambaPwdCanChange_h'], $post['sambaPwdCanChange_m'], $post['sambaPwdCanChange_s'], - $post['sambaPwdCanChange_mon'], $post['sambaPwdCanChange_day'], $post['sambaPwdCanChange_yea']); - $this->attributes['sambaPwdMustChange'][0] = mktime($post['sambaPwdMustChange_h'], $post['sambaPwdMustChange_m'], $post['sambaPwdMustChange_s'], - $post['sambaPwdMustChange_mon'], $post['sambaPwdMustChange_day'], $post['sambaPwdMustChange_yea']); - $this->attributes['sambaKickoffTime'][0] = mktime($post['sambaExpire_h'], $post['sambaExpire_m'], $post['sambaExpire_s'], - $post['sambaExpire_mon'], $post['sambaExpire_day'], $post['sambaExpire_yea']); + $this->attributes['sambaPwdCanChange'][0] = mktime(intval($post['sambaPwdCanChange_h']), intval($post['sambaPwdCanChange_m']), + intval($post['sambaPwdCanChange_s']), intval($post['sambaPwdCanChange_mon']), intval($post['sambaPwdCanChange_day']), + intval($post['sambaPwdCanChange_yea'])); + $this->attributes['sambaPwdMustChange'][0] = mktime(intval($post['sambaPwdMustChange_h']), intval($post['sambaPwdMustChange_m']), + intval($post['sambaPwdMustChange_s']), intval($post['sambaPwdMustChange_mon']), intval($post['sambaPwdMustChange_day']), + intval($post['sambaPwdMustChange_yea'])); + $this->attributes['sambaKickoffTime'][0] = mktime(intval($post['sambaExpire_h']), intval($post['sambaExpire_m']), + intval($post['sambaExpire_s']), intval($post['sambaExpire_mon']), intval($post['sambaExpire_day']), + intval($post['sambaExpire_yea'])); $this->attributes['sambaHomePath'][0] = $post['sambaHomePath']; if ($post['sambaHomeDrive'] == "-") $this->attributes['sambaHomeDrive'][0] = ''; @@ -1163,8 +1166,8 @@ class sambaSamAccount extends baseModule { } // expiration date if (isset($profile['sambaSamAccount_expire_day'][0]) && ($profile['sambaSamAccount_expire_day'][0] != "")) { - $date = mktime(10, 0, 0, $profile['sambaSamAccount_expire_mon'][0], - $profile['sambaSamAccount_expire_day'][0], $profile['sambaSamAccount_expire_yea'][0]); + $date = mktime(10, 0, 0, intval($profile['sambaSamAccount_expire_mon'][0]), + intval($profile['sambaSamAccount_expire_day'][0]), intval($profile['sambaSamAccount_expire_yea'][0])); $this->attributes['sambaKickoffTime'][0] = $date; } // domain -> change SID @@ -1329,7 +1332,7 @@ class sambaSamAccount extends baseModule { if ($rawAccounts[$i][$ids['sambaSamAccount_pwdCanChange']] != "") { if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_pwdCanChange']], 'date')) { $parts = explode("-", $rawAccounts[$i][$ids['sambaSamAccount_pwdCanChange']]); - $time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]); + $time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $partialAccounts[$i]['sambaPwdCanChange'] = $time; } else { @@ -1342,7 +1345,7 @@ class sambaSamAccount extends baseModule { if ($rawAccounts[$i][$ids['sambaSamAccount_pwdMustChange']] != "") { if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_pwdMustChange']], 'date')) { $parts = explode("-", $rawAccounts[$i][$ids['sambaSamAccount_pwdMustChange']]); - $time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]); + $time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $partialAccounts[$i]['sambaPwdMustChange'] = $time; } else { @@ -1355,7 +1358,7 @@ class sambaSamAccount extends baseModule { if ($rawAccounts[$i][$ids['sambaSamAccount_expireDate']] != "") { if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_expireDate']], 'date')) { $parts = explode("-", $rawAccounts[$i][$ids['sambaSamAccount_expireDate']]); - $time = mktime(0, 0, 0, $parts[1], $parts[0], $parts[2]); + $time = mktime(0, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2])); $partialAccounts[$i]['sambaKickoffTime'] = $time; } else { diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 701b2731..38529b92 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -247,7 +247,8 @@ class shadowAccount extends baseModule { $this->attributes['shadowMax'][0] = $post['shadowMax']; $this->attributes['shadowWarning'][0] = $post['shadowWarning']; $this->attributes['shadowInactive'][0] = $post['shadowInactive']; - $this->attributes['shadowExpire'][0] = intval(mktime(10, 0, 0, $post['shadowExpire_mon'],$post['shadowExpire_day'], $post['shadowExpire_yea'])/3600/24); + $this->attributes['shadowExpire'][0] = intval(mktime(10, 0, 0, intval($post['shadowExpire_mon']), intval($post['shadowExpire_day']), + intval($post['shadowExpire_yea']))/3600/24); if ( !get_preg($this->attributes['shadowMin'][0], 'digit')) $triggered_messages['shadowMin'][] = $this->messages['shadowMin'][0]; if ( !get_preg($this->attributes['shadowMax'][0], 'digit')) $triggered_messages['shadowMax'][] = $this->messages['shadowMax'][0]; if ( $this->attributes['shadowMin'][0] > $this->attributes['shadowMax'][0]) $triggered_messages['shadowMin'][] = $this->messages['shadow_cmp'][0]; @@ -380,7 +381,7 @@ class shadowAccount extends baseModule { if ($rawAccounts[$i][$ids['shadowAccount_expireDay']] != '') { if (get_preg($rawAccounts[$i][$ids['shadowAccount_expireDay']], 'date')) { $parts = explode('-', $rawAccounts[$i][$ids['shadowAccount_expireDay']]); - $partialAccounts[$i]['shadowExpire'][] = intval(mktime(10, 0, 0, $parts[1], $parts[0], $parts[2])/3600/24); + $partialAccounts[$i]['shadowExpire'][] = intval(mktime(10, 0, 0, intval($parts[1]), intval($parts[0]), intval($parts[2]))/3600/24); } else { $errMsg = $this->messages['shadow_expireDate'][0]; @@ -403,8 +404,8 @@ class shadowAccount extends baseModule { // special profile options // expiration date if (isset($profile['shadowAccount_shadowExpire_day'][0]) && ($profile['shadowAccount_shadowExpire_day'][0] != "")) { - $date = intval(mktime(10, 0, 0, $profile['shadowAccount_shadowExpire_mon'][0], - $profile['shadowAccount_shadowExpire_day'][0], $profile['shadowAccount_shadowExpire_yea'][0])/3600/24); + $date = intval(mktime(10, 0, 0, intval($profile['shadowAccount_shadowExpire_mon'][0]), + intval($profile['shadowAccount_shadowExpire_day'][0]), intval($profile['shadowAccount_shadowExpire_yea'][0]))/3600/24); $this->attributes['shadowExpire'][0] = $date; } }