mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Fixed broken user dl status (#1351)
* Fixed broken user dl status * Update viewtopic_torrent.tpl * Update displaying_torrent.php * Update displaying_torrent.php * Update displaying_torrent.php * Updated * Update CHANGELOG.md * Update CHANGELOG.md
This commit is contained in:
parent
15080b054d
commit
a8b8278352
9 changed files with 56 additions and 47 deletions
|
@ -148,40 +148,38 @@ if ($tor_reged && $tor_info) {
|
|||
$tor_magnet = create_magnet($tor_info['info_hash'], $tor_info['info_hash_v2'], $user_passkey, html_ent_decode($t_data['topic_title']));
|
||||
|
||||
// ratio limits
|
||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
||||
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
|
||||
$dl_allowed = true;
|
||||
$user_ratio = 0;
|
||||
|
||||
if ($bt_user_id != $poster_id && $bt_user_id != GUEST_UID) {
|
||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
||||
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
|
||||
|
||||
if ($min_ratio_dl || $min_ratio_warn) {
|
||||
$sql = "SELECT u.*, dl.user_status
|
||||
if (($min_ratio_dl || $min_ratio_warn) && $bt_user_id != $poster_id) {
|
||||
$sql = "SELECT u.*, dl.user_status
|
||||
FROM " . BB_BT_USERS . " u
|
||||
LEFT JOIN " . BB_BT_DLSTATUS . " dl ON dl.user_id = $bt_user_id AND dl.topic_id = $bt_topic_id
|
||||
WHERE u.user_id = $bt_user_id
|
||||
LIMIT 1";
|
||||
} else {
|
||||
$sql = "SELECT user_status
|
||||
} else {
|
||||
$sql = "SELECT user_status
|
||||
FROM " . BB_BT_DLSTATUS . "
|
||||
WHERE user_id = $bt_user_id
|
||||
AND topic_id = $bt_topic_id
|
||||
LIMIT 1";
|
||||
}
|
||||
|
||||
$bt_userdata = DB()->fetch_row($sql);
|
||||
$user_status = $bt_userdata['user_status'] ?? null;
|
||||
|
||||
if (($min_ratio_dl || $min_ratio_warn) && (isset($user_status) && $user_status != DL_STATUS_COMPLETE) && ($bt_user_id != $poster_id && $bt_user_id != GUEST_UID) && $tor_type != TOR_TYPE_GOLD) {
|
||||
if (($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
|
||||
$dl_allowed = ($user_ratio > $min_ratio_dl);
|
||||
}
|
||||
|
||||
if ($bt_userdata = DB()->fetch_row($sql)) {
|
||||
if (($min_ratio_dl || $min_ratio_warn) && (isset($bt_userdata['user_status']) && $bt_userdata['user_status'] != DL_STATUS_COMPLETE) && $tor_type != TOR_TYPE_GOLD) {
|
||||
if (($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
|
||||
$dl_allowed = ($user_ratio > $min_ratio_dl);
|
||||
}
|
||||
|
||||
if ((isset($user_ratio, $min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
|
||||
$template->assign_vars([
|
||||
'SHOW_RATIO_WARN' => true,
|
||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
if ((isset($user_ratio, $min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
|
||||
$template->assign_vars([
|
||||
'SHOW_RATIO_WARN' => true,
|
||||
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,8 +373,7 @@ if ($tor_reged && $tor_info) {
|
|||
if ($s_mode == 'full') {
|
||||
if (!empty($peer['ip']) && !empty($peer['ipv6'])) {
|
||||
$ip = bt_show_ip($peer['ipv6']) . ' (' . bt_show_ip($peer['ip']) . ')';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$ip = bt_show_ip(!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']);
|
||||
}
|
||||
$port = bt_show_port($peer['port']);
|
||||
|
@ -543,5 +540,5 @@ $template->assign_vars([
|
|||
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
|
||||
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
|
||||
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
|
||||
'CALL_SEED' => ($bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
||||
'CALL_SEED' => (!IS_GUEST && $bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue