From bcaaa020b1b1fadef98e4f57c10ff25b64cc8c09 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 14 Jun 2022 01:07:05 +0800 Subject: [PATCH] ban/unban torrent send notification --- app/Console/Commands/Test.php | 13 ++-- app/Models/StaffMessage.php | 27 ++++++++ app/Models/TorrentOperationLog.php | 64 +++++++++++++++++++ classes/class_advertisement.php | 1 + ...04_create_torrent_operation_logs_table.php | 35 ++++++++++ include/constants.php | 4 +- include/functions.php | 37 +++++------ lang/chs/lang_edit.php | 1 + lang/cht/lang_edit.php | 3 +- lang/en/lang_edit.php | 1 + public/details.php | 8 +-- public/edit.php | 40 +++++++++++- public/getusertorrentlistajax.php | 15 +++-- public/staffbox.php | 2 +- public/takeedit.php | 39 ++++++++--- resources/lang/en/torrent.php | 14 ++++ resources/lang/zh_CN/torrent.php | 14 ++++ resources/lang/zh_TW/torrent.php | 14 ++++ 18 files changed, 283 insertions(+), 49 deletions(-) create mode 100644 app/Models/StaffMessage.php create mode 100644 app/Models/TorrentOperationLog.php create mode 100644 database/migrations/2022_06_13_172104_create_torrent_operation_logs_table.php diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 4deb41ca..a25e54ce 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -15,6 +15,7 @@ use App\Models\SearchBox; use App\Models\Snatch; use App\Models\Tag; use App\Models\Torrent; +use App\Models\TorrentOperationLog; use App\Models\User; use App\Repositories\AgentAllowRepository; use App\Repositories\AttendanceRepository; @@ -77,12 +78,12 @@ class Test extends Command */ public function handle() { - $a = []; - if ($a) { - echo 'Bad'; - } else { - echo 'OK'; - } + $arr = [ + 'uid' => 1, + 'torrent_id' => 1, + 'action_type' => 'ban', + ]; + TorrentOperationLog::query()->create($arr); } diff --git a/app/Models/StaffMessage.php b/app/Models/StaffMessage.php new file mode 100644 index 00000000..5a688078 --- /dev/null +++ b/app/Models/StaffMessage.php @@ -0,0 +1,27 @@ + 'datetime', + ]; + + public function send_user() + { + return $this->belongsTo(User::class, 'sender')->withDefault(['id' => 0, 'username' => 'System']); + } + + public function answer_user() + { + return $this->belongsTo(User::class, 'answeredby'); + } + +} diff --git a/app/Models/TorrentOperationLog.php b/app/Models/TorrentOperationLog.php new file mode 100644 index 00000000..392ad0f2 --- /dev/null +++ b/app/Models/TorrentOperationLog.php @@ -0,0 +1,64 @@ + ['text' => 'Ban'], + self::ACTION_TYPE_CANCEL_BAN => ['text' => 'Cancel ban'], + ]; + + public function user() + { + return $this->belongsTo(User::class, 'uid')->select(User::$commonFields); + } + + public function torrent() + { + return $this->belongsTo(Torrent::class, 'torrent_id')->select(Torrent::$commentFields); + } + + + public static function add(array $params) + { + $log = self::query()->create($params); + if (!in_array($params['action_type'], [self::ACTION_TYPE_CANCEL_BAN, self::ACTION_TYPE_BAN])) { + do_log("actionType: {$params['action_type']}, do not notify"); + return $log; + } + self::notifyUser($log); + return $log; + } + + private static function notifyUser(self $torrentOperationLog) + { + $actionType = $torrentOperationLog->action_type; + $receiver = $torrentOperationLog->torrent->user; + $locale = $receiver->locale; + $subject = nexus_trans("torrent.operation_log.$actionType.notify_subject", [], $locale); + $msg = nexus_trans("torrent.operation_log.$actionType.notify_msg", [ + 'torrent_name' => $torrentOperationLog->torrent->name, + 'detail_url' => sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $torrentOperationLog->torrent_id), + 'operator' => $torrentOperationLog->user->username, + 'reason' => $torrentOperationLog->comment, + ], $locale); + $message = [ + 'sender' => 0, + 'receiver' => $receiver->id, + 'subject' => $subject, + 'msg' => $msg, + 'added' => now(), + ]; + Message::query()->insert($message); + } +} diff --git a/classes/class_advertisement.php b/classes/class_advertisement.php index f848e94b..5e3ee66b 100644 --- a/classes/class_advertisement.php +++ b/classes/class_advertisement.php @@ -51,6 +51,7 @@ class ADVERTISEMENT{ global $Cache; if (!$arr = $Cache->get_value('current_ad_array')) { + $arr = []; $now = date("Y-m-d H:i:s"); $validpos = $this->get_validpos(); foreach ($validpos as $pos) diff --git a/database/migrations/2022_06_13_172104_create_torrent_operation_logs_table.php b/database/migrations/2022_06_13_172104_create_torrent_operation_logs_table.php new file mode 100644 index 00000000..34cec34a --- /dev/null +++ b/database/migrations/2022_06_13_172104_create_torrent_operation_logs_table.php @@ -0,0 +1,35 @@ +id(); + $table->integer('torrent_id')->index(); + $table->integer('uid')->index(); + $table->string('action_type'); + $table->string('comment')->default(''); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('torrent_operation_logs'); + } +}; diff --git a/include/constants.php b/include/constants.php index 3e2c053e..9b885e8e 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@
= $staffmem_class){ - $totalreports = $Cache->get_value('staff_report_count'); - if ($totalreports == ""){ - $totalreports = get_row_count("reports"); - $Cache->cache_value('staff_report_count', $totalreports, 900); - } - $totalsm = $Cache->get_value('staff_message_count'); - if ($totalsm == ""){ - $totalsm = get_row_count("staffmessages"); - $Cache->cache_value('staff_message_count', $totalsm, 900); - } - $totalcheaters = $Cache->get_value('staff_cheater_count'); - if ($totalcheaters == ""){ - $totalcheaters = get_row_count("cheaters"); - $Cache->cache_value('staff_cheater_count', $totalcheaters, 900); - } - print("\"cheaterbox\" ".$totalcheaters." \"reportbox\" ".$totalreports." \"staffbox\" ".$totalsm." "); + if (get_user_class() >= $staffmem_class) { + $totalreports = $Cache->get_value('staff_report_count'); + if ($totalreports == ""){ + $totalreports = get_row_count("reports"); + $Cache->cache_value('staff_report_count', $totalreports, 900); + } + $totalsm = $Cache->get_value('staff_message_count'); + if ($totalsm == ""){ + $totalsm = get_row_count("staffmessages"); + $Cache->cache_value('staff_message_count', $totalsm, 900); + } + $totalcheaters = $Cache->get_value('staff_cheater_count'); + if ($totalcheaters == ""){ + $totalcheaters = get_row_count("cheaters"); + $Cache->cache_value('staff_cheater_count', $totalcheaters, 900); + } + print("\"cheaterbox\" ".$totalcheaters." \"reportbox\" ".$totalreports." \"staffbox\" ".$totalsm." "); } print("".$inboxpic." ".($messages ? $messages." (".$unread.$lang_functions['text_message_new'].")" : "0")); @@ -4067,7 +4067,8 @@ function get_category_row($catid = NULL) { global $Cache; static $rows; - if (!$rows && !$rows = (array)$Cache->get_value('category_content')){ + if (!$rows && !$rows = $Cache->get_value('category_content')){ + $rows = []; $res = sql_query("SELECT categories.*, searchbox.name AS catmodename FROM categories LEFT JOIN searchbox ON categories.mode=searchbox.id"); while($row = mysql_fetch_array($res)) { $rows[$row['id']] = $row; diff --git a/lang/chs/lang_edit.php b/lang/chs/lang_edit.php index e11a4e8f..1b23c009 100644 --- a/lang/chs/lang_edit.php +++ b/lang/chs/lang_edit.php @@ -67,6 +67,7 @@ $lang_edit = array 'text_team' => "制作组", 'text_audio_codec' => "音频编码", 'row_content' => "内容", + 'ban_reason_label' => '原因', ); ?> diff --git a/lang/cht/lang_edit.php b/lang/cht/lang_edit.php index 7b794f24..affeb331 100644 --- a/lang/cht/lang_edit.php +++ b/lang/cht/lang_edit.php @@ -66,7 +66,8 @@ $lang_edit = array 'row_check' => "勾選", 'text_team' => "製作組", 'text_audio_codec' => "音頻編碼", - 'row_content' => "內容" + 'row_content' => "內容", + 'ban_reason_label' => '原因', ); ?> diff --git a/lang/en/lang_edit.php b/lang/en/lang_edit.php index 44a14267..4f1177ea 100644 --- a/lang/en/lang_edit.php +++ b/lang/en/lang_edit.php @@ -67,6 +67,7 @@ $lang_edit = array 'text_team' => "Group", 'text_audio_codec' => "Audio Codec", 'row_content' => "Content", + 'ban_reason_label' => 'Reason', ); ?> diff --git a/public/details.php b/public/details.php index 3494750a..6f60f0bc 100644 --- a/public/details.php +++ b/public/details.php @@ -28,12 +28,11 @@ $owned = 1; else $owned = 0; $settingMain = get_setting('main'); - if (!$row) { stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']); } elseif ( - ($row['banned'] == 'yes' && get_user_class() < $seebanned_class) - || !can_access_torrent($row) + ($row['banned'] == 'yes' && get_user_class() < $seebanned_class && $row['owner'] != $CURUSER['id']) + || (!can_access_torrent($row) && $row['owner'] != $CURUSER['id']) ) { permissiondenied(); } else { @@ -69,10 +68,11 @@ if (!$row) { if (isset($_GET["returnto"])) print("

".$lang_details['text_go_back'] . "" . $lang_details['text_whence_you_came']."

"); } + $banned_torrent = ($row["banned"] == 'yes' ? " (".$lang_functions['text_banned'].")" : ""); $sp_torrent = get_torrent_promotion_append($row['sp_state'],'word', false, '', 0, '', $row['__ignore_global_sp_state'] ?? false); $sp_torrent_sub = get_torrent_promotion_append_sub($row['sp_state'],"",true,$row['added'], $row['promotion_time_type'], $row['promotion_until'], $row['__ignore_global_sp_state'] ?? false); $hrImg = get_hr_img($row); - $s=htmlspecialchars($row["name"]).($sp_torrent ? "   ".$sp_torrent : "").($sp_torrent_sub) . $hrImg; + $s=htmlspecialchars($row["name"]).$banned_torrent.($sp_torrent ? "   ".$sp_torrent : "").($sp_torrent_sub) . $hrImg; print("

".$s."

\n"); print("\n"); diff --git a/public/edit.php b/public/edit.php index 94dbe01a..81768d84 100644 --- a/public/edit.php +++ b/public/edit.php @@ -147,9 +147,45 @@ else { tr($lang_edit['row_content'],$team_select,1); } -// tr($lang_functions['text_tags'], torrentTags($row['tags'], 'checkbox'), 1); tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1); - tr($lang_edit['row_check'], " ".$lang_edit['checkbox_visible']."   ".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "".$lang_edit['checkbox_anonymous_note']."   " : "").(get_user_class() >= $torrentmanage_class ? " ".$lang_edit['checkbox_banned'] : ""), 1); + + $rowChecks = []; + if (get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class) { + $rowChecks[] = ""; + } + if (get_user_class() >= $torrentmanage_class) { + array_unshift($rowChecks, ""); + $rowChecks[] = ""; + $banLog = \App\Models\TorrentOperationLog::query()->where('torrent_id', $row['id'])->where('action_type', \App\Models\TorrentOperationLog::ACTION_TYPE_BAN)->orderBy('id', 'desc')->first(); + $banReasonDisplay = "none"; + $banReasonReadonly = ""; + if ($row['banned'] == 'yes') { + $banReasonDisplay = 'inline-block'; + $banReasonReadonly = " readonly disabled"; + } + $rowChecks[] = sprintf( + '%s:', + $banReasonDisplay, $lang_edit['ban_reason_label'], $row['banned'] == 'yes' && $banLog ? $banLog->comment : '', $banReasonReadonly + ); + $js = <<= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){ $pickcontent = $pickcontentPrefix = ""; diff --git a/public/getusertorrentlistajax.php b/public/getusertorrentlistajax.php index 5d14f2fa..0097a9d4 100644 --- a/public/getusertorrentlistajax.php +++ b/public/getusertorrentlistajax.php @@ -10,7 +10,7 @@ header("Pragma: no-cache" ); //header("Content-Type: text/xml; charset=utf-8"); function maketable($res, $mode = 'seeding') { - global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main; + global $lang_getusertorrentlistajax,$CURUSER,$smalldescription_main, $lang_functions; switch ($mode) { case 'uploaded': { @@ -99,6 +99,7 @@ function maketable($res, $mode = 'seeding') $catname = htmlspecialchars($arr["catname"]); $sphighlight = get_torrent_bg_color($arr['sp_state']); + $banned_torrent = ($arr["banned"] == 'yes' ? " (".$lang_functions['text_banned'].")" : ""); $sp_torrent = get_torrent_promotion_append($arr['sp_state'], '', false, '', 0, '', $arr['__ignore_global_sp_state'] ?? false); //Total size if ($showtotalsize){ @@ -124,7 +125,7 @@ function maketable($res, $mode = 'seeding') } else $dissmall_descr == ""; $ret .= "\n" . - ""; + ""; //size if ($showsize) $ret .= ""; @@ -183,7 +184,7 @@ switch ($type) { case 'uploaded': { - $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__); + $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__); $count = mysql_num_rows($res); if ($count > 0) { @@ -195,7 +196,7 @@ switch ($type) // Current Seeding case 'seeding': { - $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr(); + $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0){ list($torrentlist, $total_size) = maketable ( $res, 'seeding' ); @@ -206,7 +207,7 @@ switch ($type) // Current Leeching case 'leeching': { - $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr(); + $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0){ list($torrentlist, $total_size) = maketable ( $res, 'leeching' ); @@ -217,7 +218,7 @@ switch ($type) // Completed torrents case 'completed': { - $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr(); + $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0) { @@ -229,7 +230,7 @@ switch ($type) // Incomplete torrents case 'incomplete': { - $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr(); + $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr(); $count = mysql_num_rows($res); if ($count > 0) { diff --git a/public/staffbox.php b/public/staffbox.php index 0b325a74..fb017b44 100644 --- a/public/staffbox.php +++ b/public/staffbox.php @@ -143,7 +143,7 @@ if ($action == "answermessage") { ?> - "> + "> > > diff --git a/public/takeedit.php b/public/takeedit.php index c9c380d1..01465fa1 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -19,7 +19,7 @@ if (!$id) die(); -$res = sql_query("SELECT category, owner, filename, save_as, anonymous, picktype, picktime, added, pt_gen FROM torrents WHERE id = ".mysql_real_escape_string($id)); +$res = sql_query("SELECT id, category, owner, filename, save_as, anonymous, picktype, picktime, added, pt_gen, banned FROM torrents WHERE id = ".mysql_real_escape_string($id)); $row = mysql_fetch_array($res); $torrentAddedTimeString = $row['added']; if (!$row) @@ -52,7 +52,7 @@ if (!empty($_POST['pt_gen'])) { } $updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? ''); - +$torrentOperationLog = []; /** * hr * @since 1.6.0-beta12 @@ -106,16 +106,23 @@ $updateset[] = "standard = " . sqlesc(intval($_POST["standard_sel"] ?? 0)); $updateset[] = "processing = " . sqlesc(intval($_POST["processing_sel"] ?? 0)); $updateset[] = "team = " . sqlesc(intval($_POST["team_sel"] ?? 0)); $updateset[] = "audiocodec = " . sqlesc(intval($_POST["audiocodec_sel"] ?? 0)); - if (get_user_class() >= $torrentmanage_class) { if (!empty($_POST["banned"])) { + //Ban $updateset[] = "banned = 'yes'"; - $_POST["visible"] = 0; - } - else - $updateset[] = "banned = 'no'"; + $_POST['visible'] = 0; + if ($row['banned'] == 'no') { + $torrentOperationLog['action_type'] = \App\Models\TorrentOperationLog::ACTION_TYPE_BAN; + } + } else { + //Cancel ban + $updateset[] = "banned = 'no'"; + if ($row['banned'] == 'yes') { + $torrentOperationLog['action_type'] = \App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN; + } + } } -$updateset[] = "visible = '" . (!empty($_POST["visible"]) ? "yes" : "no") . "'"; +$updateset[] = "visible = '" . (isset($_POST["visible"]) && $_POST["visible"] ? "yes" : "no") . "'"; if(get_user_class()>=$torrentonpromotion_class) { if(!isset($_POST["sel_spstate"]) || $_POST["sel_spstate"] == 1) @@ -260,6 +267,22 @@ else $searchRep = new \App\Repositories\SearchRepository(); $searchRep->updateTorrent($id); +if (!empty($torrentOperationLog['action_type'])) { + $torrentOperationLog['uid'] = $CURUSER['id']; + $torrentOperationLog['torrent_id'] = $row['id']; + $torrentOperationLog['comment'] = $_POST['ban_reason'] ?? ''; + \App\Models\TorrentOperationLog::add($torrentOperationLog); +} +if ($row['banned'] == 'yes' && $row['owner'] == $CURUSER['id']) { + $torrentUrl = sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $row['id']); + \App\Models\StaffMessage::query()->insert([ + 'sender' => $CURUSER['id'], + 'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]), + 'msg' => nexus_trans('torrent.owner_update_torrent_msg', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]), + 'added' => now(), + ]); +} + $returl = "details.php?id=$id&edited=1"; if (isset($_POST["returnto"])) $returl = $_POST["returnto"]; diff --git a/resources/lang/en/torrent.php b/resources/lang/en/torrent.php index d347d111..2ee536da 100644 --- a/resources/lang/en/torrent.php +++ b/resources/lang/en/torrent.php @@ -44,4 +44,18 @@ return [ 'claim_number_reach_user_maximum' => 'The maximum number of user is reached', 'claim_number_reach_torrent_maximum' => 'The maximum number of torrent is reached', 'claim_disabled' => 'Claim is disabled', + 'operation_log' => [ + \App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [ + 'type_text' => 'Banned', + 'notify_subject' => 'Torrent was banned', + 'notify_msg' => 'Your torrent:[url=:detail_url]:torrent_name[/url] was banned by :operator, Reason: :reason', + ], + \App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [ + 'type_text' => 'Cancel banned', + 'notify_subject' => 'Torrent was unbanned', + 'notify_msg' => 'Your torrent: [url=:detail_url]:torrent_name[/url] unbanned by :operator', + ] + ], + 'owner_update_torrent_subject' => 'Banned torrent have been updated', + 'owner_update_torrent_msg' => 'Torrent:[url=:detail_url]:torrent_name[/url] has been updated by the owner, you can check if it meets the requirements and cancel the ban', ]; diff --git a/resources/lang/zh_CN/torrent.php b/resources/lang/zh_CN/torrent.php index 37dfbcf5..aa2048c7 100644 --- a/resources/lang/zh_CN/torrent.php +++ b/resources/lang/zh_CN/torrent.php @@ -44,4 +44,18 @@ return [ 'claim_number_reach_user_maximum' => '认领达到人数上限', 'claim_number_reach_torrent_maximum' => '认领达到种子数上限', 'claim_disabled' => '认领未启用', + 'operation_log' => [ + \App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [ + 'type_text' => '禁止', + 'notify_subject' => '种子被禁止', + 'notify_msg' => '你的种子:[url=:detail_url]:torrent_name[/url] 被 :operator 禁止,原因::reason', + ], + \App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [ + 'type_text' => '取消禁止', + 'notify_subject' => '种子取消禁止', + 'notify_msg' => '你的种子:[url=:detail_url]:torrent_name[/url] 被 :operator 取消禁止', + ] + ], + 'owner_update_torrent_subject' => '被禁种子已更新', + 'owner_update_torrent_msg' => '种子:[url=:detail_url]:torrent_name[/url] 已被作者更新,可以检查是否符合要求并取消禁止', ]; diff --git a/resources/lang/zh_TW/torrent.php b/resources/lang/zh_TW/torrent.php index 0b72d795..c2a4418a 100644 --- a/resources/lang/zh_TW/torrent.php +++ b/resources/lang/zh_TW/torrent.php @@ -44,4 +44,18 @@ return [ 'claim_number_reach_user_maximum' => '認領達到人數上限', 'claim_number_reach_torrent_maximum' => '認領達到種子數上限', 'claim_disabled' => '認領未啟用', + 'operation_log' => [ + \App\Models\TorrentOperationLog::ACTION_TYPE_BAN => [ + 'type_text' => '禁止', + 'notify_subject' => '種子被禁止', + 'notify_msg' => '你的種子:[url=:detail_url]:torrent_name[/url] 被 :operator 禁止,原因::reason', + ], + \App\Models\TorrentOperationLog::ACTION_TYPE_CANCEL_BAN => [ + 'type_text' => '取消禁止', + 'notify_subject' => '種子取消禁止', + 'notify_msg' => '你的種子:[url=:detail_url]:torrent_name[/url] 被 :operator 取消禁止', + ] + ], + 'owner_update_torrent_subject' => '被禁種子已更新', + 'owner_update_torrent_msg' => '種子:[url=:detail_url]:torrent_name[/url] 已被作者更新,可以檢查是否符合要求並取消禁止', ];
".return_category_image($arr['category'], "torrents.php?allsec=1&")."" . $dispname . "". $sp_torrent . $hrImg .($dissmall_descr == "" ? "" : "
" . $dissmall_descr) . "
" . $dispname . "". $banned_torrent . $sp_torrent . $hrImg .($dissmall_descr == "" ? "" : "
" . $dissmall_descr) . "
". mksize_compact($arr['size'])."