summaryrefslogtreecommitdiff
path: root/inc/search.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2012-10-01 22:39:38 +0200
committerMichael Hamann <michael@content-space.de>2012-10-02 00:30:01 +0200
commit1c6c1c6c7a64f010e0f9919ab40f018383fea205 (patch)
tree3bcf1aad36e3df6939430888e4ebcaff7e261eeb /inc/search.php
parentcab7597576cf8761e9624f8d05d16a642b884750 (diff)
downloadrpg-1c6c1c6c7a64f010e0f9919ab40f018383fea205.tar.gz
rpg-1c6c1c6c7a64f010e0f9919ab40f018383fea205.tar.bz2
Escape filename in regex in search_index()
This problem was reported in https://forum.dokuwiki.org/thread/8143. Apart from warnings you could notice that when you have namespaces "foo" and "f.o" and you open the sitemap for "foo" that "f.o" is opened, too.
Diffstat (limited to 'inc/search.php')
-rw-r--r--inc/search.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/inc/search.php b/inc/search.php
index a02b86b34..1cecfd5ec 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -119,7 +119,7 @@ function search_index(&$data,$base,$file,$type,$lvl,$opts){
'listfiles' => !$opts['nofiles'],
'sneakyacl' => $conf['sneaky_index'],
// Hacky, should rather use recmatch
- 'depth' => preg_match('#^'.$file.'(/|$)#','/'.$opts['ns']) ? 0 : -1
+ 'depth' => preg_match('#^'.preg_quote($file, '#').'(/|$)#','/'.$opts['ns']) ? 0 : -1
);
return search_universal($data, $base, $file, $type, $lvl, $opts);