From 90c973f608432a32deeeb7b02cc62727e4c7524c Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 17 Sep 2025 21:22:42 +0700 Subject: [PATCH] fix quote post + improve color bbcode --- include/functions.php | 2 +- public/forums.php | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/functions.php b/include/functions.php index df4a6c02..90100262 100644 --- a/include/functions.php +++ b/include/functions.php @@ -370,7 +370,7 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = $s = str_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); $originalBbTagArray = array("/\[font=([^\[\(&\\;]+?)\]/is", "/\[color=([#0-9a-z]{1,15})\]/is", "/\[color=([a-z]+)\]/is", "/\[size=([1-7])\]/is"); - $replaceXhtmlTagArray = array("", "", "", ""); + $replaceXhtmlTagArray = array("", "", "", ""); $s = preg_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); diff --git a/public/forums.php b/public/forums.php index 5206dc6b..b24235af 100644 --- a/public/forums.php +++ b/public/forums.php @@ -204,7 +204,7 @@ function insert_compose_frame($id, $type = 'new') stderr($lang_forums['std_error'], $lang_forums['std_no_post_id']); $arr = mysql_fetch_assoc($res); $body = "[quote=".htmlspecialchars($arr["username"])."]".htmlspecialchars(unesc($arr["body"]))."[/quote]"; - $postid = $id; + $postid = $id; $id = $topicid; $type = 'reply'; print(""); @@ -467,7 +467,6 @@ if ($action == "post") $postid = mysql_insert_id() or die($lang_forums['std_post_id_not_available']); //send pm $topicInfo = \App\Models\Topic::query()->findOrFail($topicid); - $postInfo = \App\Models\Post::query()->findOrFail($quotepostid); $postUrl = sprintf('[url=[siteurl]forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $postid, $postid, $topicInfo->subject); if ($type == 'reply') { @@ -488,21 +487,23 @@ if ($action == "post") } } - if (!empty($postInfo->userid) && $postInfo->userid != $CURUSER['id']) - { - $receiver = $postInfo->user; - if($receiver->acceptNotification('topic_reply')) { - $locale = $receiver->locale; - $notify = [ - 'sender' => 0, - 'receiver' => $receiver->id, - 'subject' => nexus_trans('forum.reply.replied_notify_subject', [], $locale), - 'msg' => nexus_trans('forum.reply.replied_notify_body', ['topic_subject' => $postUrl, 'replyer' => $CURUSER['username']], $locale), - 'added' => now(), - ]; - \App\Models\Message::add($notify); - } - } + if (!empty($quotepostid)) { + $quotePostInfo = \App\Models\Post::query()->find($quotepostid); + if ($quotePostInfo && $quotePostInfo->userid != $CURUSER['id']) { + $receiver = $quotePostInfo->user; + if($receiver->acceptNotification('topic_reply')) { + $locale = $receiver->locale; + $notify = [ + 'sender' => 0, + 'receiver' => $receiver->id, + 'subject' => nexus_trans('forum.reply.replied_notify_subject', [], $locale), + 'msg' => nexus_trans('forum.reply.replied_notify_body', ['topic_subject' => $postUrl, 'replyer' => $CURUSER['username']], $locale), + 'added' => now(), + ]; + \App\Models\Message::add($notify); + } + } + } } $Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');