#54345 - Passworded forums

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10318 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-12-11 16:41:37 +00:00
parent afa8dcb42a
commit d3cd9ce01e
2 changed files with 28 additions and 4 deletions

View file

@ -109,11 +109,11 @@
<li>[Fix] Use memcache::replace() instead of memcache::set() for existing keys to prevent problems.</li> <li>[Fix] Use memcache::replace() instead of memcache::set() for existing keys to prevent problems.</li>
<li>[Fix] Check for required functions in eAccelerator. (Bug #54465)</li> <li>[Fix] Check for required functions in eAccelerator. (Bug #54465)</li>
<li>[Fix] Use correct RFC 3339 date format in ATOM feed. (Bug #55005)</li> <li>[Fix] Use correct RFC 3339 date format in ATOM feed. (Bug #55005)</li>
<li>[Fix] Do not deliver topics from unreadable or passworded forums in the news feed. (Bug #54345)</li>
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li> <li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li> <li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>
<li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li> <li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li>
<li>[Change] Cache overall, forums, topics and news feeds for anonymous users and bots.</li> <li>[Change] Cache overall, forums, topics and news feeds for anonymous users and bots.</li>
<li>[Change] Do not deliver topics from unreadable forums in the news feed. (Bug #54345)</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>

View file

@ -545,6 +545,16 @@ class phpbb_feed_base
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Include passworded forums
$this->excluded_forums_ary = array_unique(array_merge($this->excluded_forums_ary, $this->get_passworded_forums()));
return $this->excluded_forums_ary;
}
function get_passworded_forums()
{
global $db, $user;
// Exclude passworded forums // Exclude passworded forums
$sql = 'SELECT f.forum_id, fa.user_id $sql = 'SELECT f.forum_id, fa.user_id
FROM ' . FORUMS_TABLE . ' f FROM ' . FORUMS_TABLE . ' f
@ -554,16 +564,19 @@ class phpbb_feed_base
WHERE f.forum_password <> ''"; WHERE f.forum_password <> ''";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$forum_ids = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$forum_id = (int) $row['forum_id'];
if ($row['user_id'] != $user->data['user_id']) if ($row['user_id'] != $user->data['user_id'])
{ {
$this->excluded_forums_ary[(int) $row['forum_id']] = (int) $row['forum_id']; $forum_ids[$forum_id] = $forum_id;
} }
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
return $this->excluded_forums_ary; return $forum_ids;
} }
function get_item() function get_item()
@ -960,6 +973,9 @@ class phpbb_feed_news extends phpbb_feed_base
{ {
global $auth, $config, $db; global $auth, $config, $db;
// Get passworded forums
$forum_ids_passworded = $this->get_passworded_forums();
// Get news forums... // Get news forums...
$sql = 'SELECT forum_id $sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
@ -969,8 +985,16 @@ class phpbb_feed_news extends phpbb_feed_base
$in_fid_ary = array(); $in_fid_ary = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$forum_id = (int) $row['forum_id'];
// Passworded forum
if (isset($forum_ids_passworded[$forum_id]))
{
continue;
}
// Make sure we can read this forum // Make sure we can read this forum
if (!$auth->acl_get('f_read', (int) $row['forum_id'])) if (!$auth->acl_get('f_read', $forum_id))
{ {
continue; continue;
} }