Skip to content
Snippets Groups Projects
Commit 671a58a6 authored by Guy Brand's avatar Guy Brand
Browse files

Namespace autolinking from URL (FS#991 fix)

You can now request doku.php?id

darcs-hash:20070330212802-19e2d-d1988ade1a9cd5f898ecb0a55d09860d0193a84d.gz
parent 014b95e7
No related branches found
No related tags found
No related merge requests found
......@@ -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'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment