|
|
|
@@ -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':
|
|
|
|
@@ -418,8 +421,8 @@ 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=forums.php?action=viewtopic&topicid=%s&page=p%s#pid%s]%s[/url]', $topicid, $id, $id, $topicInfo->subject);
|
|
|
|
|
if ($postInfo->userid != $CURUSER['id']) {
|
|
|
|
|
$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;
|
|
|
|
|
$notify = [
|
|
|
|
@@ -429,9 +432,7 @@ if ($action == "post")
|
|
|
|
|
'msg' => nexus_trans('forum.post.edited_notify_body', ['topic_subject' => $postUrl, 'editor' => $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");
|
|
|
|
|
\App\Models\Message::add($notify);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@@ -466,23 +467,42 @@ 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=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");
|
|
|
|
|
}
|
|
|
|
|
$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') {
|
|
|
|
|
/** @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::add($notify);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');
|
|
|
|
|