Revert "Updated"

This reverts commit 85b0c68d52.
This commit is contained in:
Roman Kelesidis 2023-12-16 16:20:03 +07:00
parent 9445b1f2dd
commit 01dd6009c9
2 changed files with 9 additions and 35 deletions

View File

@ -573,8 +573,6 @@ $bb_cfg['atom'] = array(
// Примечание: Без слэша в конце // Примечание: Без слэша в конце
'path' => INT_DATA_DIR .'atom', 'path' => INT_DATA_DIR .'atom',
'url' => './internal_data/atom', 'url' => './internal_data/atom',
'direct_down' => true, // Allow direct downloading of torrents from feeds
'direct_view' => true, // Allow direct viewing of post texts in feeds
); );
// Nofollow // Nofollow

View File

@ -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['forum_name'] = (isset($lang['ATOM_GLOBAL_FEED']) ? $lang['ATOM_GLOBAL_FEED'] : $bb_cfg['server_name']);
if ($forum_id > 0 && $forum_data['allow_reg_tracker']) if ($forum_id > 0 && $forum_data['allow_reg_tracker'])
{ {
$select_tor_sql = ', tor.size AS tor_size, tor.tor_status, tor.attach_id'; $select_tor_sql = ', tor.size AS tor_size, tor.tor_status';
$join_tor_sql = "LEFT JOIN ". BB_BT_TORRENTS ." tor ON(t.topic_id = tor.topic_id)"; $join_tor_sql = "LEFT JOIN ". BB_BT_TORRENTS ." tor ON(t.topic_id = tor.topic_id)";
} }
if ($forum_id == 0) if ($forum_id == 0)
@ -24,14 +24,12 @@ function update_forum_feed ($forum_id, $forum_data)
u1.username AS first_username, u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time, 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,
tor.size AS tor_size, tor.tor_status, tor.attach_id, tor.size AS tor_size, tor.tor_status
pt.post_html
FROM ". BB_BT_TORRENTS ." tor FROM ". BB_BT_TORRENTS ." tor
LEFT JOIN ". BB_TOPICS ." t ON(tor.topic_id = t.topic_id) 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_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 ." 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 ." 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 ORDER BY t.topic_last_post_time DESC
LIMIT 100 LIMIT 100
"; ";
@ -43,14 +41,12 @@ function update_forum_feed ($forum_id, $forum_data)
t.topic_id, t.topic_title, t.topic_status, t.topic_id, t.topic_title, t.topic_status,
u1.username AS first_username, u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time, 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 $select_tor_sql
FROM ". BB_TOPICS ." t FROM ". BB_TOPICS ." t
LEFT JOIN ". BB_USERS ." u1 ON(t.topic_poster = u1.user_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 ." 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 ." 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 $join_tor_sql
WHERE t.forum_id = $forum_id WHERE t.forum_id = $forum_id
ORDER BY t.topic_last_post_time DESC ORDER BY t.topic_last_post_time DESC
@ -90,13 +86,11 @@ function update_user_feed ($user_id, $username)
u1.username AS first_username, u1.username AS first_username,
p1.post_time AS topic_first_post_time, p1.post_edit_time AS topic_first_post_edit_time, 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,
tor.size AS tor_size, tor.tor_status, tor.attach_id, tor.size AS tor_size, tor.tor_status
pt.post_html
FROM ". BB_TOPICS ." t FROM ". BB_TOPICS ." t
LEFT JOIN ". BB_USERS ." u1 ON(t.topic_poster = u1.user_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 ." 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 ." 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) LEFT JOIN ". BB_BT_TORRENTS ." tor ON(t.topic_id = tor.topic_id)
WHERE t.topic_poster = $user_id WHERE t.topic_poster = $user_id
ORDER BY t.topic_last_post_time DESC ORDER BY t.topic_last_post_time DESC
@ -127,9 +121,7 @@ function update_user_feed ($user_id, $username)
function create_atom ($file_path, $mode, $id, $title, $topics) function create_atom ($file_path, $mode, $id, $title, $topics)
{ {
global $bb_cfg, $lang; global $lang;
$date = null;
$time = null;
$dir = dirname($file_path); $dir = dirname($file_path);
if (!file_exists($dir)) if (!file_exists($dir))
{ {
@ -143,7 +135,8 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
$time = bb_date($last_time, 'H:i:s', 0); $time = bb_date($last_time, 'H:i:s', 0);
break; break;
} }
$atom = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; $atom = "";
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . FULL_URL . "\">\n"; $atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . FULL_URL . "\">\n";
$atom .= "<title>$title</title>\n"; $atom .= "<title>$title</title>\n";
$atom .= "<updated>". $date ."T$time+00:00</updated>\n"; $atom .= "<updated>". $date ."T$time+00:00</updated>\n";
@ -157,11 +150,6 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
{ {
$tor_size = str_replace('&nbsp;', ' ', ' ['. humn_size($topic['tor_size']) .']'); $tor_size = str_replace('&nbsp;', ' ', ' ['. humn_size($topic['tor_size']) .']');
} }
$tor_status = '';
if (isset($topic['tor_status']))
{
$tor_status = " ({$lang['TOR_STATUS_NAME'][$topic['tor_status']]})";
}
$topic_title = $topic['topic_title']; $topic_title = $topic['topic_title'];
$orig_word = array(); $orig_word = array();
$replacement_word = array(); $replacement_word = array();
@ -180,25 +168,13 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
$checktime = TIMENOW - 604800; // неделя (week) $checktime = TIMENOW - 604800; // неделя (week)
if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) $updated = '[' . $lang['ATOM_UPDATED'] . '] '; if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) $updated = '[' . $lang['ATOM_UPDATED'] . '] ';
$atom .= "<entry>\n"; $atom .= "<entry>\n";
$atom .= " <title type=\"html\"><![CDATA[$updated$topic_title$tor_status$tor_size]]></title>\n"; $atom .= " <title type=\"html\"><![CDATA[$updated$topic_title$tor_size]]></title>\n";
$atom .= " <author>\n"; $atom .= " <author>\n";
$atom .= " <name>$author_name</name>\n"; $atom .= " <name>$author_name</name>\n";
$atom .= " </author>\n"; $atom .= " </author>\n";
$atom .= " <updated>". $date ."T$time+00:00</updated>\n"; $atom .= " <updated>". $date ."T$time+00:00</updated>\n";
$atom .= " <id>tag:rto.feed,". $date .":/t/$topic_id</id>\n"; $atom .= " <id>tag:rto.feed,". $date .":/t/$topic_id</id>\n";
if ($bb_cfg['atom']['direct_down'] && isset($topic['attach_id'])) $atom .= " <link href=\"".TOPIC_URL.$topic_id."\" />\n";
{
$atom .= " <link href=\"" . DOWNLOAD_URL . $topic['attach_id'] . "\" />\n";
}
else
{
$atom .= " <link href=\"" . TOPIC_URL . $topic_id . "\" />\n";
}
if ($bb_cfg['atom']['direct_view'])
{
$atom .= " <description>" . $topic['post_html'] . "\n\nNews URL: " . FULL_URL . TOPIC_URL . $topic_id . "</description>\n";
}
$atom .= "</entry>\n"; $atom .= "</entry>\n";
} }
$atom .= "</feed>"; $atom .= "</feed>";