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

Provide some more generic methods.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10351 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-12-20 13:18:04 +00:00
parent 7d406a36cd
commit 28c33de6d9

View File

@ -550,6 +550,48 @@ class phpbb_feed_base
return $this->excluded_forums_ary;
}
function get_readable_forums()
{
global $auth;
return array_keys($auth->acl_getf('f_read'));
}
function get_excluded_forums()
{
global $db, $cache;
static $forum_ids;
$cache_name = 'feed_excluded_forum_ids';
$cache_ttl = 300;
if (!isset($forum_ids) && ($forum_ids = $cache->get('_' . $cache_name)) === false)
{
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '<> 0');
$result = $db->sql_query($sql);
$forum_ids = array();
while ($forum_id = (int) $db->sql_fetchfield('forum_id'))
{
$forum_ids[$forum_id] = $forum_id;
}
$db->sql_freeresult($result);
$cache->put('_' . $cache_name, $forum_ids, $cache_ttl);
}
return $forum_ids;
}
function is_excluded_forum($forum_id)
{
$forum_ids = $this->get_excluded_forums();
return isset($forum_ids[$forum_id]) ? true : false;
}
function get_passworded_forums()
{
global $db, $user;