ensure isHidden and isDisabled is a boolean

This commit is contained in:
Uwe Steinmann 2021-09-16 16:18:26 +02:00
parent adba550a63
commit a7e2ec7b01

View File

@ -176,8 +176,8 @@ class SeedDMS_Core_User { /* {{{ */
$this->_theme = $theme;
$this->_comment = $comment;
$this->_role = $role;
$this->_isHidden = $isHidden;
$this->_isDisabled = $isDisabled;
$this->_isHidden = (bool) $isHidden;
$this->_isDisabled = (bool) $isDisabled;
$this->_pwdExpiration = $pwdExpiration;
$this->_loginFailures = $loginFailures;
$this->_quota = $quota;
@ -516,7 +516,7 @@ class SeedDMS_Core_User { /* {{{ */
} /* }}} */
/**
* @return bool|int
* @return bool
*/
function isHidden() { return $this->_isHidden; }
@ -528,11 +528,11 @@ class SeedDMS_Core_User { /* {{{ */
$db = $this->_dms->getDB();
$isHidden = ($isHidden) ? "1" : "0";
$queryStr = "UPDATE `tblUsers` SET `hidden` = " . $isHidden . " WHERE `id` = " . $this->_id;
$queryStr = "UPDATE `tblUsers` SET `hidden` = " . intval($isHidden) . " WHERE `id` = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_isHidden = $isHidden;
$this->_isHidden = (bool) $isHidden;
return true;
} /* }}} */
@ -549,11 +549,11 @@ class SeedDMS_Core_User { /* {{{ */
$db = $this->_dms->getDB();
$isDisabled = ($isDisabled) ? "1" : "0";
$queryStr = "UPDATE `tblUsers` SET `disabled` = " . $isDisabled . " WHERE `id` = " . $this->_id;
$queryStr = "UPDATE `tblUsers` SET `disabled` = " . intval($isDisabled) . " WHERE `id` = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_isDisabled = $isDisabled;
$this->_isDisabled = (bool) $isDisabled;
return true;
} /* }}} */