|
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 | | - // There are two exceptional scenarios we want to consider if there are any forums where an 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 |
252 | | - // they don't have the permissions for that. |
253 | | - $show_topic_title_only = false; |
254 | | - |
255 | | - // Firstly, is someone doing a quick search from the viewforum page? If so, force it to be a topic-only search for that one forum |
256 | | - // We know if this is the case due to the presence of this request var |
257 | | - $forum_quick_search = $request->variable('viewforum', 0); |
258 | | - if ($forum_quick_search && $auth->acl_get('f_list_topics', $forum_quick_search) && !$auth->acl_get('f_read', $forum_quick_search)) |
| 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') |
259 | 253 | { |
260 | | - $show_topic_title_only = true; |
261 | | - } |
262 | | - |
263 | | - // Secondly, is someone doing a topic search from the main search page? If so, we will strip the topic links while still showing the name |
264 | | - else if ($request->variable('sr', '') == 'topics' && $search_fields == 'titleonly') |
265 | | - { |
266 | | - // We will allow the 'can read topics = yes' forums back in to the search |
267 | | - $show_topic_title_only = true; |
268 | | - } |
269 | | - |
270 | | - if ($show_topic_title_only) |
271 | | - { |
272 | | - // Remove from $ex_fid_ary any of the 'can read topics' forums (meaning they will not be excluded from the search) |
| 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 |
273 | 256 | $ex_fid_ary = array_diff($ex_fid_ary, array_keys($auth->acl_getf('f_list_topics', true))); |
274 | 257 | } |
275 | 258 |
|
|
375 | 358 | $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; |
376 | 359 | } |
377 | 360 |
|
378 | | - if ($show_topic_title_only) |
379 | | - { |
380 | | - $show_results = 'topics'; |
381 | | - } |
382 | | - |
383 | 361 | // define some variables needed for retrieving post_id/topic_id information |
384 | 362 | $sort_by_sql = [ |
385 | 363 | 'a' => 'u.username_clean', |
|
0 commit comments