mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
ban/unban torrent send notification
This commit is contained in:
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user