From 81975d9fc635e0d714db1022896640a0dfd934b1 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 8 Apr 2024 23:55:34 +0700 Subject: [PATCH] Updated --- library/config.php | 2 ++ library/includes/functions_atom.php | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/library/config.php b/library/config.php index 09feafec..721c25e3 100644 --- a/library/config.php +++ b/library/config.php @@ -588,6 +588,8 @@ $bb_cfg['atom'] = array( // Примечание: Без слэша в конце 'path' => INT_DATA_DIR .'atom', 'url' => './internal_data/atom', + 'direct_down' => true, // Разрешить прямую загрузку торрентов из atom ленты + 'direct_view' => true, // Разрешить прямой просмотр текстов сообщений из atom ленты ); // Nofollow diff --git a/library/includes/functions_atom.php b/library/includes/functions_atom.php index a7c06424..5c9d3a99 100644 --- a/library/includes/functions_atom.php +++ b/library/includes/functions_atom.php @@ -13,7 +13,7 @@ function update_forum_feed ($forum_id, $forum_data) if ($forum_id == 0) $forum_data['forum_name'] = (isset($lang['ATOM_GLOBAL_FEED']) ? $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) @@ -24,12 +24,14 @@ function update_forum_feed ($forum_id, $forum_data) 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 "; @@ -41,12 +43,14 @@ function update_forum_feed ($forum_id, $forum_data) 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 @@ -86,11 +90,13 @@ function update_user_feed ($user_id, $username) 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 @@ -121,7 +127,7 @@ function update_user_feed ($user_id, $username) function create_atom ($file_path, $mode, $id, $title, $topics) { - global $lang; + global $bb_cfg, $lang; $date = null; $time = null; $dir = dirname($file_path); @@ -184,7 +190,18 @@ function create_atom ($file_path, $mode, $id, $title, $topics) $atom .= " \n"; $atom .= " ". $date ."T$time+00:00\n"; $atom .= " tag:rto.feed,". $date .":/t/$topic_id\n"; - $atom .= " \n"; + if ($bb_cfg['atom']['direct_down'] && isset($topic['attach_id'])) + { + $atom .= " \n"; + } + else + { + $atom .= " \n"; + } + if ($bb_cfg['atom']['direct_view']) + { + $atom .= " ".$topic['post_html']."\n\nNews URL: ".FULL_URL.TOPIC_URL.$topic_id."\n"; + } $atom .= "\n"; } $atom .= "";