tag add mode

This commit is contained in:
xiaomlove
2022-10-30 17:30:24 +08:00
parent 0fe7b2f76f
commit 87a079b392
39 changed files with 164 additions and 76 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ if (!$row) {
$torrentTags = \App\Models\TorrentTag::query()->where('torrent_id', $row['id'])->get();
if ($torrentTags->isNotEmpty()) {
$tagRep = new \App\Repositories\TagRepository();
tr($lang_details['row_tags'], $tagRep->renderSpan($torrentTags->pluck('tag_id')->toArray()),true);
tr($lang_details['row_tags'], $tagRep->renderSpan($row['search_box_id'], $torrentTags->pluck('tag_id')->toArray()),true);
}
$size_info = "<b>".$lang_details['text_size']."</b>" . mksize($row["size"]);
+1 -1
View File
@@ -123,7 +123,7 @@ if (strlen($CURUSER['passkey']) != 32) {
$trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id'], true);
$dict = \Rhilip\Bencode\Bencode::load($fn);
$dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey";
do_log(sprintf("[ANNOUNCE_URL], user: %s, torrent: %s, url: %s", $CURUSER['id'] ?? '', $id, $dict['announce']));
/**
* does not support multi-tracker
*
+3 -3
View File
@@ -18,7 +18,7 @@ if (!$row) die();
*/
$customField = new \Nexus\Field\Field();
$hitAndRunRep = new \App\Repositories\HitAndRunRepository();
$tagRep = new \App\Repositories\TagRepository();
$tagIdArr = \App\Models\TorrentTag::query()->where('torrent_id', $id)->get()->pluck('tag_id')->toArray();
$searchBoxRep = new \App\Repositories\SearchBoxRepository();
if ($enablespecial == 'yes' && user_can('movetorrent'))
@@ -154,16 +154,16 @@ else {
tr($lang_edit['row_quality'], $sectionCurrent, 1, "mode_$sectionmode");
echo $customField->renderOnUploadPage($id, $sectionmode);
echo $hitAndRunRep->renderOnUploadPage($row['hr'], $sectionmode);
tr($lang_functions['text_tags'], $tagRep->renderCheckbox($sectionmode, $tagIdArr), 1, "mode_$sectionmode");
if ($allowmove && $othermode) {
$selectOther = $searchBoxRep->renderTaxonomySelect($othermode, $row);
tr($lang_edit['row_quality'], $selectOther, 1, "mode_$othermode");
echo $customField->renderOnUploadPage($id, $othermode);
echo $hitAndRunRep->renderOnUploadPage($row['hr'], $othermode);
tr($lang_functions['text_tags'], $tagRep->renderCheckbox($othermode, $tagIdArr), 1, "mode_$othermode");
}
tr($lang_functions['text_tags'], (new \App\Repositories\TagRepository())->renderCheckbox($tagIdArr), 1);
$rowChecks = [];
if (user_can('beanonymous') || user_can('torrentmanage')) {
$rowChecks[] = "<label><input type=\"checkbox\" name=\"anonymous\"" . ($row["anonymous"] == "yes" ? " checked=\"checked\"" : "" ) . " value=\"1\" />".$lang_edit['checkbox_anonymous_note']."</label>";
+5 -3
View File
@@ -302,9 +302,11 @@ $categories .= "</table>";
$categories = build_search_box_category_table($browsecatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]);
print($categories);
print '<div style="height: 1px;background-color: #eee;margin: 10px 0"></div>';
$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]);
print($categoriesSpecial);
if (get_setting('main.spsct') == 'yes') {
print '<div style="height: 1px;background-color: #eee;margin: 10px 0"></div>';
$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes', 'torrents.php?allsec=1&', false, 3, '', ['section_name' => true]);
print($categoriesSpecial);
}
?>
</td>
</tr>
+2 -2
View File
@@ -599,8 +599,8 @@ elseif ($action == 'bonussettings'){
tr($lang_settings['row_official_addition'],$lang_settings['text_user_would_get_by_official']."<input type='text' style=\"width: 50px\" name=official_addition value='".(isset($BONUS["official_addition"]) ? $BONUS["official_addition"] : 0.5 )."'>".$lang_settings['text_addition_addition_note'], 1);
$tagRep = new \App\Repositories\TagRepository();
tr($lang_settings['row_official_tag'], $tagRep->buildSelect('official_tag', $BONUS["official_tag"] ?? '') . $lang_settings['text_official_tag_note'], 1);
tr($lang_settings['row_zero_bonus_tag'], $tagRep->buildSelect('zero_bonus_tag', $BONUS["zero_bonus_tag"] ?? '') . $lang_settings['text_zero_bonus_tag_note'], 1);
tr($lang_settings['row_official_tag'], $tagRep->buildSelect(0,'official_tag', $BONUS["official_tag"] ?? '') . $lang_settings['text_official_tag_note'], 1);
tr($lang_settings['row_zero_bonus_tag'], $tagRep->buildSelect(0,'zero_bonus_tag', $BONUS["zero_bonus_tag"] ?? '') . $lang_settings['text_zero_bonus_tag_note'], 1);
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_things_cost_bonus']."</b></td></tr>");
tr($lang_settings['row_one_gb_credit'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=onegbupload value='".(isset($BONUS["onegbupload"]) ? $BONUS["onegbupload"] : 300 )."'>".$lang_settings['text_one_gb_credit_note'], 1);
+1 -1
View File
@@ -236,7 +236,7 @@ if (!empty($_POST['custom_fields'][$newcatmode])) {
*
* @since v1.6
*/
$tagIdArr = array_filter($_POST['tags'] ?? []);
$tagIdArr = array_filter($_POST['tags'][$newcatmode] ?? []);
insert_torrent_tags($id, $tagIdArr, true);
if($CURUSER["id"] == $row["owner"])
+6 -1
View File
@@ -43,7 +43,12 @@ if ($row["enabled"] == "no")
if (isset($_POST["securelogin"]) && $_POST["securelogin"] == "yes")
{
$securelogin_indentity_cookie = true;
$passh = md5($row["passhash"].$ip);
/**
* Not IP related
* @since 1.8.0
*/
// $passh = md5($row["passhash"].$ip);
$passh = md5($row["passhash"]);
$log .= ", secure login == yeah, passhash: {$row['passhash']}, ip: $ip, md5: $passh";
}
else
+1 -1
View File
@@ -407,7 +407,7 @@ if (!empty($_POST['custom_fields'][$catmod])) {
*
* @since v1.6
*/
$tagIdArr = array_filter($_POST['tags'] ?? []);
$tagIdArr = array_filter($_POST['tags'][$catmod] ?? []);
if (!empty($tagIdArr)) {
insert_torrent_tags($id, $tagIdArr);
}
+8 -9
View File
@@ -5,14 +5,6 @@ require_once(get_langfile_path('torrents.php'));
require_once(get_langfile_path('speical.php'));
loggedinorreturn();
parked();
/**
* tags
*/
$tagRep = new \App\Repositories\TagRepository();
$allTags = $tagRep->listAll();
$elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED');
//check searchbox
switch (nexus()->getScript()) {
case 'torrents':
@@ -30,6 +22,13 @@ switch (nexus()->getScript()) {
default:
$sectiontype = 0;
}
/**
* tags
*/
$tagRep = new \App\Repositories\TagRepository();
$allTags = $tagRep->listAll($sectiontype);
$elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED');
$showsubcat = get_searchbox_value($sectiontype, 'showsubcat');//whether show subcategory (i.e. sources, codecs) or not
$showsource = get_searchbox_value($sectiontype, 'showsource'); //whether show sources or not
$showmedium = get_searchbox_value($sectiontype, 'showmedium'); //whether show media or not
@@ -1143,7 +1142,7 @@ if (!$Cache->get_page()){
echo $Cache->next_row();
if ($allTags->isNotEmpty()) {
echo '<tr><td colspan="3" class="embedded" style="padding-top: 4px">' . $tagRep->renderSpan(['*'], true) . '</td></tr>';
echo '<tr><td colspan="3" class="embedded" style="padding-top: 4px">' . $tagRep->renderSpan($sectiontype, ['*'], true) . '</td></tr>';
}
?>
+3 -1
View File
@@ -41,6 +41,7 @@ $showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showa
$settingMain = get_setting('main');
$torrentRep = new \App\Repositories\TorrentRepository();
$searchBoxRep = new \App\Repositories\SearchBoxRepository();
$tagRep = new \App\Repositories\TagRepository();
stdhead($lang_upload['head_upload']);
?>
<form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload">
@@ -158,12 +159,14 @@ stdhead($lang_upload['head_upload']);
tr($lang_upload['row_quality'], $selectNormal, 1, "mode_$browsecatmode");
echo $customField->renderOnUploadPage(0, $browsecatmode);
echo $hitAndRunRep->renderOnUploadPage('', $browsecatmode);
tr($lang_functions['text_tags'], $tagRep->renderCheckbox($browsecatmode), 1, "mode_$browsecatmode");
}
if ($allowspecial) {
$selectNormal = $searchBoxRep->renderTaxonomySelect($specialcatmode);
tr($lang_upload['row_quality'], $selectNormal, 1, "mode_$specialcatmode");
echo $customField->renderOnUploadPage(0, $specialcatmode);
echo $hitAndRunRep->renderOnUploadPage('', $specialcatmode);
tr($lang_functions['text_tags'], $tagRep->renderCheckbox($specialcatmode), 1, "mode_$specialcatmode");
}
//==== offer dropdown for offer mod from code by S4NE
@@ -229,7 +232,6 @@ JS;
{
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'], (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>
+5 -3
View File
@@ -542,9 +542,11 @@ if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs");
*/
$categories = build_search_box_category_table($browsecatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]);
$delimiter = '<div style="height: 1px;background-color: #eee;margin: 10px 0"></div>';
$categoriesSpecial = build_search_box_category_table($specialcatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]);
$extra = "<table><caption><font class='big'>{$lang_usercp['text_additional_selection']}</font></caption><tr><td class=bottom><b>".$lang_usercp['text_show_dead_active']."</b><br /><select name=\"incldead\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[incldead=0]") !== false ? " selected" : "").">".$lang_usercp['select_including_dead']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[incldead=1]") !== false || strpos($CURUSER['notifs'], "incldead") == false ? " selected" : "").">".$lang_usercp['select_active']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[incldead=2]") !== false ? " selected" : "").">".$lang_usercp['select_dead']."</option></select></td><td class=bottom align=left><b>".$lang_usercp['text_show_special_torrents']."</b><br /><select name=\"spstate\"><option value=\"0\" ".($special_state == 0 ? " selected" : "").">".$lang_usercp['select_all']."</option>".promotion_selection($special_state)."</select></td><td class=bottom><b>".$lang_usercp['text_show_bookmarked']."</b><br /><select name=\"inclbookmarked\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false ? " selected" : "").">".$lang_usercp['select_all']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=1]") !== false ? " selected" : "")." >".$lang_usercp['select_bookmarked']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=2]") !== false ? " selected" : "").">".$lang_usercp['select_bookmarked_exclude']."</option></select></td></tr></table>";
tr_small($lang_usercp['row_browse_default_categories'],$categories . $delimiter . $categoriesSpecial . $delimiter . $extra,1);
if (get_setting('main.spsct') == 'yes') {
$categories .= $delimiter . build_search_box_category_table($specialcatmode, 'yes','torrents.php?allsec=1', false, 3, $CURUSER['notifs'], ['section_name' => true]);
}
$categories .= $delimiter . "<table><caption><font class='big'>{$lang_usercp['text_additional_selection']}</font></caption><tr><td class=bottom><b>".$lang_usercp['text_show_dead_active']."</b><br /><select name=\"incldead\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[incldead=0]") !== false ? " selected" : "").">".$lang_usercp['select_including_dead']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[incldead=1]") !== false || strpos($CURUSER['notifs'], "incldead") == false ? " selected" : "").">".$lang_usercp['select_active']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[incldead=2]") !== false ? " selected" : "").">".$lang_usercp['select_dead']."</option></select></td><td class=bottom align=left><b>".$lang_usercp['text_show_special_torrents']."</b><br /><select name=\"spstate\"><option value=\"0\" ".($special_state == 0 ? " selected" : "").">".$lang_usercp['select_all']."</option>".promotion_selection($special_state)."</select></td><td class=bottom><b>".$lang_usercp['text_show_bookmarked']."</b><br /><select name=\"inclbookmarked\"><option value=\"0\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false ? " selected" : "").">".$lang_usercp['select_all']."</option><option value=\"1\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=1]") !== false ? " selected" : "")." >".$lang_usercp['select_bookmarked']."</option><option value=\"2\" ".(strpos($CURUSER['notifs'], "[inclbookmarked=2]") !== false ? " selected" : "").">".$lang_usercp['select_bookmarked_exclude']."</option></select></td></tr></table>";
tr_small($lang_usercp['row_browse_default_categories'], $categories,1);
$ss_r = sql_query("SELECT * FROM stylesheets") or die;
$ss_sa = array();
while ($ss_a = mysql_fetch_array($ss_r))
+12 -10
View File
@@ -120,6 +120,12 @@ if ($CURUSER['id'] == $user['id'] || user_can('cruprfmanage'))
?>
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<?php
$userIdDisplay = $user['id'];
$userManageSystemUrl = sprintf('%s/%s/users/%s',getSchemeAndHttpHost(), nexus_env('FILAMENT_PATH', 'nexusphp'), $user['id']);
$userManageSystemText = sprintf('<a href="%s" target="_blank" class="altlink">%s</a>', $userManageSystemUrl, $lang_functions['text_management_system']);
if (user_can('prfmanage') && $user["class"] < get_user_class()) {
$userIdDisplay .= "&nbsp;[$userManageSystemText]";
}
if (($user["privacy"] != "strong") OR (user_can('prfmanage')) || $CURUSER['id'] == $user['id']){
//Xia Zuojie: Taste compatibility is extremely slow. It can takes thounsands of datebase queries. It is disabled until someone makes it fast.
/*
@@ -188,7 +194,7 @@ if (($user["privacy"] != "strong") OR (user_can('prfmanage')) || $CURUSER['id']
print("<tr><td class=rowhead width=13%>".$lang_userdetails['row_compatibility']."</td><td class=rowfollow align=left width=87%>". $compatibility_info ."</td></tr>\n");
}
*/
tr_small($lang_userdetails['text_user_id'], $user['id'], 1);
tr_small($lang_userdetails['text_user_id'], $userIdDisplay, 1);
if ($CURUSER['id'] == $user['id'] || user_can('viewinvite')){
if ($user["invites"] <= 0)
tr_small($lang_userdetails['row_invitation'], $lang_userdetails['text_no_invitation'], 1);
@@ -600,15 +606,11 @@ JS;
if (user_can('cruprfmanage'))
{
// tr($lang_userdetails['row_amount_uploaded'], "<input disabled type=\"text\" size=\"60\" name=\"uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" /><input type=\"hidden\" name=\"ori_uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" />".$lang_userdetails['change_field_value_migrated'], 1);
// tr($lang_userdetails['row_amount_downloaded'], "<input disabled type=\"text\" size=\"60\" name=\"downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" /><input type=\"hidden\" name=\"ori_downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" />".$lang_userdetails['change_field_value_migrated'], 1);
// tr($lang_userdetails['row_seeding_karma'], "<input disabled type=\"text\" size=\"60\" name=\"bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" /><input type=\"hidden\" name=\"ori_bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" />".$lang_userdetails['change_field_value_migrated'], 1);
// tr($lang_userdetails['row_invites'], "<input disabled type=\"text\" size=\"60\" name=\"invites\" value=\"" .htmlspecialchars($user['invites']) . "\" />".$lang_userdetails['change_field_value_migrated'], 1);
tr($lang_userdetails['row_amount_uploaded'], "<input type=\"text\" size=\"60\" name=\"uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" /><input type=\"hidden\" name=\"ori_uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" />", 1);
tr($lang_userdetails['row_amount_downloaded'], "<input type=\"text\" size=\"60\" name=\"downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" /><input type=\"hidden\" name=\"ori_downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" />", 1);
tr($lang_userdetails['row_seeding_karma'], "<input type=\"text\" size=\"60\" name=\"bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" /><input type=\"hidden\" name=\"ori_bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" />", 1);
tr($lang_userdetails['row_invites'], "<input type=\"text\" size=\"60\" name=\"invites\" value=\"" .htmlspecialchars($user['invites']) . "\" />", 1);
$migratedHelp = sprintf($lang_userdetails['change_field_value_migrated'], $userManageSystemText);
tr($lang_userdetails['row_amount_uploaded'], "<input disabled type=\"text\" size=\"60\" name=\"uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" /><input type=\"hidden\" name=\"ori_uploaded\" value=\"" . htmlspecialchars($user['uploaded']) . "\" />".$migratedHelp, 1);
tr($lang_userdetails['row_amount_downloaded'], "<input disabled type=\"text\" size=\"60\" name=\"downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" /><input type=\"hidden\" name=\"ori_downloaded\" value=\"" .htmlspecialchars($user['downloaded']) . "\" />".$migratedHelp, 1);
tr($lang_userdetails['row_seeding_karma'], "<input disabled type=\"text\" size=\"60\" name=\"bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" /><input type=\"hidden\" name=\"ori_bonus\" value=\"" .number_format($user['seedbonus'], 1) . "\" />".$migratedHelp, 1);
tr($lang_userdetails['row_invites'], "<input disabled type=\"text\" size=\"60\" name=\"invites\" value=\"" .htmlspecialchars($user['invites']) . "\" />".$migratedHelp, 1);
}
tr($lang_userdetails['row_passkey'], "<input name=\"resetkey\" value=\"yes\" type=\"checkbox\" />".$lang_userdetails['checkbox_reset_passkey'], 1);