summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2010-03-02 19:00:37 +0100
committerMichael Hamann <michael@content-space.de>2010-03-02 20:08:58 +0100
commit06368e4dbb72cef5e440312251d11fbaea6242a9 (patch)
tree3e5942fc0160e0d6fb4a8dea9058585df5c34af9 /inc/pageutils.php
parent7caaf84c91ff684b186dec09e921d319b64ec0e1 (diff)
downloadrpg-06368e4dbb72cef5e440312251d11fbaea6242a9.tar.gz
rpg-06368e4dbb72cef5e440312251d11fbaea6242a9.tar.bz2
Fixed testcase and getID - FS#1908 FS#1831 FS#1838
$_SERVER['PATH_INFO'] is used now to determine the page id when using internal rewriting, in all testcases I've seen so far this variable was set correctly. There are also a couple of fallbacks if the variable doesn't exist, $_SERVER['SCRIPT_NAME'] is now preferred instead of custom path extraction which fails when doku.php is outside the document root.
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index eb22084c1..ef09dc7b6 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -23,10 +23,11 @@ function getID($param='id',$clean=true){
$id = isset($_REQUEST[$param]) ? $_REQUEST[$param] : null;
- $request = $_SERVER['REQUEST_URI'];
-
//construct page id from request URI
if(empty($id) && $conf['userewrite'] == 2){
+ $request = $_SERVER['REQUEST_URI'];
+ $script = '';
+
//get the script URL
if($conf['basedir']){
$relpath = '';
@@ -35,15 +36,14 @@ function getID($param='id',$clean=true){
}
$script = $conf['basedir'].$relpath.basename($_SERVER['SCRIPT_FILENAME']);
- }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['PATH_TRANSLATED']){
- $request = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
- $_SERVER['PATH_TRANSLATED']);
+ }elseif($_SERVER['PATH_INFO']){
+ $request = $_SERVER['PATH_INFO'];
+ }elseif($_SERVER['SCRIPT_NAME']){
+ $script = $_SERVER['SCRIPT_NAME'];
}elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){
$script = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
$_SERVER['SCRIPT_FILENAME']);
$script = '/'.$script;
- }else{
- $script = $_SERVER['SCRIPT_NAME'];
}
//clean script and request (fixes a windows problem)