mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-28 06:57:22 +08:00
add torrent pos_state_until
This commit is contained in:
+2
-1
@@ -182,7 +182,8 @@ else {
|
||||
foreach (\App\Models\Torrent::listPosStates() as $key => $value) {
|
||||
$options[] = "<option" . (($row["pos_state"] == $key) ? " selected=\"selected\"" : "" ) . " value=\"" . $key . "\">".$value['text']."</option>";
|
||||
}
|
||||
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"sel_posstate\" style=\"width: 100px;\">" . implode('', $options) . "</select> ";
|
||||
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"pos_state\" style=\"width: 100px;\">" . implode('', $options) . "</select> ";
|
||||
$pickcontent .= datetimepicker_input('pos_state_until', $row['pos_state_until'], nexus_trans('label.deadline') . ": ");
|
||||
}
|
||||
if(user_can('torrentmanage') && ($CURUSER["picker"] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP))
|
||||
{
|
||||
|
||||
+17
-3
@@ -143,9 +143,21 @@ if(user_can('torrentonpromotion'))
|
||||
}
|
||||
}
|
||||
}
|
||||
if(user_can('torrentsticky') && isset($_POST['sel_posstate']) && isset(\App\Models\Torrent::$posStates[$_POST['sel_posstate']]))
|
||||
if(user_can('torrentsticky'))
|
||||
{
|
||||
$updateset[] = "pos_state = '" . $_POST['sel_posstate'] . "'";
|
||||
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'];
|
||||
}
|
||||
}
|
||||
$updateset[] = sprintf("pos_state = %s", sqlesc($posState));
|
||||
$updateset[] = sprintf("pos_state_until = %s", sqlesc($posStateUntil));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$pick_info = "";
|
||||
@@ -202,7 +214,9 @@ $descriptionArr = format_description($descr);
|
||||
$cover = get_image_from_description($descriptionArr, true, false);
|
||||
$updateset[] = "cover = " . sqlesc($cover);
|
||||
|
||||
$affectedRows = sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__);
|
||||
$sql = "UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id";
|
||||
do_log("[UPDATE_TORRENT]: $sql");
|
||||
$affectedRows = sql_query($sql) or sqlerr(__FILE__, __LINE__);
|
||||
|
||||
$dateTimeStringNow = date("Y-m-d H:i:s");
|
||||
|
||||
|
||||
@@ -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) .
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
require_once("../include/bittorrent.php");
|
||||
dbconn();
|
||||
require_once(get_langfile_path());
|
||||
require_once(get_langfile_path('edit.php'));
|
||||
loggedinorreturn();
|
||||
parked();
|
||||
$userInfo = \App\Models\User::query()->findOrFail($CURUSER['id']);
|
||||
@@ -180,6 +181,30 @@ JS;
|
||||
}
|
||||
//===end
|
||||
|
||||
//pick
|
||||
$pickcontent = '';
|
||||
if(user_can('torrentsticky'))
|
||||
{
|
||||
$options = [];
|
||||
foreach (\App\Models\Torrent::listPosStates() as $key => $value) {
|
||||
$options[] = "<option" . (($row["pos_state"] == $key) ? " selected=\"selected\"" : "" ) . " value=\"" . $key . "\">".$value['text']."</option>";
|
||||
}
|
||||
$pickcontent .= "<b>".$lang_edit['row_torrent_position'].": </b>"."<select name=\"pos_state\" style=\"width: 100px;\">" . implode('', $options) . "</select> ";
|
||||
$pickcontent .= datetimepicker_input('pos_state_until', '', nexus_trans('label.deadline') . ": ");
|
||||
}
|
||||
if(user_can('torrentmanage') && ($CURUSER["picker"] == 'yes' || get_user_class() >= \App\Models\User::CLASS_SYSOP))
|
||||
{
|
||||
if ($pickcontent) $pickcontent .= '<br />';
|
||||
$pickcontent .= "<b>".$lang_edit['row_recommended_movie'].": </b>"."<select name=\"picktype\" style=\"width: 100px;\">";
|
||||
foreach (\App\Models\Torrent::listPickInfo(true) as $_pick_type => $_pick_type_text) {
|
||||
$pickcontent .= sprintf('<option value="%s">%s</option>', $_pick_type, $_pick_type_text);
|
||||
}
|
||||
$pickcontent .= '</select>';
|
||||
}
|
||||
if ($pickcontent) {
|
||||
tr($lang_edit['row_pick'], $pickcontent, 1);
|
||||
}
|
||||
|
||||
if(user_can('beanonymous'))
|
||||
{
|
||||
tr($lang_upload['row_show_uploader'], "<input type=\"checkbox\" name=\"uplver\" value=\"yes\" />".$lang_upload['checkbox_hide_uploader_note'], 1);
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user