Skip to content

Commit

Permalink
fix(editpost): remediate character encoding issues (#2317)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Mar 31, 2024
1 parent 018f2ac commit 9492be3
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions resources/views/pages-legacy/editpost.blade.php
Original file line number Diff line number Diff line change
@@ -1,67 +1,58 @@
<?php
use App\Enums\Permissions;
use App\Models\ForumTopic;
use App\Models\ForumTopicComment;
if (!authenticateFromCookie($user, $permissions, $userDetails)) {
abort(401);
}
$requestedComment = (int) request()->query('comment');
if (empty($requestedComment)) {
abort(404);
}
if (!getSingleTopicComment($requestedComment, $commentData)) {
abort(404);
}
if (empty($commentData)) {
$foundPost = ForumTopicComment::find($requestedComment);
if (!$foundPost) {
abort(404);
}
if ($user != $commentData['Author'] && $permissions < Permissions::Moderator) {
if ($user !== $foundPost->user->User && $permissions < Permissions::Moderator) {
abort_with(back()->withErrors(__('legacy.error.permissions')));
}
if (!getTopicDetails($commentData['ForumTopicID'], $topicData)) {
abort(404);
}
if (empty($topicData)) {
$topic = ForumTopic::with('forum.category')->find($foundPost->ForumTopicID);
if (!$topic) {
abort(404);
}
$thisForumID = $topicData['ForumID'];
$thisForumTitle = htmlentities($topicData['Forum']);
$thisCategoryID = $topicData['CategoryID'];
$thisCategoryName = htmlentities($topicData['Category']);
$thisForumTitle = htmlentities($topicData['Forum']);
$thisTopicTitle = htmlentities($topicData['TopicTitle']);
$thisTopicID = $commentData['ForumTopicID'];
$thisTopicAuthor = $topicData['Author'];
$thisAuthor = $commentData['Author'];
?>

<x-app-layout pageTitle="Edit post">
<div class="navpath">
<a href="forum.php">Forum Index</a>
&raquo; <a href="/forum.php?c={{ $thisCategoryID }}">{{ $thisCategoryName }}</a>
&raquo; <a href="/viewforum.php?f={{ $thisForumID }}">{{ $thisForumTitle }}</a>
&raquo; <a href="/viewtopic.php?t={{ $thisTopicID }}">{{ $thisTopicTitle }}</a>
&raquo; <a href="/forum.php?c={{ $topic->forum->category->ID }}">{{ $topic->forum->category->Name }}</a>
&raquo; <a href="/viewforum.php?f={{ $topic->ForumID }}">{{ $topic->forum->Title }}</a>
&raquo; <a href="/viewtopic.php?t={{ $topic->ID }}">{{ $topic->Title }}</a>
&raquo; <b>Edit Post</b></a>
</div>

<h2>Edit post</h2>
<h1 class="text-h2">Edit post</h1>

<x-section>
<x-base.form action="{{ url('request/forum-topic-comment/update.php') }}">
<div class="flex flex-col gap-y-3">
<x-base.form.input type="hidden" name="comment" value="{{ $commentData['ID'] }}" />
<x-base.form.input label="{{ __res('forum', 1) }}" readonly value="{{ $thisForumTitle }}" inline :fullWidth="false" />
<x-base.form.input label="{{ __res('author', 1) }}" readonly value="{{ $thisAuthor }}" inline :fullWidth="false" />
<x-base.form.input label="{{ __res('forum-topic', 1) }}" readonly value="{{ $thisTopicTitle }}" inline />
<x-base.form.input type="hidden" name="comment" value="{{ $foundPost->ID }}" />

<x-base.form.input label="{{ __res('forum', 1) }}" readonly value="{{ $topic->forum->Title }}" inline :fullWidth="false" />
<x-base.form.input label="{{ __res('author', 1) }}" readonly value="{{ $topic->user->User }}" inline :fullWidth="false" />
<x-base.form.input label="{{ __res('forum-topic', 1) }}" readonly :value="$topic->Title" inline />

<x-base.form.textarea
id="input_compose"
label="{{ __res('message', 1)}} "
value="{{ $commentData['Payload'] }}"
:value="$foundPost->Payload"
maxlength="60000"
name="body"
rows="22"
Expand Down

0 comments on commit 9492be3

Please sign in to comment.