diff --git a/bt/announce.php b/bt/announce.php
index e9f1ff1ed..808c3cf6b 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -83,7 +83,7 @@ if (!isset($info_hash)) {
$info_hash_hex = bin2hex($info_hash);
// Store peer id
-$peer_id_sql = rtrim(DB()->escape(preg_replace('/[^a-zA-Z0-9\-\_\.]/', '', $peer_id)), ' ');
+$peer_id_sql = rtrim(DB()->escape(preg_replace('/[^a-zA-Z0-9\-\_]/', '', $peer_id)), ' ');
// Check info_hash length
if (strlen($info_hash) !== 20) {
@@ -390,13 +390,12 @@ if (!$output) {
// Retrieve peers
$numwant = (int)$bb_cfg['tracker']['numwant'];
$compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
- $priority = $seeder ? 'seeder ASC, RAND()' : 'RAND()';
$rowset = DB()->fetch_rowset("
SELECT ip, ipv6, port
FROM " . BB_BT_TRACKER . "
WHERE topic_id = $topic_id
- ORDER BY $priority
+ ORDER BY seeder ASC, RAND()
LIMIT $numwant
");
diff --git a/dl.php b/dl.php
index d3f6f4a8a..d9ce28af0 100644
--- a/dl.php
+++ b/dl.php
@@ -143,9 +143,26 @@ if (!$authorised) {
$datastore->rm('cat_forums');
-//
+
+// Check tor status
+if (!IS_AM) {
+ $sql = 'SELECT tor_status, poster_id FROM ' . BB_BT_TORRENTS . ' WHERE attach_id = ' . (int)$attachment['attach_id'];
+
+ if (!($result = DB()->sql_query($sql))) {
+ bb_die('Could not query tor_status information');
+ }
+
+ $row = DB()->sql_fetchrow($result);
+
+ if (isset($bb_cfg['tor_frozen'][$row['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$row['tor_status']]) && $userdata['user_id'] === $row['poster_id'])) {
+ bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]);
+ }
+
+ DB()->sql_freeresult($result);
+}
+
// Get Information on currently allowed Extensions
-//
+
$rows = get_extension_informations();
$num_rows = count($rows);
diff --git a/library/config.php b/library/config.php
index 4ef5af87e..0f89659ea 100644
--- a/library/config.php
+++ b/library/config.php
@@ -12,7 +12,7 @@ if (!defined('BB_ROOT')) {
}
// Server settings
-$reserved_name = 'torrentpier.com';
+$reserved_name = 'torrentpier.com'; // Use your domain name for auto-generated atom feeds
$reserved_port = 80;
$bb_cfg = [];
@@ -629,6 +629,8 @@ $bb_cfg['captcha'] = [
$bb_cfg['atom'] = [
'path' => INT_DATA_DIR . '/atom', // without ending slash
'url' => './internal_data/atom', // without ending slash
+ 'direct_down' => true, // Allow direct downloading of torrents from feeds
+ 'direct_view' => true, // Allow direct viewing of post texts in feeds
];
// Nofollow
diff --git a/library/language/source/main.php b/library/language/source/main.php
index e19911197..d10e11d85 100644
--- a/library/language/source/main.php
+++ b/library/language/source/main.php
@@ -68,7 +68,7 @@ $lang['SHORT_PAGE'] = 'page';
$lang['GOTO_PAGE'] = 'Go to page';
$lang['GOTO_SHORT'] = 'Page';
$lang['JOINED'] = 'Joined';
-$lang['LONGEVITY'] = 'Longevity';
+$lang['LONGEVITY'] = 'Registered';
$lang['IP_ADDRESS'] = 'IP Address';
$lang['POSTED_AFTER'] = 'after';
@@ -1106,25 +1106,26 @@ $lang['TOR_STATUS'] = 'Status';
$lang['TOR_STATUS_SELECT_ACTION'] = 'Select status';
$lang['TOR_STATUS_NOT_SELECT'] = 'You have not selected status.';
$lang['TOR_STATUS_SELECT_ALL'] = 'All statuses';
+$lang['TOR_STATUS_FORBIDDEN'] = 'This topic\'s status is: ';
$lang['TOR_STATUS_NAME'] = [
TOR_NOT_APPROVED => 'not checked',
TOR_CLOSED => 'closed',
TOR_APPROVED => 'checked',
TOR_NEED_EDIT => 'not formalized until',
TOR_NO_DESC => 'not formalized',
- TOR_DUP => 'repeat',
- TOR_CLOSED_CPHOLD => 'closed right',
+ TOR_DUP => 'duplicate',
+ TOR_CLOSED_CPHOLD => 'closed (copyright)',
TOR_CONSUMED => 'absorbed',
TOR_DOUBTFUL => 'doubtful',
- TOR_CHECKING => 'verified',
+ TOR_CHECKING => 'being checked',
TOR_TMP => 'temporary',
TOR_PREMOD => 'pre-moderation',
- TOR_REPLENISH => 'replenish',
+ TOR_REPLENISH => 'replenishing',
];
$lang['TOR_STATUS_FAILED'] = 'Such status does not exist!';
$lang['TORRENT_FAILED'] = 'Distribution was not found!';
$lang['TOR_STATUS_DUB'] = 'Distribution has the same status';
-$lang['TOR_DONT_CHANGE'] = 'Change of status can not be!';
+$lang['TOR_DONT_CHANGE'] = 'Change of status can not be performed!';
$lang['TOR_STATUS_OF'] = 'Distribution has the status of:';
$lang['TOR_STATUS_CHANGED'] = 'Status changed: ';
$lang['TOR_BACK'] = ' back';
diff --git a/src/Legacy/Atom.php b/src/Legacy/Atom.php
index 6ae860bf4..b7a28c8de 100644
--- a/src/Legacy/Atom.php
+++ b/src/Legacy/Atom.php
@@ -33,7 +33,7 @@ class Atom
$forum_data['forum_name'] = $lang['ATOM_GLOBAL_FEED'] ?? $bb_cfg['server_name'];
}
if ($forum_id > 0 && $forum_data['allow_reg_tracker']) {
- $select_tor_sql = ', tor.size AS tor_size, tor.tor_status';
+ $select_tor_sql = ', tor.size AS tor_size, tor.tor_status, tor.attach_id';
$join_tor_sql = "LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)";
}
if ($forum_id == 0) {
@@ -43,12 +43,14 @@ class Atom
u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time,
- tor.size AS tor_size, tor.tor_status
+ tor.size AS tor_size, tor.tor_status, tor.attach_id,
+ pt.post_html
FROM " . BB_BT_TORRENTS . " tor
LEFT JOIN " . BB_TOPICS . " t ON(tor.topic_id = t.topic_id)
LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
+ LEFT JOIN " . BB_POSTS_HTML . " pt ON(p1.post_id = pt.post_id)
ORDER BY t.topic_last_post_time DESC
LIMIT 100
";
@@ -58,12 +60,14 @@ class Atom
t.topic_id, t.topic_title, t.topic_status,
u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
- p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time
+ p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time,
+ pt.post_html
$select_tor_sql
FROM " . BB_TOPICS . " t
LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
+ LEFT JOIN " . BB_POSTS_HTML . " pt ON(p1.post_id = pt.post_id)
$join_tor_sql
WHERE t.forum_id = $forum_id
ORDER BY t.topic_last_post_time DESC
@@ -114,11 +118,13 @@ class Atom
u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time,
p2.post_time AS topic_last_post_time, p2.post_edit_time AS topic_last_post_edit_time,
- tor.size AS tor_size, tor.tor_status
+ tor.size AS tor_size, tor.tor_status, tor.attach_id,
+ pt.post_html
FROM " . BB_TOPICS . " t
LEFT JOIN " . BB_USERS . " u1 ON(t.topic_poster = u1.user_id)
LEFT JOIN " . BB_POSTS . " p1 ON(t.topic_first_post_id = p1.post_id)
LEFT JOIN " . BB_POSTS . " p2 ON(t.topic_last_post_id = p2.post_id)
+ LEFT JOIN " . BB_POSTS_HTML . " pt ON(p1.post_id = pt.post_id)
LEFT JOIN " . BB_BT_TORRENTS . " tor ON(t.topic_id = tor.topic_id)
WHERE t.topic_poster = $user_id
ORDER BY t.topic_last_post_time DESC
@@ -163,7 +169,7 @@ class Atom
*/
private static function create_atom($file_path, $mode, $id, $title, $topics)
{
- global $lang;
+ global $bb_cfg, $lang;
$date = null;
$time = null;
$dir = \dirname($file_path);
@@ -181,8 +187,7 @@ class Atom
$time = bb_date($last_time, 'H:i:s', 0);
break;
}
- $atom = "";
- $atom .= "\n";
+ $atom = "\n";
$atom .= "
{postrow.attach.tor_reged.DOWNLOAD_NAME} {postrow.attach.tor_reged.MAGNET} | +{postrow.attach.tor_reged.DOWNLOAD_NAME} {postrow.attach.tor_reged.MAGNET} | ||||
---|---|---|---|---|---|
{postrow.attach.tor_reged.TRACKER_LINK}
[ {postrow.attach.tor_reged.REGED_TIME} ]
- info_hash: {postrow.attach.tor_reged.HASH} - info_hash v2: {postrow.attach.tor_reged.HASH_V2} - |
+
+
{postrow.attach.tor_reged.S_UPLOAD_IMAGE} {L_DOWNLOAD} |