add torrent pos_state_until

This commit is contained in:
xiaomlove
2022-09-17 18:55:26 +08:00
parent fedc67ad5e
commit 1a0ad86b32
10 changed files with 160 additions and 4 deletions
+25
View File
@@ -342,6 +342,31 @@ $insert = [
if (isset($_POST['hr']) && isset(\App\Models\Torrent::$hrStatus[$_POST['hr']]) && user_can('torrent_hr')) {
$insert['hr'] = $_POST['hr'];
}
if(user_can('torrentsticky')) {
if (isset($_POST['pos_state']) && isset(\App\Models\Torrent::$posStates[$_POST['pos_state']])) {
$posStateUntil = null;
$posState = \App\Models\Torrent::POS_STATE_STICKY_NONE;
if (!empty($_POST['pos_state_until']) && $_POST['pos_state'] != \App\Models\Torrent::POS_STATE_STICKY_NONE) {
$posStateUntil = \Carbon\Carbon::parse($_POST['pos_state_until']);
if ($posStateUntil->gte(now())) {
$posState = $_POST['pos_state'];
}
}
$insert['pos_state'] = $posState;
$insert['pos_state_until'] = $posStateUntil;
}
}
if(user_can('torrentmanage') && ($CURUSER['picker'] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP)) {
if (isset($_POST['picktype']) && isset(\App\Models\Torrent::$pickTypes[$_POST['picktype']])) {
$insert['picktype'] = $_POST['picktype'];
if ($insert['picktype'] == \App\Models\Torrent::PICK_NORMAL) {
$insert['picktime'] = null;
} else {
$insert['picktime'] = now()->toDateTimeString();
}
}
}
do_log("[INSERT_TORRENT]: " . nexus_json_encode($insert));
$id = \Nexus\Database\NexusDB::insert('torrents', $insert);
//$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen, technical_info) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) .