1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

No longer include subforums in forum feed.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10405 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2010-01-12 21:15:32 +00:00
parent 7462724a24
commit 0f5856ce5b
4 changed files with 38 additions and 36 deletions

View File

@ -138,6 +138,7 @@
<li>[Change] Alter ACP user quick tools interface to reduce confusion with the delete operation.</li>
<li>[Change] Send statistics now check for IPv6 and send private network status as a boolean.</li>
<li>[Change] Split &quot;All topics&quot; feed into &quot;New Topics&quot; and &quot;Active Topics&quot; feeds.</li>
<li>[Change] Forum feed no longer includes posts of subforums.</li>
</ul>
<a name="v305"></a><h3>1.ii. Changes since 3.0.5</h3>

View File

@ -809,7 +809,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
* Forum feed
*
* This will give you the last {$this->num_items} posts made
* within this forum and all its subforums.
* within a specific forum.
*
* @package phpBB3
*/
@ -817,7 +817,6 @@ class phpbb_feed_forum extends phpbb_feed_post_base
{
var $forum_id = 0;
var $forum_data = array();
var $forum_ids = array();
function phpbb_feed_forum($forum_id)
{
@ -831,7 +830,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
global $db, $auth;
// Check if forum exists
$sql = 'SELECT forum_id, forum_name, forum_options, forum_password
$sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $this->forum_id;
$result = $db->sql_query($sql);
@ -843,6 +842,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base
trigger_error('NO_FORUM');
}
// Forum needs to be postable
if ($this->forum_data['forum_type'] != FORUM_POST)
{
trigger_error('NO_FEED');
}
// Make sure forum is not excluded from feed
if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options']))
{
@ -873,53 +878,44 @@ class phpbb_feed_forum extends phpbb_feed_post_base
{
global $auth, $db;
$in_fid_ary = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums());
if (empty($in_fid_ary))
{
return false;
}
$m_approve = ($auth->acl_get('m_approve')) ? true : false;
$forum_ids = array(0, $this->forum_id);
// Determine subforums
$sql = 'SELECT f2.forum_id
FROM ' . FORUMS_TABLE . ' f1, ' . FORUMS_TABLE . ' f2
WHERE f1.forum_id = ' . $this->forum_id . '
AND (f2.left_id BETWEEN f1.left_id AND f1.right_id)
AND ' . $db->sql_in_set('f2.forum_id', $in_fid_ary);
$result = $db->sql_query($sql);
// Determine topics with recent activity
$sql = 'SELECT topic_id, topic_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
AND topic_moved_id = 0
' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
ORDER BY topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $this->num_items);
$in_fid_ary = array();
while ($row = $db->sql_fetchrow($result))
$topic_ids = array();
$min_post_time = 0;
while ($row = $db->sql_fetchrow())
{
$in_fid_ary[] = (int) $row['forum_id'];
$topic_ids[] = (int) $row['topic_id'];
$min_post_time = (int) $row['topic_last_post_time'];
}
$db->sql_freeresult($result);
if (empty($in_fid_ary))
if (empty($topic_ids))
{
return false;
}
// Add global topics forum '0' to forum ids
// This is kind of hackish, but therefore we don't need the topic table (t.topic_type)
$in_fid_ary[] = 0;
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name, ' .
'p.post_id, p.topic_id, p.post_time, 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_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',
USERS_TABLE => 'u',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(FORUMS_TABLE => 'f'),
'ON' => 'f.forum_id = p.forum_id',
),
),
'WHERE' => $db->sql_in_set('p.forum_id', $in_fid_ary) . '
AND p.poster_id = u.user_id
AND p.post_approved = 1',
'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . '
' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . '
AND p.post_time >= ' . $min_post_time . '
AND p.poster_id = u.user_id',
'ORDER_BY' => 'p.post_time DESC',
);
@ -932,6 +928,11 @@ class phpbb_feed_forum extends phpbb_feed_post_base
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
}
function get_item()
{
return ($row = parent::get_item()) ? array_merge($this->forum_data, $row) : $row;
}
}
/**

View File

@ -921,7 +921,7 @@ class acp_board
{
global $user, $config;
$forum_list = make_forum_select(false, false, true, false, false, false, true);
$forum_list = make_forum_select(false, false, true, true, true, false, true);
// Build forum options
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';

View File

@ -594,7 +594,7 @@ function generate_forum_nav(&$forum_data)
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
));
return;