summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-05-15 20:44:06 +0200
committerAndreas Gohr <andi@splitbrain.org>2009-05-15 20:44:06 +0200
commit7d71d4b76c180d36d77c3206149ed99d8de4e7a7 (patch)
tree559a8916d8f4390579f18eb3713ee9c6019a7bfd /inc/pageutils.php
parent7c90ff2a4628b8fe1638304d145d06d47f46c6a1 (diff)
downloadrpg-7d71d4b76c180d36d77c3206149ed99d8de4e7a7.tar.gz
rpg-7d71d4b76c180d36d77c3206149ed99d8de4e7a7.tar.bz2
fix for getID() when the script isn't installed in document root FS#1691
Ignore-this: 2757dc089bd6c8465e5b0a4c1311cf85 darcs-hash:20090515184406-7ad00-cd124f30cd1c1b5b744e942e2279ff52cad6eb30.gz
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 872191d12..c10272af3 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -23,6 +23,8 @@ 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){
//get the script URL
@@ -32,6 +34,10 @@ function getID($param='id',$clean=true){
$relpath = 'lib/exe/';
}
$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['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){
$script = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',
$_SERVER['SCRIPT_FILENAME']);
@@ -42,7 +48,7 @@ function getID($param='id',$clean=true){
//clean script and request (fixes a windows problem)
$script = preg_replace('/\/\/+/','/',$script);
- $request = preg_replace('/\/\/+/','/',$_SERVER['REQUEST_URI']);
+ $request = preg_replace('/\/\/+/','/',$request);
//remove script URL and Querystring to gain the id
if(preg_match('/^'.preg_quote($script,'/').'(.*)/',$request, $match)){