Forum: better error messages (Suggested by @anyeor)

This commit is contained in:
slawkens
2023-07-07 14:34:26 +02:00
parent c392fa7272
commit 8cf0e80019
9 changed files with 82 additions and 42 deletions

View File

@@ -16,12 +16,13 @@ if(!Forum::isModerator()) {
echo 'You are not logged in or you are not moderator.';
}
$save = isset($_REQUEST['save']) ? (int)$_REQUEST['save'] == 1 : false;
$save = isset($_REQUEST['save']) && (int)$_REQUEST['save'] == 1;
if($save) {
$post_id = (int)$_REQUEST['id'];
$board = (int)$_REQUEST['section'];
if(!Forum::hasAccess($board)) {
echo "You don't have access to this board.";
$errors[] = "You don't have access to this board.";
displayErrorBoxWithBackButton($errors, getLink('forum'));
return;
}
@@ -33,8 +34,10 @@ if($save) {
header('Location: ' . getForumBoardLink($nPost['section']));
}
}
else
echo 'Post with ID ' . $post_id . ' does not exist.';
else {
$errors[] = 'Post with ID ' . $post_id . ' does not exist.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
else {
$post_id = (int)$_REQUEST['id'];
@@ -60,7 +63,8 @@ else {
));
}
}
else
echo 'Post with ID ' . $post_id . ' does not exist.';
else {
$errors[] = 'Post with ID ' . $post_id . ' does not exist.';
displayErrorBoxWithBackButton($errors, getLink('forum'));
}
}
?>