Fixed auth(): empty $f_access (#1329)

* Fixed auth(): empty $f_access

* Update functions.php

* Update CHANGELOG.md

* Updated

* Update functions.php

* Update functions.php
This commit is contained in:
Roman Kelesidis 2024-01-21 02:08:13 +07:00 committed by GitHub
commit 3b4fe8008b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 6 deletions

View file

@ -270,6 +270,9 @@ function auth($type, $forum_id, $ug_data, array $f_access = [], $group_perm = UG
$add_auth_type_desc = ($forum_id != AUTH_LIST_ALL);
// Check forum existence
if (!forum_exists()) {
return [];
}
if ($add_auth_type_desc && !forum_exists($forum_id)) {
return [];
}
@ -1829,8 +1832,12 @@ function get_topic_title($topic_id)
return $row['topic_title'];
}
function forum_exists($forum_id): bool
function forum_exists($forum_id = null): bool
{
if (!isset($forum_id)) {
return (bool)DB()->fetch_row("SELECT * FROM " . BB_FORUMS . " LIMIT 1");
}
return (bool)DB()->fetch_row("SELECT forum_id FROM " . BB_FORUMS . " WHERE forum_id = $forum_id LIMIT 1");
}