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