mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
set default value for pwdExpiration when unsetting it
This commit is contained in:
parent
a5e984587d
commit
5921b1e731
|
@ -1279,11 +1279,15 @@ class SeedDMS_Core_DMS {
|
|||
}
|
||||
if($role == '')
|
||||
$role = '0';
|
||||
if(trim($pwdexpiration) == '' || trim($pwdexpiration) == 'never')
|
||||
$pwdexpiration = null;
|
||||
elseif(trim($pwdexpiration) == 'now')
|
||||
$pwdexpiration = date('Y-m-d H:i:s');
|
||||
$queryStr = "INSERT INTO `tblUsers` (`login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `disabled`, `pwdExpiration`, `quota`, `homefolder`) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".($pwdexpiration === null ? 'NULL' : $db->qstr($pwdexpiration)).", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")";
|
||||
if(trim($pwdexpiration) == '' || trim($pwdexpiration) == 'never') {
|
||||
if($db->getDriver() == 'sqlite')
|
||||
$pwdexpiration = $db->qstr('0000-00-00 00:00:00');
|
||||
else
|
||||
$pwdexpiration = 'DEFAULT';
|
||||
} elseif(trim($pwdexpiration) == 'now')
|
||||
$pwdexpiration = $db->qstr(date('Y-m-d H:i:s'));
|
||||
$queryStr = "INSERT INTO `tblUsers` (`login`, `pwd`, `fullName`, `email`, `language`, `theme`, `comment`, `role`, `hidden`, `disabled`, `pwdExpiration`, `quota`, `homefolder`) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$pwdexpiration.", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")";
|
||||
echo $queryStr;
|
||||
$res = $this->db->getResult($queryStr);
|
||||
if (!$res)
|
||||
return false;
|
||||
|
|
|
@ -269,7 +269,10 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
$db = $this->_dms->getDB();
|
||||
|
||||
if(trim($newPwdExpiration) == '' || trim($newPwdExpiration) == 'never') {
|
||||
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` = NULL WHERE `id` = " . $this->_id;
|
||||
if($db->getDriver() == 'sqlite')
|
||||
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` = '0000-00-00 00:00:00' WHERE `id` = " . $this->_id;
|
||||
else
|
||||
$queryStr = "UPDATE `tblUsers` SET `pwdExpiration` = DEFAULT WHERE `id` = " . $this->_id;
|
||||
} else {
|
||||
if(trim($newPwdExpiration) == 'now')
|
||||
$newPwdExpiration = date('Y-m-d H:i:s');
|
||||
|
|
Loading…
Reference in New Issue
Block a user