Minor improvements (#868)

* Minor improvements

* Update viewforum.php

* Updated
This commit is contained in:
Roman Kelesidis 2023-08-27 20:05:27 +07:00 committed by GitHub
commit 9b43d144a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 20 additions and 90 deletions

View file

@ -13,21 +13,6 @@ if (!defined('BB_ROOT')) {
global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
$bt_user_id = $userdata['user_id'];
$bt_topic_id = $t_data['topic_id'];
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
if (!$user_passkey) {
$template->assign_block_vars('postrow.attach.tor_reged', array());
$template->assign_vars(array(
'TOR_BLOCKED' => true,
'TOR_BLOCKED_MSG' => $lang['PASSKEY_ALERT_INFO'],
));
return;
}
$change_peers_bgr_over = true;
$bgr_class_1 = 'row1';
$bgr_class_2 = 'row2';
@ -73,6 +58,8 @@ if ($bb_cfg['bt_allow_spmode_change']) {
}
}
$bt_topic_id = $t_data['topic_id'];
$bt_user_id = $userdata['user_id'];
$attach_id = $attachments['_' . $post_id][$i]['attach_id'];
$tracker_status = $attachments['_' . $post_id][$i]['tracker_status'];
$download_count = $attachments['_' . $post_id][$i]['download_count'];
@ -155,6 +142,7 @@ if ($tor_reged && $tor_info) {
$tor_type = $tor_info['tor_type'];
// Magnet link
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
$tor_magnet = create_magnet($tor_info['info_hash'], $tor_info['info_hash_v2'], $user_passkey);
// ratio limits
@ -181,7 +169,7 @@ if ($tor_reged && $tor_info) {
$user_status = $bt_userdata['user_status'] ?? null;
if (($min_ratio_dl || $min_ratio_warn) && $user_status != DL_STATUS_COMPLETE && $bt_user_id != $poster_id && $tor_type != TOR_TYPE_GOLD) {
if (($min_ratio_dl || $min_ratio_warn) && $user_status != DL_STATUS_COMPLETE && ($bt_user_id != ($poster_id || GUEST_UID)) && $tor_type != TOR_TYPE_GOLD) {
if (($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
$dl_allowed = ($user_ratio > $min_ratio_dl);
}