diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2005-11-03 11:17:26 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2005-11-03 11:17:26 +0100 |
commit | 0dc92c6f78995331021c3b8c6a889913cf3f7de3 (patch) | |
tree | c40897221891e043dcb497183db31b0688aa5a34 /inc/fulltext.php | |
parent | 6534245afc8e6007567455a841347fafb2413cc0 (diff) | |
download | rpg-0dc92c6f78995331021c3b8c6a889913cf3f7de3.tar.gz rpg-0dc92c6f78995331021c3b8c6a889913cf3f7de3.tar.bz2 |
hidepages configoption
This new option accepts a RegExp to filter certain pages from all automatic
listings (RSS, recent changes, search results, index). This is useful to
exclude certain pages like the ones used in the sitebar templates. The
regexp is matched against the full page ID with a leading colon. If it
matches the page is assumed to be a hidden one.
IMPORTANT: this is not related to ACL. A hidden page is still visible to all
users (if not restricted by ACL) when linked or called directly.
darcs-hash:20051103101726-6e07b-8d45912a1b4f6cfc9e3fce147c15f84a58ea7ca2.gz
Diffstat (limited to 'inc/fulltext.php')
-rw-r--r-- | inc/fulltext.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php index 4d4b8138c..f48250548 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -44,6 +44,11 @@ function ft_pageSearch($query,&$poswords){ } if(!count($docs)) return array(); + // create a list of hidden pages in the result + $hidden = array(); + $hidden = array_filter(array_keys($docs),'isHiddenPage'); + $not = array_merge($not,$hidden); + // remove negative matches foreach($not as $n){ unset($docs[$n]); @@ -95,13 +100,14 @@ function ft_backlinks($id){ // quick lookup of the pagename $page = noNS($id); $sw = array(); // we don't use stopwords here - $matches = idx_lookup(idx_tokenizer($page,$sw)); //pagename may contain specials (_ or .) - $docs = ft_resultCombine(array_values($matches)); + $matches = idx_lookup(idx_tokenizer($page,$sw)); // pagename may contain specials (_ or .) + $docs = array_keys(ft_resultCombine(array_values($matches))); + $docs = array_filter($docs,'isVisiblePage'); // discard hidden pages if(!count($docs)) return $result; require_once(DOKU_INC.'inc/parserutils.php'); // check instructions for matching links - foreach(array_keys($docs) as $match){ + foreach($docs as $match){ $instructions = p_cached_instructions(wikiFN($match),true); if(is_null($instructions)) continue; @@ -161,6 +167,7 @@ function ft_pageLookup($id,$pageonly=true){ } } + $pages = array_filter($pages,'isVisiblePage'); // discard hidden pages if(!count($pages)) return array(); // check ACL permissions |