1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-05 12:13:23 +02:00

Merge branch 'ticket/17157' into ticket/17175-master

This commit is contained in:
Marc Alexander
2025-09-17 20:29:18 +02:00
4 changed files with 78 additions and 18 deletions

View File

@@ -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)))); $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'] . ')' : ""; $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 $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_TOPIC_DELETED' => $topic_deleted,
'S_HAS_POLL' => (bool) $row['poll_start'], 'S_HAS_POLL' => (bool) $row['poll_start'],
'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_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_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 . '&amp;view=unread') . '#unread', 'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;view=unread') . '#unread' : false,
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;t=' . $result_topic_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=reports&amp;t=' . $result_topic_id),
'U_MCP_QUEUE' => $u_mcp_queue, 'U_MCP_QUEUE' => $u_mcp_queue,
); );
@@ -1230,7 +1239,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'TOPIC_REPLIES' => $replies, 'TOPIC_REPLIES' => $replies,
'TOPIC_VIEWS' => $row['topic_views'], '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_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) ? '&amp;hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '', 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id'] . (($u_hilit) ? '&amp;hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '',
)); ));

View File

@@ -80,6 +80,12 @@
<li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> <li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
<dl class="row-item"> <dl class="row-item">
<dt> <dt>
{% if searchresults.U_NEWEST_POST and searchresults.S_UNREAD_TOPIC and not S_IS_BOT %}
{% set searchresults.U_ITEM_LINK = searchresults.U_NEWEST_POST %}
{% elseif searchresults.U_VIEW_TOPIC %}
{% set searchresults.U_ITEM_LINK = searchresults.U_VIEW_TOPIC %}
{% endif %}
{% if searchresults.U_ITEM_LINK is defined %}
<a class="row-item-link{% if searchresults.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" href="{searchresults.U_NEWEST_POST}" title="{searchresults.TOPIC_FOLDER_IMG_ALT}"> <a class="row-item-link{% if searchresults.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" href="{searchresults.U_NEWEST_POST}" title="{searchresults.TOPIC_FOLDER_IMG_ALT}">
{{ Icon('svg', { {{ Icon('svg', {
'globe' : searchresults.S_POST_GLOBAL, 'globe' : searchresults.S_POST_GLOBAL,
@@ -91,6 +97,19 @@
'file-document-outline' : true, 'file-document-outline' : true,
}, '', true, 'c-forum-row-icon') }} }, '', true, 'c-forum-row-icon') }}
</a> </a>
{% else %}
<span class="row-item-link{% if searchresults.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" title="{searchresults.TOPIC_FOLDER_IMG_ALT}">
{{ Icon('svg', {
'globe' : searchresults.S_POST_GLOBAL,
'bullhorn' : searchresults.S_POST_ANNOUNCE,
'thumbtack' : searchresults.S_POST_STICKY,
'lock' : searchresults.S_TOPIC_LOCKED,
'arrow-right-bold' : searchresults.S_TOPIC_MOVED,
'fire' : searchresults.S_TOPIC_HOT,
'file-document-outline' : true,
}, '', true, 'c-forum-row-icon') }}
</span>
{% endif %}
{% if lang(searchresults.TOPIC_AUTHOR) == S_USERNAME %} {% if lang(searchresults.TOPIC_AUTHOR) == S_USERNAME %}
<span class="row-item-link-mine"></span> <span class="row-item-link-mine"></span>
{% endif%} {% endif%}
@@ -99,10 +118,12 @@
{% endif %} {% endif %}
<div class="list-inner"> <div class="list-inner">
<!-- EVENT topiclist_row_prepend --> <!-- 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 href="{{ searchresults.U_NEWEST_POST }}" class="topictitle unread">{{ searchresults.TOPIC_TITLE }}</a> <a href="{{ searchresults.U_NEWEST_POST }}" class="topictitle unread">{{ searchresults.TOPIC_TITLE }}</a>
{% else %} {% elseif searchresults.U_VIEW_TOPIC %}
<a href="{{ searchresults.U_VIEW_TOPIC }}" class="topictitle">{{ searchresults.TOPIC_TITLE }}</a> <a href="{{ searchresults.U_VIEW_TOPIC }}" class="topictitle">{{ searchresults.TOPIC_TITLE }}</a>
{% else %}
<span class="topictitle">{{ searchresults.TOPIC_TITLE }}</span>
{% endif %} {% endif %}
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
<a href="{searchresults.U_MCP_QUEUE}" title="{L_TOPIC_UNAPPROVED}"> <a href="{searchresults.U_MCP_QUEUE}" title="{L_TOPIC_UNAPPROVED}">
@@ -161,11 +182,11 @@
<dd class="views">{searchresults.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd> <dd class="views">{searchresults.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
<dd class="lastpost"> <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 --> <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}"> <a href="{searchresults.U_LAST_POST}" title="{L_GOTO_LAST_POST}">
{{ Icon('font', 'arrow-up-right-from-square', VIEW_LATEST_POST, true, 'fas c-last-post-icon') }} {{ Icon('font', 'arrow-up-right-from-square', VIEW_LATEST_POST, true, 'fas c-last-post-icon') }}
</a> </a>
<!-- ENDIF --> {% endif %}
<br /><time datetime="{searchresults.LAST_POST_TIME_RFC3339}">{searchresults.LAST_POST_TIME}</time> <br /><time datetime="{searchresults.LAST_POST_TIME_RFC3339}">{searchresults.LAST_POST_TIME}</time>
</span> </span>
</dd> </dd>

View File

@@ -158,6 +158,12 @@
<!-- EVENT viewforum_body_topic_row_prepend --> <!-- EVENT viewforum_body_topic_row_prepend -->
<dl class="row-item"> <dl class="row-item">
<dt> <dt>
{% if topicrow.U_NEWEST_POST and topicrow.S_UNREAD_TOPIC and not S_IS_BOT %}
{% set topicrow.U_ITEM_LINK = topicrow.U_NEWEST_POST %}
{% elseif topicrow.U_VIEW_TOPIC %}
{% set topicrow.U_ITEM_LINK = topicrow.U_VIEW_TOPIC %}
{% endif %}
{% if topicrow.U_ITEM_LINK is defined %}
<a class="row-item-link{% if topicrow.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" href="{topicrow.U_NEWEST_POST}" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <a class="row-item-link{% if topicrow.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" href="{topicrow.U_NEWEST_POST}" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
{{ Icon('svg', { {{ Icon('svg', {
'globe' : topicrow.S_POST_GLOBAL, 'globe' : topicrow.S_POST_GLOBAL,
@@ -169,6 +175,19 @@
'file-document-outline' : true, 'file-document-outline' : true,
}, '', true, 'c-forum-row-icon') }} }, '', true, 'c-forum-row-icon') }}
</a> </a>
{% else %}
<span class="row-item-link{% if topicrow.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
{{ Icon('svg', {
'globe' : topicrow.S_POST_GLOBAL,
'bullhorn' : topicrow.S_POST_ANNOUNCE,
'thumbtack' : topicrow.S_POST_STICKY,
'lock' : topicrow.S_TOPIC_LOCKED,
'arrow-right-bold' : topicrow.S_TOPIC_MOVED,
'fire' : topicrow.S_TOPIC_HOT,
'file-document-outline' : true,
}, '', true, 'c-forum-row-icon') }}
</span>
{% endif %}
{% if lang(topicrow.TOPIC_AUTHOR) == S_USERNAME %} {% if lang(topicrow.TOPIC_AUTHOR) == S_USERNAME %}
<span class="row-item-link-mine"></span> <span class="row-item-link-mine"></span>
{% endif%} {% endif%}
@@ -177,7 +196,7 @@
{% endif %} {% endif %}
<div class="list-inner"> <div class="list-inner">
<!-- EVENT topiclist_row_prepend --> <!-- 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 href="{{ topicrow.U_NEWEST_POST }}" class="topictitle unread">{{ topicrow.TOPIC_TITLE }}</a> <a href="{{ topicrow.U_NEWEST_POST }}" class="topictitle unread">{{ topicrow.TOPIC_TITLE }}</a>
{% elseif topicrow.U_VIEW_TOPIC %} {% elseif topicrow.U_VIEW_TOPIC %}
<a href="{{ topicrow.U_VIEW_TOPIC }}" class="topictitle">{{ topicrow.TOPIC_TITLE }}</a> <a href="{{ topicrow.U_VIEW_TOPIC }}" class="topictitle">{{ topicrow.TOPIC_TITLE }}</a>

View File

@@ -384,7 +384,18 @@ $post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LO
// Display active topics? // Display active topics?
$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; $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) if ($_SID)
{ {
$s_search_hidden_fields['sid'] = $_SID; $s_search_hidden_fields['sid'] = $_SID;