From a7e2ec7b01e96e6aec833d28ea88626768e3cf83 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 16 Sep 2021 16:18:26 +0200 Subject: [PATCH] ensure isHidden and isDisabled is a boolean --- SeedDMS_Core/Core/inc.ClassUser.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassUser.php b/SeedDMS_Core/Core/inc.ClassUser.php index 77cc4a204..e19a3fd30 100644 --- a/SeedDMS_Core/Core/inc.ClassUser.php +++ b/SeedDMS_Core/Core/inc.ClassUser.php @@ -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; } /* }}} */