Fixed broken torrent stats displaying (Part 2) (#1673)

* Fixed broken torrent stats displaying (Part 2)

* Update CHANGELOG.md

* Updated

* Revert "Updated"

This reverts commit e816be32df.

* Updated

* Update mysql.sql

* Update mysql.sql

* Revert "Fixed broken torrent stats displaying (Part 2)"

This reverts commit ce071d9fcf.

* Update Torrent.php

* Reapply "Fixed broken torrent stats displaying (Part 2)"

This reverts commit 3f713b8a45.

* Update register.php

* Updated
This commit is contained in:
Roman Kelesidis 2024-11-09 13:27:37 +07:00 committed by GitHub
parent 64409e607d
commit a50c6601b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 22 additions and 19 deletions

View file

@ -19,7 +19,7 @@
- Invites: Permanent invites feature [\#1670](https://github.com/torrentpier/torrentpier/pull/1670) ([belomaxorka](https://github.com/belomaxorka))
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken torrent stats displaying [\#1672](https://github.com/torrentpier/torrentpier/pull/1672) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken torrent stats displaying [\#1672](https://github.com/torrentpier/torrentpier/pull/1672), [\#1673](https://github.com/torrentpier/torrentpier/pull/1673) ([belomaxorka](https://github.com/belomaxorka))
- Fixed incorrect page width on mobile devices [\#1653](https://github.com/torrentpier/torrentpier/pull/1653) ([belomaxorka](https://github.com/belomaxorka))
- Fixed template caching issue [\#1622](https://github.com/torrentpier/torrentpier/pull/1622) ([belomaxorka](https://github.com/belomaxorka))
- Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -434,6 +434,10 @@ CREATE TABLE IF NOT EXISTS `bb_bt_users`
-- ----------------------------
-- Records of bb_bt_users
-- ----------------------------
INSERT INTO `bb_bt_users` (user_id, auth_key)
VALUES ('-1', SUBSTRING(MD5(RAND()), 1, 20)),
('-746', SUBSTRING(MD5(RAND()), 1, 20)),
('2', SUBSTRING(MD5(RAND()), 1, 20));
-- ----------------------------
-- Table structure for `bb_bt_user_settings`

View file

@ -268,6 +268,7 @@ define('BB_WORDS', 'bb_words');
define('BB_THX', 'bb_thx');
define('TORRENT_EXT', 'torrent');
define('TORRENT_MIMETYPE', 'application/x-bittorrent');
define('TOPIC_DL_TYPE_NORMAL', 0);
define('TOPIC_DL_TYPE_DL', 1);

View file

@ -605,6 +605,16 @@ if ($submit && !$errors) {
DB()->query("INSERT INTO " . BB_USERS . $sql_args);
$new_user_id = DB()->sql_nextid();
// Generate passkey
for ($i = 0, $max_try = 3; $i <= $max_try; $i++) {
if (\TorrentPier\Legacy\Torrent::generate_passkey($new_user_id, true)) {
break;
}
if ($i == $max_try) {
bb_simple_die('Could not generate passkey');
}
}
if (IS_ADMIN) {
set_pr_die_append_msg($new_user_id);
$message = $lang['ACCOUNT_ADDED'];

View file

@ -569,7 +569,7 @@ class Attach
}
} else {
if (empty($this->attachment_mimetype_list[$i]) && $this->attachment_extension_list[$i] === TORRENT_EXT) {
$this->attachment_mimetype_list[$i] = 'application/x-bittorrent';
$this->attachment_mimetype_list[$i] = TORRENT_MIMETYPE;
}
// insert attachment into db

View file

@ -10,7 +10,6 @@
namespace TorrentPier\Legacy\Common;
use TorrentPier\Legacy\DateDelta;
use TorrentPier\Legacy\Torrent;
use TorrentPier\Sessions;
use Exception;
@ -253,13 +252,6 @@ class User
$user_id = (int)$this->data['user_id'];
$mod_admin_session = ((int)$this->data['user_level'] === ADMIN || (int)$this->data['user_level'] === MOD);
// Generate passkey
if (!Torrent::getPasskey($this->data['user_id'])) {
if (!Torrent::generate_passkey($this->data['user_id'], true)) {
bb_simple_die('Could not generate passkey');
}
}
// Create new session
for ($i = 0, $max_try = 5; $i <= $max_try; $i++) {
$session_id = make_rand_str(SID_LENGTH);

View file

@ -671,7 +671,7 @@ class Torrent
bb_die("<pre>$out</pre>");
}
header("Content-Type: application/x-bittorrent; name=\"$dl_fname\"");
header("Content-Type: " . TORRENT_MIMETYPE . "; name=\"$dl_fname\"");
header("Content-Disposition: attachment; filename=\"$dl_fname\"");
exit($output);
@ -866,10 +866,6 @@ class Torrent
*/
public static function getPasskey(int|string $user_id): bool|string
{
if ($passkey = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = " . (int)$user_id . " LIMIT 1")) {
return $passkey['auth_key'];
}
return false;
return get_bt_userdata($user_id)['auth_key'];
}
}

View file

@ -76,7 +76,7 @@ class TorrServerAPI
global $bb_cfg;
// Check mimetype
if ($mimetype !== 'application/x-bittorrent') {
if ($mimetype !== TORRENT_MIMETYPE) {
return false;
}

View file

@ -391,7 +391,7 @@ function go_to_page ()
<!--sidebar1-->
<td id="sidebar1">
<div id="sidebar1-wrap">
<div id="user_ratio">
<!-- IF SHOW_BT_USERDATA --><div id="user_ratio">
<h3>{L_USER_RATIO}</h3>
<table cellpadding="0">
<div align="center">{THIS_AVATAR}</div>
@ -402,7 +402,7 @@ function go_to_page ()
<tr><td>{L_BONUS}</td><td class="seedmed">{UP_BONUS}</td></tr>
<!-- IF $bb_cfg['seed_bonus_enabled'] --><tr><td>{L_SEED_BONUS}</td><td><a href="{BONUS_URL}"><span class="points bold">{POINTS}</span></a></td></tr><!-- ENDIF -->
</table>
</div>
</div><!-- ENDIF -->
<!-- IF HTML_SIDEBAR_1 -->
<?php include($V['HTML_SIDEBAR_1']); ?>
<!-- ENDIF -->