Line 95 | Line 95 |
---|
$title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : '');
|
$title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : '');
|
$item_time = (int) $row[$feed->get('date')];
| $published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0; $updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0;
|
$item_row = array( 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
|
$item_row = array( 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
|
'pubdate' => feed_format_date($item_time),
| 'published' => ($published > 0) ? feed_format_date($published) : '', 'updated' => ($updated > 0) ? feed_format_date($updated) : '',
|
'link' => '', 'title' => censor_text($title), 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
| 'link' => '', 'title' => censor_text($title), 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
|
Line 113 | Line 115 |
---|
$item_vars[] = $item_row;
|
$item_vars[] = $item_row;
|
$feed_updated_time = max($feed_updated_time, $item_time);
| $feed_updated_time = max($feed_updated_time, $published, $updated);
|
}
// If we do not have any items at all, sending the current time is better than sending no time.
| }
// If we do not have any items at all, sending the current time is better than sending no time.
|
Line 170 | Line 172 |
---|
header("Content-Type: application/atom+xml; charset=UTF-8"); header("Last-Modified: " . gmdate('D, d M Y H:i:s', $feed_updated_time) . ' GMT');
|
header("Content-Type: application/atom+xml; charset=UTF-8"); header("Last-Modified: " . gmdate('D, d M Y H:i:s', $feed_updated_time) . ' GMT');
|
| if (!empty($user->data['is_bot'])) { // Let reverse proxies know we detected a bot. header('X-PHPBB-IS-BOT: yes'); }
|
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n";
| echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="' . $global_vars['FEED_LANG'] . '">' . "\n";
|
Line 192 | Line 200 |
---|
echo '<author><name><![CDATA[' . $row['author'] . ']]></name></author>' . "\n"; }
|
echo '<author><name><![CDATA[' . $row['author'] . ']]></name></author>' . "\n"; }
|
echo '<updated>' . $row['pubdate'] . '</updated>' . "\n";
| echo '<updated>' . ((!empty($row['updated'])) ? $row['updated'] : $row['published']) . '</updated>' . "\n";
if (!empty($row['published'])) { echo '<published>' . $row['published'] . '</published>' . "\n"; }
|
echo '<id>' . $row['link'] . '</id>' . "\n"; echo '<link href="' . $row['link'] . '"/>' . "\n"; echo '<title type="html"><![CDATA[' . $row['title'] . ']]></title>' . "\n\n";
| echo '<id>' . $row['link'] . '</id>' . "\n"; echo '<link href="' . $row['link'] . '"/>' . "\n"; echo '<title type="html"><![CDATA[' . $row['title'] . ']]></title>' . "\n\n";
|
Line 449 | Line 463 |
---|
* Separator for the statistics row (Posted by, post date, replies, etc.) */ var $separator_stats = "\xE2\x80\x94"; // —
|
* Separator for the statistics row (Posted by, post date, replies, etc.) */ var $separator_stats = "\xE2\x80\x94"; // —
|
| /** @var mixed Query result handle */ var $result;
|
/** * Constructor
| /** * Constructor
|
Line 596 | Line 613 |
---|
function get_passworded_forums() {
|
function get_passworded_forums() {
|
global $db, $user;
| global $user;
|
|
|
// Exclude passworded forums $sql = 'SELECT f.forum_id, fa.user_id FROM ' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') WHERE f.forum_password <> ''"; $result = $db->sql_query($sql);
$forum_ids = array(); while ($row = $db->sql_fetchrow($result)) { $forum_id = (int) $row['forum_id'];
if ($row['user_id'] != $user->data['user_id']) { $forum_ids[$forum_id] = $forum_id; } } $db->sql_freeresult($result);
return $forum_ids;
| return $user->get_passworded_forums();
|
}
function get_item() {
|
}
function get_item() {
|
global $db, $cache; static $result;
| global $db;
|
|
|
if (!isset($result))
| if (!isset($this->result))
|
{ if (!$this->get_sql()) {
| { if (!$this->get_sql()) {
|
Line 636 | Line 631 |
---|
// Query database $sql = $db->sql_build_query('SELECT', $this->sql);
|
// Query database $sql = $db->sql_build_query('SELECT', $this->sql);
|
$result = $db->sql_query_limit($sql, $this->num_items);
| $this->result = $db->sql_query_limit($sql, $this->num_items);
|
}
|
}
|
return $db->sql_fetchrow($result);
| return $db->sql_fetchrow($this->result);
|
}
function user_viewprofile($row)
| }
function user_viewprofile($row)
|
Line 675 | Line 670 |
---|
$this->set('author_id', 'user_id'); $this->set('creator', 'username');
|
$this->set('author_id', 'user_id'); $this->set('creator', 'username');
|
$this->set('date', 'post_time');
| $this->set('published', 'post_time'); $this->set('updated', 'post_edit_time');
|
$this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
| $this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
|
Line 695 | Line 691 |
---|
if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
. ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time'])
| . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')])
|
. (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); } }
| . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); } }
|
Line 717 | Line 713 |
---|
$this->set('author_id', 'topic_poster'); $this->set('creator', 'topic_first_poster_name');
|
$this->set('author_id', 'topic_poster'); $this->set('creator', 'topic_first_poster_name');
|
$this->set('date', 'topic_time');
| $this->set('published', 'post_time'); $this->set('updated', 'post_edit_time');
|
$this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
| $this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
|
Line 737 | Line 734 |
---|
if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
. ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('date')])
| . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')])
|
. ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : '');
| . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : '');
|
Line 800 | Line 797 |
---|
// Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' .
|
// Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' .
|
'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
| 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
'u.username, u.user_id', 'FROM' => array( USERS_TABLE => 'u',
| 'u.username, u.user_id', 'FROM' => array( USERS_TABLE => 'u',
|
Line 932 | Line 929 |
---|
}
$this->sql = array(
|
}
$this->sql = array(
|
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
| 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p',
| 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p',
|
Line 1097 | Line 1094 |
---|
global $auth, $db;
$this->sql = array(
|
global $auth, $db;
$this->sql = array(
|
'SELECT' => 'p.post_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
| 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p',
| 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p',
|
Line 1136 | Line 1133 |
---|
$this->set('text', 'forum_desc'); $this->set('bitfield', 'forum_desc_bitfield'); $this->set('bbcode_uid','forum_desc_uid');
|
$this->set('text', 'forum_desc'); $this->set('bitfield', 'forum_desc_bitfield'); $this->set('bbcode_uid','forum_desc_uid');
|
$this->set('date', 'forum_last_post_time');
| $this->set('updated', 'forum_last_post_time');
|
$this->set('options', 'forum_desc_options'); }
| $this->set('options', 'forum_desc_options'); }
|
Line 1261 | Line 1258 |
---|
$this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name,
|
$this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name,
|
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
| t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
| 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
|
Line 1334 | Line 1331 |
---|
$this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name,
|
$this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name,
|
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
| t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
| 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
|
Line 1381 | Line 1378 |
---|
$this->set('author_id', 'topic_last_poster_id'); $this->set('creator', 'topic_last_poster_name');
|
$this->set('author_id', 'topic_last_poster_id'); $this->set('creator', 'topic_last_poster_name');
|
$this->set('date', 'topic_last_post_time'); $this->set('text', 'post_text');
| |
}
function get_sql()
| }
function get_sql()
|
Line 1434 | Line 1429 |
---|
'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
|
'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
|
p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
| p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
| 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p',
|