summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorKate Arzamastseva <pshns@ukr.net>2011-09-05 16:37:05 +0300
committerKate Arzamastseva <pshns@ukr.net>2011-09-05 16:37:05 +0300
commit9ea9cc5260965262406f3eff600201f995049e1c (patch)
tree3f703a0873e42b0b3efb9e7fe2ece701b1badabe /inc/search.php
parent69b29ddf0b274b494a4ded27e96cf57c8370876b (diff)
parentaea34b5fe445064477d8ad0c98926db33a0d0851 (diff)
downloadrpg-9ea9cc5260965262406f3eff600201f995049e1c.tar.gz
rpg-9ea9cc5260965262406f3eff600201f995049e1c.tar.bz2
Merge branch 'master' of git://github.com/splitbrain/dokuwiki into media-revisions
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php49
1 files changed, 13 insertions, 36 deletions
diff --git a/inc/search.php b/inc/search.php
index a6089c479..a26ae4808 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -84,8 +84,8 @@ function search_callback($func,&$data,$base,$file,$type,$lvl,$opts){
* return values for files are ignored
*
* All functions should check the ACL for document READ rights
- * namespaces (directories) are NOT checked as this would break
- * the recursion (You can have an nonreadable dir over a readable
+ * namespaces (directories) are NOT checked (when sneaky_index is 0) as this
+ * would break the recursion (You can have an nonreadable dir over a readable
* one deeper nested) also make sure to check the file type (for example
* in case of lockfiles).
*/
@@ -107,45 +107,22 @@ function search_qsearch(&$data,$base,$file,$type,$lvl,$opts){
/**
* Build the browsable index of pages
*
- * $opts['ns'] is the current namespace
+ * $opts['ns'] is the currently viewed namespace
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function search_index(&$data,$base,$file,$type,$lvl,$opts){
global $conf;
- $return = true;
-
- $item = array();
-
- if($type == 'd' && !preg_match('#^'.$file.'(/|$)#','/'.$opts['ns'])){
- //add but don't recurse
- $return = false;
- }elseif($type == 'f' && ($opts['nofiles'] || substr($file,-4) != '.txt')){
- //don't add
- return false;
- }
-
- $id = pathID($file,($type == 'd'));
-
- if($type=='d' && $conf['sneaky_index'] && auth_quickaclcheck($id.':') < AUTH_READ){
- return false;
- }
-
- //check hidden
- if(isHiddenPage($id)){
- return false;
- }
-
- //check ACL
- if($type=='f' && auth_quickaclcheck($id) < AUTH_READ){
- return false;
- }
-
- $data[]=array( 'id' => $id,
- 'type' => $type,
- 'level' => $lvl,
- 'open' => $return );
- return $return;
+ $opts = array(
+ 'pagesonly' => true,
+ 'listdirs' => true,
+ 'listfiles' => !$opts['nofiles'],
+ 'sneakyacl' => $conf['sneaky_index'],
+ // Hacky, should rather use recmatch
+ 'depth' => preg_match('#^'.$file.'(/|$)#','/'.$opts['ns']) ? 0 : -1
+ );
+
+ return search_universal($data, $base, $file, $type, $lvl, $opts);
}
/**