From 43b51895f0ab3d55469ee883e2e02c28f81255bd Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 22 Apr 2022 15:32:06 +0900 Subject: [PATCH] Bug fixes in ACL\Login and DB\IO\Extended --- www/lib/CoreLibs/ACL/Login.php | 9 +++++---- www/lib/CoreLibs/DB/Extended/ArrayIO.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index 0cec702f..8c3101a5 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -885,13 +885,13 @@ class Login $this->acl['show_ea_extra'] = false; } // set the default edit access - $this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT']; + $this->acl['default_edit_access'] = $_SESSION['UNIT_DEFAULT'] ?? null; // integrate the type acl list, but only for the keyword -> level foreach ($this->default_acl_list as $level => $data) { $this->acl['min'][$data['type']] = $level; } // set the full acl list too - $this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST']; + $this->acl['acl_list'] = $_SESSION['DEFAULT_ACL_LIST'] ?? []; // debug // $this->debug('ACL', $this->print_ar($this->acl)); } @@ -1453,7 +1453,8 @@ EOM; * checks that the given edit access id is valid for this user * @param int|null $edit_access_id edit access id to check * @return int|null same edit access id if ok - * or the default edit access id if given one is not valid + * or the default edit access id + * if given one is not valid */ public function loginCheckEditAccessId(?int $edit_access_id): ?int { @@ -1463,7 +1464,7 @@ EOM; is_array($_SESSION['UNIT']) && !array_key_exists($edit_access_id, $_SESSION['UNIT']) ) { - return (int)$_SESSION['UNIT_DEFAULT']; + return $_SESSION['UNIT_DEFAULT'] ?? null; } else { return $edit_access_id; } diff --git a/www/lib/CoreLibs/DB/Extended/ArrayIO.php b/www/lib/CoreLibs/DB/Extended/ArrayIO.php index 7dd3b879..f6643293 100644 --- a/www/lib/CoreLibs/DB/Extended/ArrayIO.php +++ b/www/lib/CoreLibs/DB/Extended/ArrayIO.php @@ -503,7 +503,7 @@ class ArrayIO extends \CoreLibs\DB\IO // max id, falls INSERT $q = 'SELECT MAX(' . $this->pk_name . ') + 1 AS pk_id FROM ' . $this->table_name; if (is_array($res = $this->dbReturnRow($q))) { - $pk_id = $res['pkd_id']; + $pk_id = $res['pk_id']; } else { $pk_id = 1; }