Added search by torrent status (#805)

Mod: https://torrentpier.com/resources/poisk-po-statusu-razdachi.161/

Author: Gemini_13
This commit is contained in:
Roman Kelesidis 2023-06-11 01:42:13 +07:00 committed by GitHub
commit b21333bbb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 0 deletions

View file

@ -651,6 +651,7 @@ $bb_cfg['tracker'] = [
'retracker_host' => 'http://retracker.local/announce',
'freeleech' => false,
'guest_tracker' => true,
'search_by_tor_status' => true
];
// Ratio settings

View file

@ -1152,6 +1152,7 @@ $lang['UNSET_SILVER_TORRENT'] = 'UnMake silver';
$lang['GOLD_STATUS'] = 'GOLD TORRENT! DOWNLOAD TRAFFIC DOES NOT CONSIDER!';
$lang['SILVER_STATUS'] = 'SILVER TORRENT! DOWNLOAD TRAFFIC PARTIALLY CONSIDERED!';
$lang['TORRENT_STATUS'] = 'Search by status of release';
$lang['SEARCH_IN_FORUMS'] = 'Search in Forums';
$lang['SELECT_CAT'] = 'Select category';
$lang['GO_TO_SECTION'] = 'Goto section';

View file

@ -264,6 +264,12 @@ $(function(){
</tr>
<tr>
<td colspan="2" width="50%">
<!-- IF TOR_STATUS -->
<fieldset style="margin-top: 0;">
<legend>{L_TORRENT_STATUS}</legend>
<div>{TOR_STATUS}</div>
</fieldset>
<!-- ENDIF -->
<fieldset style="margin-top: 0;">
<legend>{L_SHOW_COLUMN}</legend>
<div>

View file

@ -46,6 +46,9 @@ $lastvisit = (!IS_GUEST) ? $userdata['user_lastvisit'] : '';
$search_id = (isset($_GET['search_id']) && verify_id($_GET['search_id'], SEARCH_ID_LENGTH)) ? $_GET['search_id'] : '';
$session_id = $userdata['session_id'];
$status = (isset($_POST['status']) && IS_AM && $bb_cfg['tracker']['search_by_tor_status']) ? $_POST['status'] : '';
$status_list = (!empty($status)) ? join(',', $status) : '';
$cat_forum = $tor_to_show = $search_in_forums_ary = array();
$title_match_sql = $title_match_q = $search_in_forums_csv = '';
$tr_error = $poster_error = false;
@ -593,6 +596,9 @@ if ($allowed_forums) {
if ($tor_type) {
$SQL['WHERE'][] = "tor.tor_type IN(1,2)";
}
if (!empty($status_list)) {
$SQL['WHERE'][] = "tor.tor_status IN($status_list)";
}
// ORDER
$SQL['ORDER BY'][] = "{$order_opt[$order_val]['sql']} {$sort_opt[$sort_val]['sql']}";
@ -801,6 +807,22 @@ foreach ($cat_forum['c'] as $cat_id => $forums_ary) {
$search_all_opt = '<option value="' . $search_all . '" value="fs-' . $search_all . '"' . (($forum_val == $search_all) ? HTML_SELECTED : '') . '>&nbsp;' . htmlCHR($lang['ALL_AVAILABLE']) . "</option>\n";
$cat_forum_select = "\n" . '<select id="fs-main" style="width: 100%;" name="' . $forum_key . '[]" multiple size="' . $forum_select_size . "\">\n" . $search_all_opt . $opt . "</select>\n";
// Status select
$statuses = false;
if (IS_AM && $bb_cfg['tracker']['search_by_tor_status']) {
$tor_search_tracker = array_chunk($bb_cfg['tor_icons'], 2, true);
$statuses = '<table border="0" cellpadding="0" cellspacing="0">';
foreach ($tor_search_tracker as $statuses_part) {
$statuses .= '<tr>';
foreach ($statuses_part as $status_id => $status_styles) {
$checked = (!empty($status) && in_array($status_id, $status)) ? 'checked="checked"' : '';
$statuses .= '<td><p class="chbox"><input type="checkbox" name="status[]" value="' . $status_id . '"' . $checked . '>' . $status_styles . ' ' . $lang['TOR_STATUS_NAME'][$status_id] . '</p></td>';
}
$statuses .= '</tr>';
}
$statuses .= '</table>';
}
// Sort dir
$template->assign_vars(array(
'SORT_NAME' => $sort_key,
@ -879,6 +901,7 @@ $template->assign_vars(array(
'S_RG_SELECT' => build_select($s_rg_key, $s_release_group_select, $s_rg_val),
'TOR_SEARCH_ACTION' => $tracker_url,
'TOR_COLSPAN' => $tor_colspan,
'TOR_STATUS' => $statuses,
'TITLE_MATCH_MAX' => $title_match_max_len,
'POSTER_NAME_MAX' => $poster_name_max_len,
'POSTER_ERROR' => $poster_error,