summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorKlap-in <klapinklapin@gmail.com>2013-01-26 21:03:14 +0100
committerKlap-in <klapinklapin@gmail.com>2013-01-26 21:03:14 +0100
commit3a2c510523e4ea91ab270c3075349f319e4bc95e (patch)
tree7fe2d24e5f4450cf78e9291e8a2899665274c636 /inc/search.php
parent5fd9b829e7d9947de0eeead685e0a0cf707eff88 (diff)
parent1a40fc9935bd06a440a844e081e4bfce5fce2932 (diff)
downloadrpg-3a2c510523e4ea91ab270c3075349f319e4bc95e.tar.gz
rpg-3a2c510523e4ea91ab270c3075349f319e4bc95e.tar.bz2
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/inc/search.php b/inc/search.php
index 1cecfd5ec..53bd240e8 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -247,11 +247,16 @@ function search_pagename(&$data,$base,$file,$type,$lvl,$opts){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
+ if(isset($opts['depth']) && $opts['depth']){
+ $parts = explode('/',ltrim($file,'/'));
+ if(($type == 'd' && count($parts) > $opts['depth'])
+ || ($type != 'd' && count($parts) > $opts['depth'] + 1)){
+ return false; // depth reached
+ }
+ }
+
//we do nothing with directories
if($type == 'd'){
- if(!$opts['depth']) return true; // recurse forever
- $parts = explode('/',ltrim($file,'/'));
- if(count($parts) == $opts['depth']) return false; // depth reached
return true;
}