From aa84bb90c83487a910501cceaa57eb0c95d1aeba Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 2 Oct 2025 17:39:55 +0700 Subject: [PATCH 1/3] fix forums.php pm url --- public/forums.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/forums.php b/public/forums.php index b24235af..2b703ea5 100644 --- a/public/forums.php +++ b/public/forums.php @@ -421,7 +421,7 @@ if ($action == "post") sql_query("UPDATE posts SET body=".sqlesc($body).", editdate=".sqlesc($date).", editedby=".sqlesc($CURUSER['id'])." WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__); $Cache->delete_value('post_'.$postid.'_content'); //send pm - $postUrl = sprintf('[url=[siteurl]forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $id, $id, $topicInfo->subject); + $postUrl = sprintf('[url=[siteurl]/forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $id, $id, $topicInfo->subject); if (!empty($postInfo->userid) && $postInfo->userid != $CURUSER['id']) { $receiver = $postInfo->user; $locale = $receiver->locale; @@ -467,7 +467,7 @@ 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); - $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') { /** @var \App\Models\User $receiver */ From f2a7f2c09cc70c35a644a37befe96265e37dcf58 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 2 Oct 2025 20:08:42 +0700 Subject: [PATCH 2/3] fix forums.php add message --- public/forums.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/public/forums.php b/public/forums.php index 2b703ea5..5ee3bf50 100644 --- a/public/forums.php +++ b/public/forums.php @@ -421,18 +421,20 @@ if ($action == "post") sql_query("UPDATE posts SET body=".sqlesc($body).", editdate=".sqlesc($date).", editedby=".sqlesc($CURUSER['id'])." WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__); $Cache->delete_value('post_'.$postid.'_content'); //send pm - $postUrl = sprintf('[url=[siteurl]/forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $id, $id, $topicInfo->subject); + $postUrl = sprintf('[url=forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $id, $id, $topicInfo->subject); if (!empty($postInfo->userid) && $postInfo->userid != $CURUSER['id']) { $receiver = $postInfo->user; - $locale = $receiver->locale; - $notify = [ - 'sender' => 0, - 'receiver' => $receiver->id, - 'subject' => nexus_trans('forum.post.edited_notify_subject', [], $locale), - 'msg' => nexus_trans('forum.post.edited_notify_body', ['topic_subject' => $postUrl, 'editor' => $CURUSER['username']], $locale), - 'added' => now(), - ]; - \App\Models\Message::add($notify); + if ($receiver) { + $locale = $receiver->locale; + $notify = [ + 'sender' => 0, + 'receiver' => $receiver->id, + 'subject' => nexus_trans('forum.post.edited_notify_subject', [], $locale), + 'msg' => nexus_trans('forum.post.edited_notify_body', ['topic_subject' => $postUrl, 'editor' => $CURUSER['username']], $locale), + 'added' => now(), + ]; + \App\Models\Message::add($notify); + } } } else @@ -467,14 +469,14 @@ 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); - $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=forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $postid, $postid, $topicInfo->subject); if ($type == 'reply') { /** @var \App\Models\User $receiver */ if (!empty($topicInfo->userid) && $topicInfo->userid != $CURUSER['id']) { $receiver = $topicInfo->user; - if ($receiver->acceptNotification('topic_reply')) { + if ($receiver && $receiver->acceptNotification('topic_reply')) { $locale = $receiver->locale; $notify = [ 'sender' => 0, From 72fee4db99a490bd9d25ab7d587161eec4d56452 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 2 Oct 2025 20:15:32 +0700 Subject: [PATCH 3/3] fix forums.php receiver not exists error --- include/constants.php | 4 ++-- public/forums.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/constants.php b/include/constants.php index 9df6185c..bc65b902 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ find($quotepostid); if ($quotePostInfo && $quotePostInfo->userid != $CURUSER['id']) { $receiver = $quotePostInfo->user; - if($receiver->acceptNotification('topic_reply')) { + if($receiver && $receiver->acceptNotification('topic_reply')) { $locale = $receiver->locale; $notify = [ 'sender' => 0,