mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
add topic reply notice
This commit is contained in:
10
app/Models/Forum.php
Normal file
10
app/Models/Forum.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
|
||||||
|
class Forum extends NexusModel
|
||||||
|
{
|
||||||
|
protected $fillable = ['sort', 'name', 'description', 'minclassread', 'minclasswrite', 'postcount', 'topiccount', 'minclasscreate', 'forid'];
|
||||||
|
|
||||||
|
}
|
||||||
19
app/Models/Topic.php
Normal file
19
app/Models/Topic.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
|
||||||
|
class Topic extends NexusModel
|
||||||
|
{
|
||||||
|
protected $fillable = ['userid', 'subject', 'locked', 'forumid', 'firstpost', 'lastpost', 'sticky', 'hlcolor', 'views'];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'userid');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forum()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Forum::class. 'forumid');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,7 +57,7 @@ class TorrentOperationLog extends NexusModel
|
|||||||
$subject = nexus_trans("torrent.operation_log.$actionType.notify_subject", [], $locale);
|
$subject = nexus_trans("torrent.operation_log.$actionType.notify_subject", [], $locale);
|
||||||
$msg = nexus_trans("torrent.operation_log.$actionType.notify_msg", [
|
$msg = nexus_trans("torrent.operation_log.$actionType.notify_msg", [
|
||||||
'torrent_name' => $torrentOperationLog->torrent->name,
|
'torrent_name' => $torrentOperationLog->torrent->name,
|
||||||
'detail_url' => sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $torrentOperationLog->torrent_id),
|
'detail_url' => sprintf('details.php?id=%s', $torrentOperationLog->torrent_id),
|
||||||
'operator' => $torrentOperationLog->user->username,
|
'operator' => $torrentOperationLog->user->username,
|
||||||
'reason' => $torrentOperationLog->comment,
|
'reason' => $torrentOperationLog->comment,
|
||||||
], $locale);
|
], $locale);
|
||||||
@@ -70,5 +70,6 @@ class TorrentOperationLog extends NexusModel
|
|||||||
];
|
];
|
||||||
Message::query()->insert($message);
|
Message::query()->insert($message);
|
||||||
NexusDB::cache_del("user_{$receiver->id}_unread_message_count");
|
NexusDB::cache_del("user_{$receiver->id}_unread_message_count");
|
||||||
|
NexusDB::cache_del("user_{$receiver->id}_inbox_count");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.16');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.16');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-17');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-06-18');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
@@ -405,6 +405,24 @@ 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__);
|
sql_query("UPDATE posts SET body=".sqlesc($body).", editdate=".sqlesc($date).", editedby=".sqlesc($CURUSER['id'])." WHERE id=".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||||
$postid = $id;
|
$postid = $id;
|
||||||
$Cache->delete_value('post_'.$postid.'_content');
|
$Cache->delete_value('post_'.$postid.'_content');
|
||||||
|
//send pm
|
||||||
|
$topicInfo = \App\Models\Topic::query()->findOrFail($topicid);
|
||||||
|
$postInfo = \App\Models\Post::query()->findOrFail($id);
|
||||||
|
$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']) {
|
||||||
|
$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::query()->insert($notify);
|
||||||
|
\Nexus\Database\NexusDB::cache_del("user_{$postInfo->userid}_unread_message_count");
|
||||||
|
\Nexus\Database\NexusDB::cache_del("user_{$postInfo->userid}_inbox_count");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -436,6 +454,24 @@ if ($action == "post")
|
|||||||
|
|
||||||
sql_query("INSERT INTO posts (topicid, userid, added, body, ori_body) VALUES ($topicid, $userid, ".sqlesc($date).", ".sqlesc($body).", ".sqlesc($body).")") or sqlerr(__FILE__, __LINE__);
|
sql_query("INSERT INTO posts (topicid, userid, added, body, ori_body) VALUES ($topicid, $userid, ".sqlesc($date).", ".sqlesc($body).", ".sqlesc($body).")") or sqlerr(__FILE__, __LINE__);
|
||||||
$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
|
||||||
|
$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']) {
|
||||||
|
$receiver = $topicInfo->user;
|
||||||
|
$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");
|
||||||
|
}
|
||||||
|
|
||||||
$Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');
|
$Cache->delete_value('forum_'.$forumid.'_post_'.$today_date.'_count');
|
||||||
$Cache->delete_value('today_'.$today_date.'_posts_count');
|
$Cache->delete_value('today_'.$today_date.'_posts_count');
|
||||||
$Cache->delete_value('forum_'.$forumid.'_last_replied_topic_content');
|
$Cache->delete_value('forum_'.$forumid.'_last_replied_topic_content');
|
||||||
@@ -473,7 +509,7 @@ if ($action == "viewtopic")
|
|||||||
|
|
||||||
$topicid = intval($_GET["topicid"] ?? 0);
|
$topicid = intval($_GET["topicid"] ?? 0);
|
||||||
int_check($topicid,true);
|
int_check($topicid,true);
|
||||||
$page = intval($_GET["page"] ?? 0);
|
$page = $_GET["page"] ?? 0;
|
||||||
$authorid = intval($_GET["authorid"] ?? 0);
|
$authorid = intval($_GET["authorid"] ?? 0);
|
||||||
if ($authorid)
|
if ($authorid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ $searchRep = new \App\Repositories\SearchRepository();
|
|||||||
$searchRep->updateTorrent($id);
|
$searchRep->updateTorrent($id);
|
||||||
|
|
||||||
if ($affectedRows == 1 && $row['banned'] == 'yes' && $row['owner'] == $CURUSER['id']) {
|
if ($affectedRows == 1 && $row['banned'] == 'yes' && $row['owner'] == $CURUSER['id']) {
|
||||||
$torrentUrl = sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $row['id']);
|
$torrentUrl = sprintf('details.php?id=%s', $row['id']);
|
||||||
\App\Models\StaffMessage::query()->insert([
|
\App\Models\StaffMessage::query()->insert([
|
||||||
'sender' => $CURUSER['id'],
|
'sender' => $CURUSER['id'],
|
||||||
'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
||||||
@@ -260,6 +260,7 @@ if ($affectedRows == 1 && $row['banned'] == 'yes' && $row['owner'] == $CURUSER['
|
|||||||
'added' => now(),
|
'added' => now(),
|
||||||
]);
|
]);
|
||||||
\Nexus\Database\NexusDB::cache_del("staff_new_message_count");
|
\Nexus\Database\NexusDB::cache_del("staff_new_message_count");
|
||||||
|
\Nexus\Database\NexusDB::cache_del("staff_message_count");
|
||||||
}
|
}
|
||||||
|
|
||||||
$returl = "details.php?id=$id&edited=1";
|
$returl = "details.php?id=$id&edited=1";
|
||||||
|
|||||||
12
resources/lang/en/forum.php
Normal file
12
resources/lang/en/forum.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'topic' => [
|
||||||
|
'replied_notify_subject' => 'The topic has a new reply',
|
||||||
|
'replied_notify_body' => 'Your topic::topic_subject has a new reply.',
|
||||||
|
],
|
||||||
|
'post' => [
|
||||||
|
'edited_notify_subject' => 'Post reply was modified',
|
||||||
|
'edited_notify_body' => 'Your reply to topic: :topic_subject was modified by: :editor.',
|
||||||
|
]
|
||||||
|
];
|
||||||
12
resources/lang/zh_CN/forum.php
Normal file
12
resources/lang/zh_CN/forum.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'topic' => [
|
||||||
|
'replied_notify_subject' => '帖子有了新回复',
|
||||||
|
'replied_notify_body' => '你的帖子::topic_subject 收到了新的回复。',
|
||||||
|
],
|
||||||
|
'post' => [
|
||||||
|
'edited_notify_subject' => '帖子回复被修改',
|
||||||
|
'edited_notify_body' => '你在帖子::topic_subject 的回复被::editor 修改。',
|
||||||
|
]
|
||||||
|
];
|
||||||
12
resources/lang/zh_TW/forum.php
Normal file
12
resources/lang/zh_TW/forum.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'topic' => [
|
||||||
|
'replied_notify_subject' => '帖子有了新回復',
|
||||||
|
'replied_notify_body' => '你的帖子::topic_subject 收到了新的回復。',
|
||||||
|
],
|
||||||
|
'post' => [
|
||||||
|
'edited_notify_subject' => '帖子回復被修改',
|
||||||
|
'edited_notify_body' => '你在帖子::topic_subject 的回復被::editor 修改。',
|
||||||
|
]
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user