Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with atom feed #147

Merged
merged 2 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Redundant pagination, mysql 5.7+ issue [\#140](https://github.com/torrentpier/torrentpier-lts/pull/140) ([belomaxorka](https://github.com/belomaxorka))
- Added Freeleech [\#143](https://github.com/torrentpier/torrentpier-lts/pull/143) ([belomaxorka](https://github.com/belomaxorka))
- Added some new torrent clients into sidebar [\#146](https://github.com/torrentpier/torrentpier-lts/pull/146) ([belomaxorka](https://github.com/belomaxorka))
- Fixed issue with atom feed [\#147](https://github.com/torrentpier/torrentpier-lts/pull/147) ([belomaxorka](https://github.com/belomaxorka))
- Minor fixes [\#124](https://github.com/torrentpier/torrentpier-lts/pull/124), [\#133](https://github.com/torrentpier/torrentpier-lts/pull/133), [\#135](https://github.com/torrentpier/torrentpier-lts/pull/135), [\#136](https://github.com/torrentpier/torrentpier-lts/pull/136), [\#139](https://github.com/torrentpier/torrentpier-lts/pull/139), [\#142](https://github.com/torrentpier/torrentpier-lts/pull/142), [\#144](https://github.com/torrentpier/torrentpier-lts/pull/144), [\#145](https://github.com/torrentpier/torrentpier-lts/pull/145) ([belomaxorka](https://github.com/belomaxorka))

## [v2.1.5-2023.03](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.03) (2023-04-04)
Expand Down
3 changes: 2 additions & 1 deletion library/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
// Primary domain name
$domain_name = 'torrentpier.com'; // enter here your primary domain name of your site
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
$domain_ssl = false;

// Version info
$bb_cfg['tp_version'] = '2.1.5-2023.04';
Expand Down Expand Up @@ -327,7 +328,7 @@

// Cookie
$bb_cfg['cookie_domain'] = in_array($domain_name, array(getenv('SERVER_ADDR'), 'localhost')) ? '' : ".$domain_name";
$bb_cfg['cookie_secure'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] === 'https') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 1 : 0;
$bb_cfg['cookie_secure'] = $domain_ssl ? 1 : (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] === 'https') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 1 : 0);
$bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_'

// Sessions
Expand Down
14 changes: 7 additions & 7 deletions library/includes/functions_atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

function update_forum_feed ($forum_id, $forum_data)
{
global $bb_cfg;
global $bb_cfg, $lang;
$file_path = $bb_cfg['atom']['path'] .'/f/'. $forum_id .'.atom';
$select_tor_sql = $join_tor_sql = '';
if ($forum_id == 0) $forum_data['forum_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'])
{
$select_tor_sql = ', tor.size AS tor_size, tor.tor_status';
Expand Down Expand Up @@ -121,7 +121,7 @@ function update_user_feed ($user_id, $username)

function create_atom ($file_path, $mode, $id, $title, $topics)
{
global $bb_cfg;
global $lang;
$dir = dirname($file_path);
if (!file_exists($dir))
{
Expand All @@ -137,11 +137,11 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
}
$atom = "";
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://". $bb_cfg['server_name'] . $bb_cfg['script_path'] ."\">\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . FULL_URL . "\">\n";
$atom .= "<title>$title</title>\n";
$atom .= "<updated>". $date ."T$time+00:00</updated>\n";
$atom .= "<id>tag:rto.feed,2000:/$mode/$id</id>\n";
$atom .= "<link href=\"http://". $bb_cfg['server_name'] . $bb_cfg['script_path'] ."\" />\n";
$atom .= "<link href=\"" . FULL_URL . "\" />\n";
foreach ($topics as $topic)
{
$topic_id = $topic['topic_id'];
Expand All @@ -159,14 +159,14 @@ function create_atom ($file_path, $mode, $id, $title, $topics)
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
$topic_title = wbr($topic_title);
$author_name = ($topic['first_username']) ? wbr($topic['first_username']) : 'Гость';
$author_name = ($topic['first_username']) ? wbr($topic['first_username']) : $lang['GUEST'];
$last_time = $topic['topic_last_post_time'];
if ($topic['topic_last_post_edit_time']) $last_time = $topic['topic_last_post_edit_time'];
$date = bb_date($last_time, 'Y-m-d', 0);
$time = bb_date($last_time, 'H:i:s', 0);
$updated = '';
$checktime = TIMENOW - 604800; // неделя (week)
if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) $updated = '[Обновлено] ';
if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) $updated = '[' . $lang['ATOM_UPDATED'] . '] ';
$atom .= "<entry>\n";
$atom .= " <title type=\"html\"><![CDATA[$updated$topic_title$tor_size]]></title>\n";
$atom .= " <author>\n";
Expand Down
2 changes: 2 additions & 0 deletions library/language/en/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,8 @@
$lang['ATOM_NO_MODE'] = 'Do not specify a mode for the feed';
$lang['ATOM_NO_FORUM'] = 'This forum does not have a feed (no ongoing topics)';
$lang['ATOM_NO_USER'] = 'This user does not have a feed (no ongoing topics)';
$lang['ATOM_UPDATED'] = 'Updated';
$lang['ATOM_GLOBAL_FEED'] = 'Global feed for all forums';

$lang['HASH_INVALID'] = 'Hash %s is invalid';
$lang['HASH_NOT_FOUND'] = 'Release with hash %s not found';
Expand Down
2 changes: 2 additions & 0 deletions library/language/ru/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,8 @@
$lang['ATOM_NO_MODE'] = 'Не указан режим для ленты';
$lang['ATOM_NO_FORUM'] = 'Для этого форума нет ленты (нет начатых тем)';
$lang['ATOM_NO_USER'] = 'Для этого пользователя нет ленты (нет начатых тем)';
$lang['ATOM_UPDATED'] = 'Обновлено';
$lang['ATOM_GLOBAL_FEED'] = 'Глобальная лента для всех форумов';

$lang['HASH_INVALID'] = 'Хэш %s некорректен';
$lang['HASH_NOT_FOUND'] = 'Раздача с хэшем %s не найдена';
Expand Down
2 changes: 2 additions & 0 deletions library/language/uk/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -2738,6 +2738,8 @@
$lang['ATOM_NO_MODE'] = 'Не вказано режим для стрічки';
$lang['ATOM_NO_FORUM'] = 'Для цього форуму немає стрічки (немає початих тем)';
$lang['ATOM_NO_USER'] = 'Для цього користувача немає стрічки (немає початих тем)';
$lang['ATOM_UPDATED'] = 'Оновлено';
$lang['ATOM_GLOBAL_FEED'] = 'Глобальна стрічка для всіх форумів';

$lang['HASH_INVALID'] = 'Хеш %s некоректний';
$lang['HASH_NOT_FOUND'] = 'Роздача з хешем %s не знайдено';
Expand Down