mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
新增帖子引用回复私信
1. 新增帖子引用回复私信功能 2. 修复Topic类某个typo
This commit is contained in:
@@ -14,7 +14,7 @@ class Topic extends NexusModel
|
||||
|
||||
public function forum()
|
||||
{
|
||||
return $this->belongsTo(Forum::class. 'forumid');
|
||||
return $this->belongsTo(Forum::class, 'forumid');
|
||||
}
|
||||
|
||||
public function firstPost()
|
||||
|
||||
@@ -204,8 +204,10 @@ 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;
|
||||
$id = $topicid;
|
||||
$type = 'reply';
|
||||
print("<input type=\"hidden\" name=\"postid\" value=\"".$postid."\" />");
|
||||
break;
|
||||
}
|
||||
case 'edit':
|
||||
@@ -347,6 +349,7 @@ if ($action == "post")
|
||||
check_whether_exist($id, 'topic');
|
||||
$topicid = $id;
|
||||
$forumid = get_single_value("topics", "forumid", "WHERE id=".sqlesc($topicid));
|
||||
$quotepostid = $_POST["postid"];
|
||||
break;
|
||||
}
|
||||
case 'edit':
|
||||
@@ -466,23 +469,46 @@ 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=forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $postid, $postid, $topicInfo->subject);
|
||||
if ($type == 'reply' && $topicInfo->userid != $CURUSER['id']) {
|
||||
/** @var \App\Models\User $receiver */
|
||||
$receiver = $topicInfo->user;
|
||||
if ($receiver->acceptNotification('topic_reply')) {
|
||||
$locale = $receiver->locale;
|
||||
$notify = [
|
||||
'sender' => 0,
|
||||
'receiver' => $receiver->id,
|
||||
'subject' => nexus_trans('forum.topic.replied_notify_subject', [], $locale),
|
||||
'msg' => nexus_trans('forum.topic.replied_notify_body', ['topic_subject' => $postUrl], $locale),
|
||||
'added' => now(),
|
||||
];
|
||||
\App\Models\Message::query()->insert($notify);
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$topicInfo->userid}_unread_message_count");
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$topicInfo->userid}_inbox_count");
|
||||
}
|
||||
|
||||
if ($type == 'reply') {
|
||||
/** @var \App\Models\User $receiver */
|
||||
if (!empty($topicInfo->userid) && $topicInfo->userid != $CURUSER['id'])
|
||||
{
|
||||
$receiver = $topicInfo->user;
|
||||
if ($receiver->acceptNotification('topic_reply')) {
|
||||
$locale = $receiver->locale;
|
||||
$notify = [
|
||||
'sender' => 0,
|
||||
'receiver' => $receiver->id,
|
||||
'subject' => nexus_trans('forum.topic.replied_notify_subject', [], $locale),
|
||||
'msg' => nexus_trans('forum.topic.replied_notify_body', ['topic_subject' => $postUrl], $locale),
|
||||
'added' => now(),
|
||||
];
|
||||
\App\Models\Message::query()->insert($notify);
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$topicInfo->userid}_unread_message_count");
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$topicInfo->userid}_inbox_count");
|
||||
}
|
||||
}
|
||||
|
||||
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::query()->insert($notify);
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$postInfo->userid}_unread_message_count");
|
||||
\Nexus\Database\NexusDB::cache_del("user_{$postInfo->userid}_inbox_count");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');
|
||||
|
||||
@@ -8,5 +8,9 @@ return [
|
||||
'post' => [
|
||||
'edited_notify_subject' => 'Post reply was modified',
|
||||
'edited_notify_body' => 'Your reply to topic: :topic_subject was modified by: :editor.',
|
||||
],
|
||||
'reply' => [
|
||||
'replied_notify_subject' => 'Your reply has a new reply',
|
||||
'replied_notify_body' => 'Your reply to topic::topic_subject was replied by :replyer.',
|
||||
]
|
||||
];
|
||||
|
||||
@@ -8,5 +8,9 @@ return [
|
||||
'post' => [
|
||||
'edited_notify_subject' => '帖子回复被修改',
|
||||
'edited_notify_body' => '你在帖子::topic_subject 的回复被::editor 修改。',
|
||||
],
|
||||
'reply' => [
|
||||
'replied_notify_subject' => '帖子回复有了新回复',
|
||||
'replied_notify_body' => '你在帖子::topic_subject 的回复被::replyer 回复。',
|
||||
]
|
||||
];
|
||||
|
||||
@@ -8,5 +8,9 @@ return [
|
||||
'post' => [
|
||||
'edited_notify_subject' => '帖子回復被修改',
|
||||
'edited_notify_body' => '你在帖子::topic_subject 的回復被::editor 修改。',
|
||||
],
|
||||
'reply' => [
|
||||
'replied_notify_subject' => '帖子回復有了新回復',
|
||||
'replied_notify_body' => '你在帖子::topic_subject 的回復被::replyer 回復。',
|
||||
]
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user