|
247 | 247 | $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); |
248 | 248 | } |
249 | 249 |
|
| 250 | + // Consider if there are any forums where can read forum = no, can read topics = yes |
| 251 | + // 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 |
| 252 | + if ($request->variable('sr', '') == 'topics' && $search_fields == 'titleonly') |
| 253 | + { |
| 254 | + // 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. |
| 255 | + // 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 |
| 256 | + $ex_fid_ary = array_diff($ex_fid_ary, array_keys($auth->acl_getf('f_list_topics', true))); |
| 257 | + } |
| 258 | + |
250 | 259 | $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'] . ')' : ""; |
251 | 260 |
|
252 | 261 | $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 | 1166 | 'S_TOPIC_DELETED' => $topic_deleted, |
1158 | 1167 | 'S_HAS_POLL' => ($row['poll_start']) ? true : false, |
1159 | 1168 |
|
1160 | | - 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], |
| 1169 | + '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, |
1161 | 1170 | 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), |
1162 | 1171 | 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), |
1163 | | - 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread', |
| 1172 | + '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, |
1164 | 1173 | 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), |
1165 | 1174 | 'U_MCP_QUEUE' => $u_mcp_queue, |
1166 | 1175 | ); |
|
1230 | 1239 | 'TOPIC_REPLIES' => $replies, |
1231 | 1240 | 'TOPIC_VIEWS' => $row['topic_views'], |
1232 | 1241 |
|
1233 | | - 'U_VIEW_TOPIC' => $view_topic_url, |
| 1242 | + 'U_VIEW_TOPIC' => $auth->acl_get('f_read', $forum_id) ? $view_topic_url : false, |
1234 | 1243 | 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), |
1235 | 1244 | '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'] : '', |
1236 | 1245 | )); |
|
0 commit comments