1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-19 23:32:02 +02:00

[ticket/15372] Add and handle f_list_topics permission

This commit is contained in:
David Colón 2017-09-24 21:21:01 -04:00
parent 3b5c624c03
commit dc5267728b
5 changed files with 10 additions and 8 deletions

View File

@ -537,7 +537,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
// Create last post link information, if appropriate
if ($row['forum_last_post_id'])
{
if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post']))
if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post']))
{
$last_post_subject = censor_text($row['forum_last_post_subject']);
$last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);

View File

@ -107,6 +107,7 @@ $lang = array_merge($lang, array(
// Forum Permissions
$lang = array_merge($lang, array(
'ACL_F_LIST' => 'Can see forum',
'ACL_F_LIST_TOPICS' => 'Can see topics',
'ACL_F_READ' => 'Can read forum',
'ACL_F_SEARCH' => 'Can search the forum',
'ACL_F_SUBSCRIBE' => 'Can subscribe forum',

View File

@ -53,7 +53,7 @@ $lang = array_merge($lang, array(
'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', // Not used anymore
'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', // Not used anymore
'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', // Not used anymore
'NO_READ_ACCESS' => 'You do not have the required permissions to read topics within this forum.',
'NO_READ_ACCESS' => 'You do not have the required permissions to view or read topics within this forum.',
'NO_UNREAD_POSTS_HOT' => 'No unread posts [ Popular ]',
'NO_UNREAD_POSTS_LOCKED' => 'No unread posts [ Locked ]',

View File

@ -260,6 +260,7 @@ class permissions
// Forum Permissions
'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'),
'f_list_topics' => array('lang' => 'ACL_F_LIST_TOPICS', 'cat' => 'actions'),
'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'),
'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'),
'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'),

View File

@ -87,7 +87,7 @@ if (isset($_GET['e']) && !$user->data['is_registered'])
}
// Permissions check
if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id)))
if (!$auth->acl_gets('f_list', 'f_list_topics', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id)))
{
if ($user->data['user_id'] != ANONYMOUS)
{
@ -181,7 +181,7 @@ if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] &
// Ok, if someone has only list-access, we only display the forum list.
// We also make this circumstance available to the template in case we want to display a notice. ;)
if (!$auth->acl_get('f_read', $forum_id))
if (!$auth->acl_gets('f_read', 'f_list_topics', $forum_id))
{
$template->assign_vars(array(
'S_NO_READ_ACCESS' => true,
@ -732,7 +732,7 @@ if (sizeof($shadow_topic_list))
}
// Do not include those topics the user has no permission to access
if (!$auth->acl_get('f_read', $row['forum_id']))
if (!$auth->acl_gets('f_read', 'f_list_topics', $row['forum_id']))
{
// We need to remove any trace regarding this topic. :)
unset($rowset[$orig_topic_id]);
@ -875,7 +875,7 @@ if (sizeof($topic_list))
// Generate all the URIs ...
$view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id;
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$view_topic_url = $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params) : false;
$topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id']));
$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id']));
@ -929,8 +929,8 @@ if (sizeof($topic_list))
'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread' : false,
'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false,
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'U_VIEW_TOPIC' => $view_topic_url,