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:
Roman Kelesidis 2024-01-27 19:55:47 +07:00 committed by GitHub
commit a8b8278352
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 56 additions and 47 deletions

View file

@ -7,6 +7,9 @@
- Release 2.4.1 🦉 ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky))
- Timeline — 2.4.1 [\#1340](https://github.com/torrentpier/torrentpier/pull/1340), [\#1341](https://github.com/torrentpier/torrentpier/pull/1341), [\#1342](https://github.com/torrentpier/torrentpier/pull/1342), [\#1343](https://github.com/torrentpier/torrentpier/pull/1343) ([kovalensky](https://github.com/kovalensky))
- [BEP47] sha1 hash files are binary by default [\#1348](https://github.com/torrentpier/torrentpier/pull/1348) ([kovalensky](https://github.com/kovalensky))
- Extend css contrast attributes [\#1349](https://github.com/torrentpier/torrentpier/pull/1349) ([kovalensky](https://github.com/kovalensky))
- Flatten file list for hybrid files [\#1350](https://github.com/torrentpier/torrentpier/pull/1350) ([kovalensky](https://github.com/kovalensky))
- Added new flag 🕊 [\#1347](https://github.com/torrentpier/torrentpier/pull/1347) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to view "Watching topics" of other people's (For admins only) [\#1336](https://github.com/torrentpier/torrentpier/pull/1336) ([belomaxorka](https://github.com/belomaxorka))
- Added `bt_announce_url` autofill [\#1331](https://github.com/torrentpier/torrentpier/pull/1331) ([belomaxorka](https://github.com/belomaxorka))
@ -19,6 +22,7 @@
- Some enhancements in default template [\#1312](https://github.com/torrentpier/torrentpier/pull/1312) ([belomaxorka](https://github.com/belomaxorka))
- Some enhancements in default template (Part 2) [\#1322](https://github.com/torrentpier/torrentpier/pull/1322) ([belomaxorka](https://github.com/belomaxorka))
- Set response code in some cases [\#1319](https://github.com/torrentpier/torrentpier/pull/1319) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken user dl status [\#1351](https://github.com/torrentpier/torrentpier/pull/1351) ([belomaxorka](https://github.com/belomaxorka))
- Fixed auth(): empty $f_access [\#1329](https://github.com/torrentpier/torrentpier/pull/1329) ([belomaxorka](https://github.com/belomaxorka))
- Fixed download counter for torrents [\#1346](https://github.com/torrentpier/torrentpier/pull/1346) ([belomaxorka](https://github.com/belomaxorka))
- Fixed HTTP 500 while cron running in server-side [\#1321](https://github.com/torrentpier/torrentpier/pull/1321) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -56,8 +56,7 @@ if ($bb_cfg['flist_max_files']) {
if ($filetree_pos) {
$file_count = substr_count($file_contents, '6:length', $filetree_pos, ($files_pos ? ($files_pos - $filetree_pos) : null));
}
else {
} else {
$file_count = substr_count($file_contents, '6:length', $files_pos);
}

View file

@ -148,14 +148,12 @@ 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) {
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
@ -169,8 +167,10 @@ if ($tor_reged && $tor_info) {
LIMIT 1";
}
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) {
$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);
}
@ -178,12 +178,10 @@ if ($tor_reged && $tor_info) {
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'])
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
]);
}
}
}
}
if (!$dl_allowed) {
$template->assign_block_vars('postrow.attach.tor_reged', []);
@ -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)),
]);

View file

@ -537,7 +537,8 @@ input, textarea, select {
font-family: Verdana, sans-serif;
}
input.post, textarea.post {}
input.post, textarea.post {
}
select, input {
font-size: 11px;
@ -651,7 +652,8 @@ fieldset>legend {
margin-left: 6px;
}
.root_forum {}
.root_forum {
}
.has_sf {
color: #333333;
@ -701,11 +703,14 @@ textarea.editor {
margin-bottom: 3px;
}
.fieldsets .radio {}
.fieldsets .radio {
}
.fieldsets .chbox {}
.fieldsets .chbox {
}
.fieldsets .input {}
.fieldsets .input {
}
table.my_downloads {
margin-bottom: 2px;

View file

@ -97,7 +97,8 @@
font-size: 11px;
}
#tr_main_cats {}
#tr_main_cats {
}
/* Main tracker categories list */
#tr_main_cats ul {

View file

@ -43,7 +43,8 @@ body, th, td, font {
position: relative;
}
#sidebar1 {}
#sidebar1 {
}
#sidebar2 {
padding: 0 3px 0 6px;
@ -56,13 +57,15 @@ body, th, td, font {
width: 210px;
}
#sidebar2-wrap {}
#sidebar2-wrap {
}
#main_content {
vertical-align: top;
}
#main_content_wrap {}
#main_content_wrap {
}
#page_footer {
clear: both;

View file

@ -242,9 +242,9 @@ ajax.callback.callseed = function (data) {
<!-- ENDIF / S_MODE_FULL -->
<!-- ENDIF / SHOW_TOR_ACT -->
<!-- IF LOGGED_IN -->
<tr>
<td colspan="2" class="row3 pad_4">
&nbsp;
<!-- IF DL_BUTTONS -->
<form method="POST" action="{S_DL_ACTION}">{DL_HIDDEN_FIELDS}
<!-- IF DL_BUT_WILL --><input type="submit" name="dl_set_will" value="{L_DLWILL}" class="liteoption" />&nbsp;<!-- ENDIF -->
@ -254,9 +254,9 @@ ajax.callback.callseed = function (data) {
</form>
<!-- ENDIF -->
<!-- IF CALL_SEED --><input onclick="ajax.callseed({TOPIC_ID}); return false;" type="button" value="{L_CALLSEED}" class="liteoption"/>&nbsp;<!-- ENDIF -->
&nbsp;
</td>
</tr>
<!-- ENDIF -->
</table>
<div class="spacer_6"></div>