fix quote post + improve color bbcode

This commit is contained in:
xiaomlove
2025-09-17 21:22:42 +07:00
parent 4dd09b662a
commit 90c973f608
2 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -370,7 +370,7 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
$s = str_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); $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"); $originalBbTagArray = array("/\[font=([^\[\(&\\;]+?)\]/is", "/\[color=([#0-9a-z]{1,15})\]/is", "/\[color=([a-z]+)\]/is", "/\[size=([1-7])\]/is");
$replaceXhtmlTagArray = array("<font face=\"\\1\">", "<span style=\"color: \\1;\">", "<span style=\"color: \\1;\">", "<font size=\"\\1\">"); $replaceXhtmlTagArray = array("<font face=\"\\1\">", "<span style=\"color: \\1;word-break: break-word\">", "<span style=\"color: \\1;word-break: break-word\">", "<font size=\"\\1\">");
$s = preg_replace($originalBbTagArray, $replaceXhtmlTagArray, $s); $s = preg_replace($originalBbTagArray, $replaceXhtmlTagArray, $s);
+17 -16
View File
@@ -467,7 +467,6 @@ if ($action == "post")
$postid = mysql_insert_id() or die($lang_forums['std_post_id_not_available']); $postid = mysql_insert_id() or die($lang_forums['std_post_id_not_available']);
//send pm //send pm
$topicInfo = \App\Models\Topic::query()->findOrFail($topicid); $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); $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') { if ($type == 'reply') {
@@ -488,21 +487,23 @@ if ($action == "post")
} }
} }
if (!empty($postInfo->userid) && $postInfo->userid != $CURUSER['id']) if (!empty($quotepostid)) {
{ $quotePostInfo = \App\Models\Post::query()->find($quotepostid);
$receiver = $postInfo->user; if ($quotePostInfo && $quotePostInfo->userid != $CURUSER['id']) {
if($receiver->acceptNotification('topic_reply')) { $receiver = $quotePostInfo->user;
$locale = $receiver->locale; if($receiver->acceptNotification('topic_reply')) {
$notify = [ $locale = $receiver->locale;
'sender' => 0, $notify = [
'receiver' => $receiver->id, 'sender' => 0,
'subject' => nexus_trans('forum.reply.replied_notify_subject', [], $locale), 'receiver' => $receiver->id,
'msg' => nexus_trans('forum.reply.replied_notify_body', ['topic_subject' => $postUrl, 'replyer' => $CURUSER['username']], $locale), 'subject' => nexus_trans('forum.reply.replied_notify_subject', [], $locale),
'added' => now(), 'msg' => nexus_trans('forum.reply.replied_notify_body', ['topic_subject' => $postUrl, 'replyer' => $CURUSER['username']], $locale),
]; 'added' => now(),
\App\Models\Message::add($notify); ];
} \App\Models\Message::add($notify);
} }
}
}
} }
$Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count'); $Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');