From c5b5f108b29d8a45e56457567a6e92ec2185f47c Mon Sep 17 00:00:00 2001 From: Thorsten Rinne Date: Sat, 19 Oct 2024 11:26:37 +0200 Subject: [PATCH] refactor: improved code --- phpmyfaq/admin/record.edit.php | 2 +- phpmyfaq/src/phpMyFAQ/Faq/FaqPermission.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/phpmyfaq/admin/record.edit.php b/phpmyfaq/admin/record.edit.php index f41663b680..bea02d5be6 100644 --- a/phpmyfaq/admin/record.edit.php +++ b/phpmyfaq/admin/record.edit.php @@ -221,7 +221,7 @@ // Group permissions $groupPermission = $faqPermission->get(FaqPermission::GROUP, $faqData['id']); - if (count($groupPermission) == 0 || $groupPermission[0] == -1) { + if (empty($groupPermission) || in_array(-1, $groupPermission, true)) { $allGroups = true; $restrictedGroups = false; $groupPermission[0] = -1; diff --git a/phpmyfaq/src/phpMyFAQ/Faq/FaqPermission.php b/phpmyfaq/src/phpMyFAQ/Faq/FaqPermission.php index 4975128e5a..da42a5bc76 100644 --- a/phpmyfaq/src/phpMyFAQ/Faq/FaqPermission.php +++ b/phpmyfaq/src/phpMyFAQ/Faq/FaqPermission.php @@ -87,9 +87,8 @@ public function delete(string $mode, int $faqId): bool $mode, $faqId ); - $this->config->getDb()->query($query); - return true; + return (bool) $this->config->getDb()->query($query); } /**