diff --git a/public/forum/index.php b/public/forum/index.php index 9286ac5a..76aa4a8c 100644 --- a/public/forum/index.php +++ b/public/forum/index.php @@ -17,7 +17,7 @@ switch ($indexMode) { default: $categories = forum_get_root_categories(user_session_current('user_id', 0)); - $blankForum = count($categories) <= 1 && $categories[0]['forum_children'] < 1; + $blankForum = count($categories) < 1; foreach ($categories as $key => $category) { $categories[$key]['forum_subforums'] = forum_get_children( diff --git a/src/Forum/perms.php b/src/Forum/perms.php index 5264976a..dece1c2e 100644 --- a/src/Forum/perms.php +++ b/src/Forum/perms.php @@ -9,7 +9,7 @@ function forum_perms_get_user(?int $forum, int $user): array { $perms = perms_get_blank(MSZ_FORUM_PERM_MODES); - if ($user < 1 || $forum < 0) { + if ($user < 0 || $forum < 0) { return $perms; } @@ -33,7 +33,8 @@ function forum_perms_get_user(?int $forum, int $user): array FROM `msz_forum_permissions` WHERE (`forum_id` = :forum_id OR `forum_id` IS NULL) AND ( - (`user_id` = :user_id_1 AND `role_id` IS NULL) + (`user_id` IS NULL AND `role_id` IS NULL) + OR (`user_id` = :user_id_1 AND `role_id` IS NULL) OR ( `user_id` IS NULL AND `role_id` IN ( @@ -161,5 +162,5 @@ function forum_perms_get_role_raw(?int $forum, ?int $role): array function forum_perms_check_user(string $prefix, ?int $forumId, ?int $userId, int $perm): bool { - return $userId > 0 && perms_check(forum_perms_get_user($forumId, $userId)[$prefix] ?? 0, $perm); + return perms_check(forum_perms_get_user($forumId, $userId)[$prefix] ?? 0, $perm); }