mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
only display those forums the user is able to read in.
git-svn-id: file:///svn/phpbb/trunk@4889 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
afdf63150d
commit
01202cfc2c
1 changed files with 46 additions and 26 deletions
|
@ -265,9 +265,7 @@ switch ($mode)
|
|||
}
|
||||
|
||||
$post_count_sql = (sizeof($sql_forums)) ? 'AND f.forum_id IN (' . implode(', ', $sql_forums) . ')' : '';
|
||||
unset($sql_forums);
|
||||
unset($f_postcount_ary);
|
||||
unset($auth2);
|
||||
unset($sql_forums, $f_postcount_ary, $auth2);
|
||||
|
||||
// Grab all the relevant data
|
||||
$sql = 'SELECT COUNT(p.post_id) AS num_posts
|
||||
|
@ -280,6 +278,23 @@ switch ($mode)
|
|||
$num_real_posts = min($user->data['user_posts'], $db->sql_fetchfield('num_posts', 0, $result));
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Change post_count_sql to an forum_id array the user is able to see
|
||||
$f_forum_ary = $auth->acl_getf('f_read');
|
||||
|
||||
$sql_forums = array();
|
||||
foreach ($f_forum_ary as $forum_id => $allow)
|
||||
{
|
||||
if ($allow)
|
||||
{
|
||||
$sql_forums[] = $forum_id;
|
||||
}
|
||||
}
|
||||
|
||||
$post_count_sql = (sizeof($sql_forums)) ? 'AND f.forum_id IN (' . implode(', ', $sql_forums) . ')' : '';
|
||||
unset($sql_forums, $f_forum_ary);
|
||||
|
||||
if ($post_count_sql)
|
||||
{
|
||||
$sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
|
||||
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
|
||||
WHERE p.poster_id = $user_id
|
||||
|
@ -304,6 +319,11 @@ switch ($mode)
|
|||
|
||||
$active_t_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$active_f_row = $active_t_row = array();
|
||||
}
|
||||
|
||||
// Do the relevant calculations
|
||||
$memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
|
||||
|
@ -876,7 +896,7 @@ function show_profile($data)
|
|||
}
|
||||
}
|
||||
|
||||
$email = (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email')) ? ((!empty($config['board_email_form'])) ? "memberlist.$phpEx$SID&mode=email&u=$user_id" : 'mailto:' . $row['user_email']) : '';
|
||||
$email = (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email')) ? ((!empty($config['board_email_form'])) ? "memberlist.$phpEx$SID&mode=email&u=$user_id" : 'mailto:' . $data['user_email']) : '';
|
||||
|
||||
$last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
|
||||
|
||||
|
@ -905,7 +925,7 @@ function show_profile($data)
|
|||
'U_ICQ' => ($data['user_icq']) ? "memberlist.$phpEx$SID&mode=contact&action=icq&u=$user_id" : '',
|
||||
'U_AIM' => ($data['user_aim']) ? "memberlist.$phpEx$SID&mode=contact&action=aim&u=$user_id" : '',
|
||||
'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : '',
|
||||
'U_MSN' => ($data['user_msn']) ? "memberlist.$phpEx$SID&mode=contact&action=msn&u=$user_id" : '',
|
||||
'U_MSN' => ($data['user_msnm']) ? "memberlist.$phpEx$SID&mode=contact&action=msn&u=$user_id" : '',
|
||||
'U_JABBER' => ($data['user_jabber']) ? "memberlist.$phpEx$SID&mode=contact&action=jabber&u=$user_id" : '',
|
||||
|
||||
'S_ONLINE' => (intval($data['session_time']) >= time() - 300) ? true : false
|
||||
|
|
Loading…
Add table
Reference in a new issue