diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-02-19 22:43:45 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-02-19 22:43:45 +0100 |
commit | 1fcfad4dd1ab7443fa9dea7b8c062f59e6efd1fa (patch) | |
tree | 084d0108476acaae51427c735f1f178f900c6e35 | |
parent | bc053e1755a963ebbc9d0d2c56654173cb05b581 (diff) | |
download | rpg-1fcfad4dd1ab7443fa9dea7b8c062f59e6efd1fa.tar.gz rpg-1fcfad4dd1ab7443fa9dea7b8c062f59e6efd1fa.tar.bz2 |
more flexible page listing method in search.php
darcs-hash:20090219214345-7ad00-2597a205c5dfae869defebe5f57d34a5f2fa3baf.gz
-rw-r--r-- | inc/search.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/inc/search.php b/inc/search.php index e8af8f64a..a5637fff0 100644 --- a/inc/search.php +++ b/inc/search.php @@ -269,16 +269,36 @@ function search_pagename(&$data,$base,$file,$type,$lvl,$opts){ /** * Just lists all documents * + * $opts['depth'] recursion level, 0 for all + * $opts['hash'] do md5 sum of content? + * * @author Andreas Gohr <andi@splitbrain.org> */ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){ - //we do nothing with directories - if($type == 'd') return true; - //only search txt files - if(substr($file,-4) != '.txt') return true; + //we do nothing with directories + if($type == 'd'){ + if(!$opts['depth']) return true; // recurse forever + $parts = explode('/',$file); + if(count($parts) == $opts['depth']) return false; // depth reached + return true; + } - $data[]['id'] = pathID($file); - return true; + //only search txt files + if(substr($file,-4) != '.txt') return true; + + $item['id'] = pathID($file); + if(!$opts['skipacl'] && auth_quickaclcheck($id) < AUTH_READ){ + return false; + } + + $item['rev'] = filemtime($base.'/'.$file); + $item['size'] = filesize($base.'/'.$file); + if($opts['hash']){ + $item['hash'] = md5(trim(rawWiki($item['id']))); + } + + $data[] = $item; + return true; } /** |