diff options
author | Nils Adermann <naderman@naderman.de> | 2011-08-25 23:21:09 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-08-25 23:21:09 -0400 |
commit | 73aca1a6fb72137befa6b61fba402ebe5e2babe1 (patch) | |
tree | 8e530b869ead1325644c89e0f5120bd527136d37 /phpBB/includes/session.php | |
parent | 459570bcca9347f4f115e0e53d098b4ebd4ffc1a (diff) | |
parent | 0d4089da7fab3c4e2f177ad62bed142d4df181e1 (diff) | |
download | forums-73aca1a6fb72137befa6b61fba402ebe5e2babe1.tar forums-73aca1a6fb72137befa6b61fba402ebe5e2babe1.tar.gz forums-73aca1a6fb72137befa6b61fba402ebe5e2babe1.tar.bz2 forums-73aca1a6fb72137befa6b61fba402ebe5e2babe1.tar.xz forums-73aca1a6fb72137befa6b61fba402ebe5e2babe1.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10320] Exclude passworded forums when determining "Most active topic".
[ticket/10320] Move phpbb_feed_base::get_passworded_forums() to user class.
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r-- | phpBB/includes/session.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 84ad98d31f..e734c8074f 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2443,4 +2443,37 @@ class user extends session return true; } + + /** + * Returns all password protected forum ids the user is currently NOT authenticated for. + * + * @return array Array of forum ids + * @access public + */ + function get_passworded_forums() + { + global $db; + + $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($this->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'] != $this->data['user_id']) + { + $forum_ids[$forum_id] = $forum_id; + } + } + $db->sql_freeresult($result); + + return $forum_ids; + } } |