tag and installer&updater use english

This commit is contained in:
xiaomlove
2022-03-08 15:08:56 +08:00
parent a56891132d
commit 718a57539d
67 changed files with 1149 additions and 104 deletions
+4 -1
View File
@@ -18,6 +18,8 @@ if (!$row) die();
*/
$customField = new \Nexus\Field\Field();
$tagIdArr = \App\Models\TorrentTag::query()->where('torrent_id', $id)->get()->pluck('tag_id')->toArray();
if ($enablespecial == 'yes' && get_user_class() >= $movetorrent_class)
$allowmove = true; //enable moving torrent to other section
else $allowmove = false;
@@ -145,7 +147,8 @@ else {
tr($lang_edit['row_content'],$team_select,1);
}
tr($lang_functions['text_tags'], torrentTags($row['tags'], 'checkbox'), 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'], "<input type=\"checkbox\" name=\"visible\"" . ($row["visible"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" /> ".$lang_edit['checkbox_visible']."&nbsp;&nbsp;&nbsp;".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."&nbsp;&nbsp;&nbsp;" : "").(get_user_class() >= $torrentmanage_class ? "<input type=\"checkbox\" name=\"banned\"" . (($row["banned"] == "yes") ? " checked=\"checked\"" : "" ) . " value=\"yes\" /> ".$lang_edit['checkbox_banned'] : ""), 1);
if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){
$pickcontent = $pickcontentPrefix = "";
+15 -3
View File
@@ -196,27 +196,39 @@ if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$dateTimeStringNow = date("Y-m-d H:i:s");
/**
* add custom fields
* @since v1.6
*/
if (!empty($_POST['custom_fields'])) {
\Nexus\Database\NexusDB::delete('torrents_custom_field_values', "torrent_id = $id");
$now = date('Y-m-d H:i:s');
foreach ($_POST['custom_fields'] as $customField => $customValue) {
foreach ((array)$customValue as $value) {
$customData = [
'torrent_id' => $id,
'custom_field_id' => $customField,
'custom_field_value' => $value,
'created_at' => $now,
'updated_at' => $now,
'created_at' => $dateTimeStringNow,
'updated_at' => $dateTimeStringNow,
];
\Nexus\Database\NexusDB::insert('torrents_custom_field_values', $customData);
}
}
}
/**
* handle tags
*
* @since v1.6
*/
$tagIdArr = array_filter($_POST['tags']);
if (!empty($tagIdArr)) {
insert_torrent_tags($id, $tagIdArr, true);
}
if($CURUSER["id"] == $row["owner"])
{
if ($row["anonymous"]=='yes')
+11 -1
View File
@@ -292,7 +292,7 @@ foreach ($promotionrules_torrent as $rule)
}
}
}
$dateTimeStringNow = \Carbon\Carbon::now()->toDateTimeString();
/**
* add PT-Gen
* @since 1.6
@@ -336,6 +336,16 @@ if (!empty($_POST['custom_fields'])) {
}
}
/**
* handle tags
*
* @since v1.6
*/
$tagIdArr = array_filter($_POST['tags']);
if (!empty($tagIdArr)) {
insert_torrent_tags($id, $tagIdArr);
}
@sql_query("DELETE FROM files WHERE torrent = $id");
foreach ($filelist as $file) {
@sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
+22 -5
View File
@@ -6,6 +6,13 @@ require_once(get_langfile_path('speical.php'));
loggedinorreturn();
parked();
/**
* tags
*/
$tagRep = new \App\Repositories\TagRepository();
$tagKeyById = $tagRep->createBasicQuery()->get()->keyBy('id');
$renderKeyArr = $tagKeyById->keys()->toArray();
//check searchbox
switch (CURRENT_SCRIPT) {
case 'torrents':
@@ -819,20 +826,24 @@ if ($whereaudiocodecin)
$where .= ($where ? " AND " : "") . "audiocodec IN(" . $whereaudiocodecin . ")";
}
$tagFilter = "";
$tagId = intval($_REQUEST['tag_id'] ?? 0);
if ($tagId > 0) {
$tagFilter = " inner join torrent_tags on torrents.id = torrent_tags.torrent_id and torrent_tags.tag_id = $tagId ";
}
if ($allsec == 1 || $enablespecial != 'yes')
{
if ($where != "")
$where = "WHERE $where ";
else $where = "";
$sql = "SELECT COUNT(*) FROM torrents " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $where;
$sql = "SELECT COUNT(*) FROM torrents " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where;
}
else
{
if ($where != "")
$where = "WHERE $where AND categories.mode = '$sectiontype'";
else $where = "WHERE categories.mode = '$sectiontype'";
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $where." GROUP BY categories.mode";
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where . " GROUP BY categories.mode";
}
$res = sql_query($sql);
@@ -872,10 +883,10 @@ if ($count)
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam);
if ($allsec == 1 || $enablespecial != 'yes'){
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit";
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $tagFilter $where $orderby $limit";
}
else{
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.tags,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $tagFilter $where $orderby $limit";
}
$res = sql_query($query);
@@ -1073,7 +1084,13 @@ if (!$Cache->get_page()){
$Cache->cache_page();
}
echo $Cache->next_row();
if ($tagKeyById->isNotEmpty()) {
echo '<tr><td rowspan="3" class="embedded" style="padding-top: 4px">' . $tagRep->renderSpan($tagKeyById, $renderKeyArr, true) . '</td></tr>';
}
?>
</table>
</td>
<td class="rowfollow" align="center">
+2 -1
View File
@@ -156,7 +156,8 @@ stdhead($lang_upload['head_upload']);
{
tr($lang_upload['row_show_uploader'], "<input type=\"checkbox\" name=\"uplver\" value=\"yes\" />".$lang_upload['checkbox_hide_uploader_note'], 1);
}
tr($lang_functions['text_tags'], torrentTags(0, 'checkbox'), 1);
// tr($lang_functions['text_tags'], torrentTags(0, 'checkbox'), 1);
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox(), 1);
?>
<tr><td class="toolbox" align="center" colspan="2"><b><?php echo $lang_upload['text_read_rules']?></b> <input id="qr" type="submit" class="btn" value="<?php echo $lang_upload['submit_upload']?>" /></td></tr>
</table>