From 331b159978862e19eb9a4dfa1d20473084918d1b Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 11 Jun 2020 20:30:19 +0000 Subject: [PATCH] Fixed forum oversights. --- public/forum/forum.php | 2 +- public/forum/post.php | 4 ++-- public/forum/topic-priority.php | 2 +- public/forum/topic.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/forum/forum.php b/public/forum/forum.php index 4734e74c..78b67aae 100644 --- a/public/forum/forum.php +++ b/public/forum/forum.php @@ -29,7 +29,7 @@ if(!perms_check($perms, MSZ_FORUM_PERM_VIEW_FORUM)) { return; } -if($forumUser->hasActiveWarning()) +if(isset($forumUser) && $forumUser->hasActiveWarning()) $perms &= ~MSZ_FORUM_PERM_SET_WRITE; Template::set('forum_perms', $perms); diff --git a/public/forum/post.php b/public/forum/post.php index 6553af55..4bef354c 100644 --- a/public/forum/post.php +++ b/public/forum/post.php @@ -33,11 +33,11 @@ if(!empty($postMode) && !UserSession::hasCurrent()) { $currentUser = User::getCurrent(): $currentUserId = $currentUser === null ? 0 : $currentUser->getId(); -if($currentUser->isBanned()) { +if(isset($currentUser) && $currentUser->isBanned()) { echo render_info_or_json($isXHR, 'You have been banned, check your profile for more information.', 403); return; } -if($currentUser->isSilenced()) { +if(isset($currentUser) && $currentUser->isSilenced()) { echo render_info_or_json($isXHR, 'You have been silenced, check your profile for more information.', 403); return; } diff --git a/public/forum/topic-priority.php b/public/forum/topic-priority.php index 4f593c53..3a92e014 100644 --- a/public/forum/topic-priority.php +++ b/public/forum/topic-priority.php @@ -23,7 +23,7 @@ $perms = $topic ? forum_perms_get_user($topic['forum_id'], $topicUserId)[MSZ_FORUM_PERMS_GENERAL] : 0; -if($topicUser->hasActiveWarning()) +if(isset($topicUser) && $topicUser->hasActiveWarning()) $perms &= ~MSZ_FORUM_PERM_SET_WRITE; $topicIsDeleted = !empty($topic['topic_deleted']); diff --git a/public/forum/topic.php b/public/forum/topic.php index 899ac116..690cd47a 100644 --- a/public/forum/topic.php +++ b/public/forum/topic.php @@ -28,7 +28,7 @@ $perms = $topic ? forum_perms_get_user($topic['forum_id'], $topicUserId)[MSZ_FORUM_PERMS_GENERAL] : 0; -if($topicUser->hasActiveWarning()) +if(isset($topicUser) && $topicUser->hasActiveWarning()) $perms &= ~MSZ_FORUM_PERM_SET_WRITE; $topicIsDeleted = !empty($topic['topic_deleted']);