add custom field to staffpanel

This commit is contained in:
xiaomlove
2021-03-18 20:32:35 +08:00
parent 428ebd85b8
commit fab59c1f5b
15 changed files with 115 additions and 54 deletions
+10 -7
View File
@@ -11,7 +11,7 @@ int_check($id);
if (!isset($id) || !$id)
die();
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, categories.name AS cat_name, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1")
$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, categories.name AS cat_name, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1")
or sqlerr();
$row = mysql_fetch_array($res);
if (get_user_class() >= $torrentmanage_class || $CURUSER["id"] == $row["owner"])
@@ -161,17 +161,20 @@ else {
/**************end custom fields****************/
//technical info
if ($settingMain['enable_technical_info'] == 'yes') {
$technicalInfo = new \Nexus\Torrent\TechnicalInformation($row['technical_info'] ?? '');
$technicalInfoResult = $technicalInfo->renderOnDetailsPage();
if (!empty($technicalInfoResult)) {
tr($lang_functions['text_technical_info'], $technicalInfoResult, 1);
}
}
if ($CURUSER['showdescription'] != 'no' && !empty($row["descr"])){
$torrentdetailad=$Advertisement->get_ad('torrentdetail');
tr("<a href=\"javascript: klappe_news('descr')\"><span class=\"nowrap\"><img class=\"minus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picdescr\" title=\"".($lang_details['title_show_or_hide'] ?? '')."\" /> ".$lang_details['row_description']."</span></a>", "<div id='kdescr'>".($Advertisement->enable_ad() && $torrentdetailad ? "<div align=\"left\" style=\"margin-bottom: 10px\" id=\"ad_torrentdetail\">".$torrentdetailad[0]."</div>" : "").format_comment($row["descr"])."</div>", 1);
}
//technical info
if ($settingMain['enable_technical_info'] == 'yes') {
$technicalInfo = new \Nexus\Torrent\TechnicalInformation($row['technical_info']);
}
if (get_user_class() >= $viewnfo_class && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0){
if (!$nfo = $Cache->get_value('nfo_block_torrent_id_'.$id)){
$nfo = code($row["nfo"], $view == "magic");
+5
View File
@@ -74,6 +74,11 @@ else {
print("<tr><td class=\"rowhead\">".$lang_edit['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
textbbcode("edittorrent","descr",($row["descr"]), false);
print("</td></tr>");
if ($settingMain['enable_technical_info'] == 'yes') {
tr($lang_functions['text_technical_info'], '<textarea name="technical_info" rows="8" style="width: 650px;">' . $row['technical_info'] . '</textarea><br/>' . $lang_functions['text_technical_info_help_text'], 1);
}
$s = "<select name=\"type\" id=\"oricat\">";
$cats = genrelist($sectionmode);
+1 -1
View File
@@ -25,7 +25,7 @@ if ($action == 'view') {
$result = $field->save($_REQUEST);
redirect('fields.php?action=view');
} catch (\Exception $e) {
stderr($lang_fields['field_management']." - ".$lang_fields['text_field'], $e->getMessage());
stderr($lang_fields['field_management'], $e->getMessage());
}
} elseif ($action == 'edit') {
$id = intval($_GET['id'] ?? 0);
+2 -1
View File
@@ -10,7 +10,8 @@ preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_arra
$fields = "info_hash, times_completed, seeders, leechers";
if (count($info_hash_array[1]) < 1) {
$query = "SELECT $fields FROM torrents ORDER BY id";
err("Require info_hash.");
// $query = "SELECT $fields FROM torrents ORDER BY id";
}
else {
$query = "SELECT $fields FROM torrents WHERE " . hash_where_arr('info_hash', $info_hash_array[1]);
+6 -4
View File
@@ -56,6 +56,8 @@ if (!empty($_POST['pt_gen'])) {
}
$updateset[] = "tags = " . array_sum($_POST['tags'] ?? []);
$updateset[] = "technical_info = " . sqlesc($_POST['technical_info'] ?? '');
if ($enablenfo_main=='yes'){
$nfoaction = $_POST['nfoaction'];
@@ -131,17 +133,17 @@ if(get_user_class()>=$torrentonpromotion_class)
//promotion expiration type
if(!isset($_POST["promotion_time_type"]) || $_POST["promotion_time_type"] == 0) {
$updateset[] = "promotion_time_type = 0";
$updateset[] = "promotion_until = '0000-00-00 00:00:00'";
$updateset[] = "promotion_until = null";
} elseif ($_POST["promotion_time_type"] == 1) {
$updateset[] = "promotion_time_type = 1";
$updateset[] = "promotion_until = '0000-00-00 00:00:00'";
$updateset[] = "promotion_until = null";
} elseif ($_POST["promotion_time_type"] == 2) {
if ($_POST["promotionuntil"] && strtotime($torrentAddedTimeString) <= strtotime($_POST["promotionuntil"])) {
$updateset[] = "promotion_time_type = 2";
$updateset[] = "promotion_until = ".sqlesc($_POST["promotionuntil"]);
} else {
$updateset[] = "promotion_time_type = 0";
$updateset[] = "promotion_until = '0000-00-00 00:00:00'";
$updateset[] = "promotion_until = null";
}
}
}
@@ -162,7 +164,7 @@ if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
if($row["picktype"] != 'normal')
$pick_info = ", recomendation canceled!";
$updateset[] = "picktype = 'normal'";
$updateset[] = "picktime = '0000-00-00 00:00:00'";
$updateset[] = "picktime = null";
}
elseif(intval($_POST["sel_recmovie"] ?? 0) == 1)
{
+4 -1
View File
@@ -5,7 +5,10 @@ function hex_esc($matches) {
return sprintf("%02x", ord($matches[0]));
}
$dllink = false;
$passkey = $_GET['passkey'];
$passkey = $_GET['passkey'] ?? $CURUSER['passkey'] ?? '';
if (!$passkey) {
die("require passkey");
}
$where = "";
if ($passkey){
$res = sql_query("SELECT id, enabled, parked FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");