diff options
author | Guy Brand <gb@isis.u-strasbg.fr> | 2007-03-30 23:28:02 +0200 |
---|---|---|
committer | Guy Brand <gb@isis.u-strasbg.fr> | 2007-03-30 23:28:02 +0200 |
commit | 671a58a68aaa7c847262d0c5c34541e6d214b5fc (patch) | |
tree | ca4a1ca22939d86ec51c5c7a4a79dd3117542c2b /inc | |
parent | 014b95e78beeeebdbe5cb4c92a88d135cad406b6 (diff) | |
download | rpg-671a58a68aaa7c847262d0c5c34541e6d214b5fc.tar.gz rpg-671a58a68aaa7c847262d0c5c34541e6d214b5fc.tar.bz2 |
Namespace autolinking from URL (FS#991 fix)
You can now request doku.php?id
darcs-hash:20070330212802-19e2d-d1988ade1a9cd5f898ecb0a55d09860d0193a84d.gz
Diffstat (limited to 'inc')
-rw-r--r-- | inc/pageutils.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php index 243d9ae1d..659f82298 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -52,6 +52,25 @@ function getID($param='id',$clean=true){ //strip leading slashes $id = preg_replace('!^/+!','',$id); } + + // Namespace autolinking from URL + if(substr($id,-1) == ':' || ($conf['useslash'] && substr($id,-1) == '/')){ + if(@file_exists(wikiFN($id.$conf['start']))){ + // start page inside namespace + $id = $id.$conf['start']; + }elseif(@file_exists(wikiFN($id.noNS(cleanID($id))))){ + // page named like the NS inside the NS + $id = $id.noNS(cleanID($id)); + }elseif(@file_exists(wikiFN($id))){ + // page like namespace exists + $id = $id; + }else{ + // fall back to default + $id = $id.$conf['start']; + } + header("Location: ".wl($id,'',true)); + } + if($clean) $id = cleanID($id); if(empty($id) && $param=='id') $id = $conf['start']; |