mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 11:28:55 +00:00
Merge e0e457b03b
into b59bfadec7
This commit is contained in:
commit
7922281d4d
4 changed files with 34 additions and 14 deletions
|
@ -247,6 +247,15 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
$ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true))));
|
||||
}
|
||||
|
||||
// Consider if there are any forums where can read forum = no, can read topics = yes
|
||||
// In these cases, the user should see the topic title in the search results but not the link to the topic (or any posts) because they don't have the permissions
|
||||
if ($request->variable('sr', '') == 'topics' && $search_fields == 'titleonly')
|
||||
{
|
||||
// The user could get here from a quick search through the viewforum page, or by doing a main search displayed by topics and searching only the topic titles.
|
||||
// Allow the 'can read topics = yes' forums back in to the search by removing from $ex_fid_ary any of the 'can read topics' forums
|
||||
$ex_fid_ary = array_diff($ex_fid_ary, array_keys($auth->acl_getf('f_list_topics', true)));
|
||||
}
|
||||
|
||||
$not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";
|
||||
|
||||
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id
|
||||
|
@ -1157,10 +1166,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
'S_TOPIC_DELETED' => $topic_deleted,
|
||||
'S_HAS_POLL' => ($row['poll_start']) ? true : false,
|
||||
|
||||
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
|
||||
'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", '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_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
|
||||
'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_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id),
|
||||
'U_MCP_QUEUE' => $u_mcp_queue,
|
||||
);
|
||||
|
@ -1230,7 +1239,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
'TOPIC_REPLIES' => $replies,
|
||||
'TOPIC_VIEWS' => $row['topic_views'],
|
||||
|
||||
'U_VIEW_TOPIC' => $view_topic_url,
|
||||
'U_VIEW_TOPIC' => $auth->acl_get('f_read', $forum_id) ? $view_topic_url : false,
|
||||
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
||||
'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '',
|
||||
));
|
||||
|
|
|
@ -80,15 +80,15 @@
|
|||
<li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="row-item {searchresults.TOPIC_IMG_STYLE}">
|
||||
<dt<!-- IF searchresults.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{searchresults.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{searchresults.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
|
||||
{% if searchresults.U_NEWEST_POST and searchresults.S_UNREAD_TOPIC and not S_IS_BOT %}<a href="{{ searchresults.U_NEWEST_POST }}" class="row-item-link"></a>{% endif %}
|
||||
<div class="list-inner">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT -->
|
||||
{% if searchresults.U_NEWEST_POST and searchresults.S_UNREAD_TOPIC and not S_IS_BOT %}
|
||||
<a class="unread" href="{searchresults.U_NEWEST_POST}">
|
||||
<i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{L_NEW_POST}</span>
|
||||
</a>
|
||||
<!-- ENDIF -->
|
||||
<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
|
||||
{% endif %}
|
||||
{% if searchresults.U_VIEW_TOPIC %}<a href="{{ searchresults.U_VIEW_TOPIC }}" class="topictitle">{{ searchresults.TOPIC_TITLE }}</a>{% else %}{{ searchresults.TOPIC_TITLE }}{% endif %}
|
||||
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
|
||||
<a href="{searchresults.U_MCP_QUEUE}" title="{L_TOPIC_UNAPPROVED}">
|
||||
<i class="icon fa-question fa-fw icon-blue" aria-hidden="true"></i><span class="sr-only">{L_TOPIC_UNAPPROVED}</span>
|
||||
|
@ -146,11 +146,11 @@
|
|||
<dd class="views">{searchresults.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||
<dd class="lastpost">
|
||||
<span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} <!-- EVENT search_results_last_post_author_username_prepend -->{searchresults.LAST_POST_AUTHOR_FULL}<!-- EVENT search_results_last_post_author_username_append -->
|
||||
<!-- IF not S_IS_BOT -->
|
||||
{% if not S_IS_BOT and searchresults.U_LAST_POST %}
|
||||
<a href="{searchresults.U_LAST_POST}" title="{L_GOTO_LAST_POST}">
|
||||
<i class="icon fa-external-link-square fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{VIEW_LATEST_POST}</span>
|
||||
</a>
|
||||
<!-- ENDIF -->
|
||||
{% endif %}
|
||||
<br /><time datetime="{searchresults.LAST_POST_TIME_RFC3339}">{searchresults.LAST_POST_TIME}</time>
|
||||
</span>
|
||||
</dd>
|
||||
|
|
|
@ -158,14 +158,14 @@
|
|||
<!-- EVENT viewforum_body_topic_row_prepend -->
|
||||
<dl class="row-item {topicrow.TOPIC_IMG_STYLE}">
|
||||
<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url('{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}'); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
|
||||
{% if topicrow.U_NEWEST_POST and topicrow.S_UNREAD_TOPIC and not S_IS_BOT %}<a href="{{ topicrow.U_NEWEST_POST }}" class="row-item-link"></a>{% endif %}
|
||||
<div class="list-inner">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT -->
|
||||
{% if topicrow.U_NEWEST_POST and topicrow.S_UNREAD_TOPIC and not S_IS_BOT %}
|
||||
<a class="unread" href="{topicrow.U_NEWEST_POST}">
|
||||
<i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span>
|
||||
</a>
|
||||
<!-- ENDIF -->
|
||||
{% endif %}
|
||||
<!-- IF topicrow.U_VIEW_TOPIC --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a><!-- ELSE -->{topicrow.TOPIC_TITLE}<!-- ENDIF -->
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
|
||||
<a href="{topicrow.U_MCP_QUEUE}" title="<!-- IF topicrow.S_TOPIC_UNAPPROVED -->{L_TOPIC_UNAPPROVED}<!-- ELSE -->{L_POSTS_UNAPPROVED}<!-- ENDIF -->">
|
||||
|
|
|
@ -384,7 +384,18 @@ $post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LO
|
|||
// Display active topics?
|
||||
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false;
|
||||
|
||||
$s_search_hidden_fields = array('fid' => array($forum_id));
|
||||
// Send the forum id... and maybe some other fields, depending on permissions
|
||||
$s_search_hidden_fields = [
|
||||
'fid' => [$forum_id],
|
||||
];
|
||||
|
||||
if ($auth->acl_get('f_list_topics', $forum_id) && !$auth->acl_get('f_read', $forum_id))
|
||||
{
|
||||
// If the user has list access but not read access, then force the search to only be a topic title search
|
||||
$s_search_hidden_fields['sr'] = 'topics';
|
||||
$s_search_hidden_fields['sf'] = 'titleonly';
|
||||
}
|
||||
|
||||
if ($_SID)
|
||||
{
|
||||
$s_search_hidden_fields['sid'] = $_SID;
|
||||
|
@ -1017,7 +1028,7 @@ if (count($topic_list))
|
|||
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
|
||||
|
||||
'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", 'p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false,
|
||||
'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", '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,
|
||||
|
|
Loading…
Add table
Reference in a new issue