mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00: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:
parent
7462724a24
commit
0f5856ce5b
4 changed files with 38 additions and 36 deletions
|
@ -138,6 +138,7 @@
|
||||||
<li>[Change] Alter ACP user quick tools interface to reduce confusion with the delete operation.</li>
|
<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] Send statistics now check for IPv6 and send private network status as a boolean.</li>
|
||||||
<li>[Change] Split "All topics" feed into "New Topics" and "Active Topics" feeds.</li>
|
<li>[Change] Split "All topics" feed into "New Topics" and "Active Topics" feeds.</li>
|
||||||
|
<li>[Change] Forum feed no longer includes posts of subforums.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="v305"></a><h3>1.ii. Changes since 3.0.5</h3>
|
<a name="v305"></a><h3>1.ii. Changes since 3.0.5</h3>
|
||||||
|
|
|
@ -809,7 +809,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||||
* Forum feed
|
* Forum feed
|
||||||
*
|
*
|
||||||
* This will give you the last {$this->num_items} posts made
|
* This will give you the last {$this->num_items} posts made
|
||||||
* within this forum and all its subforums.
|
* within a specific forum.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
|
@ -817,7 +817,6 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
{
|
{
|
||||||
var $forum_id = 0;
|
var $forum_id = 0;
|
||||||
var $forum_data = array();
|
var $forum_data = array();
|
||||||
var $forum_ids = array();
|
|
||||||
|
|
||||||
function phpbb_feed_forum($forum_id)
|
function phpbb_feed_forum($forum_id)
|
||||||
{
|
{
|
||||||
|
@ -831,7 +830,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
global $db, $auth;
|
global $db, $auth;
|
||||||
|
|
||||||
// Check if forum exists
|
// 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 . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
WHERE forum_id = ' . $this->forum_id;
|
WHERE forum_id = ' . $this->forum_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -843,6 +842,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
trigger_error('NO_FORUM');
|
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
|
// Make sure forum is not excluded from feed
|
||||||
if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options']))
|
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;
|
global $auth, $db;
|
||||||
|
|
||||||
$in_fid_ary = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums());
|
$m_approve = ($auth->acl_get('m_approve')) ? true : false;
|
||||||
if (empty($in_fid_ary))
|
$forum_ids = array(0, $this->forum_id);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine subforums
|
// Determine topics with recent activity
|
||||||
$sql = 'SELECT f2.forum_id
|
$sql = 'SELECT topic_id, topic_last_post_time
|
||||||
FROM ' . FORUMS_TABLE . ' f1, ' . FORUMS_TABLE . ' f2
|
FROM ' . TOPICS_TABLE . '
|
||||||
WHERE f1.forum_id = ' . $this->forum_id . '
|
WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
|
||||||
AND (f2.left_id BETWEEN f1.left_id AND f1.right_id)
|
AND topic_moved_id = 0
|
||||||
AND ' . $db->sql_in_set('f2.forum_id', $in_fid_ary);
|
' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
|
||||||
$result = $db->sql_query($sql);
|
ORDER BY topic_last_post_time DESC';
|
||||||
|
$result = $db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
$in_fid_ary = array();
|
$topic_ids = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
$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);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (empty($in_fid_ary))
|
if (empty($topic_ids))
|
||||||
{
|
{
|
||||||
return false;
|
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(
|
$this->sql = array(
|
||||||
'SELECT' => 'f.forum_id, f.forum_name, ' .
|
'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, ' .
|
||||||
'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',
|
'u.username, u.user_id',
|
||||||
'FROM' => array(
|
'FROM' => array(
|
||||||
POSTS_TABLE => 'p',
|
POSTS_TABLE => 'p',
|
||||||
USERS_TABLE => 'u',
|
USERS_TABLE => 'u',
|
||||||
),
|
),
|
||||||
'LEFT_JOIN' => array(
|
'WHERE' => $db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||||
array(
|
' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . '
|
||||||
'FROM' => array(FORUMS_TABLE => 'f'),
|
AND p.post_time >= ' . $min_post_time . '
|
||||||
'ON' => 'f.forum_id = p.forum_id',
|
AND p.poster_id = u.user_id',
|
||||||
),
|
|
||||||
),
|
|
||||||
'WHERE' => $db->sql_in_set('p.forum_id', $in_fid_ary) . '
|
|
||||||
AND p.poster_id = u.user_id
|
|
||||||
AND p.post_approved = 1',
|
|
||||||
'ORDER_BY' => 'p.post_time DESC',
|
'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'];
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -921,7 +921,7 @@ class acp_board
|
||||||
{
|
{
|
||||||
global $user, $config;
|
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
|
// Build forum options
|
||||||
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
||||||
|
|
|
@ -594,7 +594,7 @@ function generate_forum_nav(&$forum_data)
|
||||||
'FORUM_NAME' => $forum_data['forum_name'],
|
'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']),
|
'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;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue