diff options
author | Adrian Lang <mail@adrianlang.de> | 2011-04-22 22:35:43 +0200 |
---|---|---|
committer | Adrian Lang <mail@adrianlang.de> | 2011-04-22 22:35:43 +0200 |
commit | 8ccf9c9785ec2b626bad30a88a21f02886845418 (patch) | |
tree | 0ecd6103880e3350bd37ba11ae3872805ede1755 /inc/pageutils.php | |
parent | e2092379b1c3200832cb569781ec647db5aeef0f (diff) | |
parent | 23d27376b2a2f6a1ccf0777c48435717494d85b1 (diff) | |
download | rpg-8ccf9c9785ec2b626bad30a88a21f02886845418.tar.gz rpg-8ccf9c9785ec2b626bad30a88a21f02886845418.tar.bz2 |
Merge branch 'master' into stable
Conflicts:
data/deleted.files
doku.php
lib/exe/xmlrpc.php
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r-- | inc/pageutils.php | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php index 42a485bdf..c9bf60135 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -311,14 +311,13 @@ function metaFN($id,$ext){ * returns an array of full paths to all metafiles of a given ID * * @author Esther Brunner <esther@kaffeehaus.ch> + * @author Michael Hamann <michael@content-space.de> */ function metaFiles($id){ - $name = noNS($id); - $ns = getNS($id); - $dir = ($ns) ? metaFN($ns,'').'/' : metaFN($ns,''); - $files = array(); - $files = glob($dir.$name.'.*'); - return $files; + $basename = metaFN($id, ''); + $files = glob($basename.'.*', GLOB_MARK); + // filter files like foo.bar.meta when $id == 'foo' + return $files ? preg_grep('/^'.preg_quote($basename, '/').'\.[^.\/]*$/u', $files) : array(); } /** @@ -344,10 +343,13 @@ function mediaFN($id){ */ function localeFN($id){ global $conf; - $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.txt'; if(!@file_exists($file)){ - //fall back to english - $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + } } return $file; } @@ -421,8 +423,14 @@ function resolve_mediaid($ns,&$page,&$exists){ */ function resolve_pageid($ns,&$page,&$exists){ global $conf; + global $ID; $exists = false; + //empty address should point to current page + if ($page === "") { + $page = $ID; + } + //keep hashlink if exists then clean both parts if (strpos($page,'#')) { list($page,$hash) = explode('#',$page,2); |