Commit 9133117d30252b608ff9a508d9a768ae947901a8

Authored by Neil Blakey-Milner
1 parent 8e712ff4

Try to support environments that might set ORIG_PATH_INFO instead of

PATH_INFO.

Be slightly better at setting REQUEST_URI if it isn't already set.

Use $_SERVER['SCRIPT_NAME'] to determine the root URL of the system.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4531 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 14 additions and 2 deletions
config/dmsDefaults.php
... ... @@ -215,10 +215,22 @@ class KTInit {
215 215  
216 216 // {{{ setupServerVariables
217 217 function setupServerVariables() {
  218 + // KTS-21: Some environments (FastCGI only?) don't set PATH_INFO
  219 + // correctly, but do set ORIG_PATH_INFO.
  220 + $path_info = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
  221 + $orig_path_info = KTUtil::arrayGet($_SERVER, 'ORIG_PATH_INFO');
  222 + if (empty($path_info) && !empty($orig_path_info)) {
  223 + $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
  224 + $_SERVER["PHP_SELF"] .= $_SERVER['PATH_INFO'];
  225 + }
  226 +
  227 + // KTS-50: IIS (and probably most non-Apache web servers) don't
  228 + // set REQUEST_URI. Fake it.
218 229 $request_uri = KTUtil::arrayGet($_SERVER, 'REQUEST_URI');
219 230 if (empty($request_uri)) {
220   - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
  231 + $_SERVER['REQUEST_URI'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']);
221 232 }
  233 +
222 234 $kt_path_info = KTUtil::arrayGet($_REQUEST, 'kt_path_info');
223 235 if (!empty($kt_path_info)) {
224 236 $_SERVER["PHP_SELF"] .= "?kt_path_info=" . $kt_path_info;
... ... @@ -274,7 +286,7 @@ class KTInit {
274 286  
275 287 // {{{ guessRootUrl()
276 288 function guessRootUrl() {
277   - $urlpath = KTUtil::getRequestScriptName($_SERVER);
  289 + $urlpath = $_SERVER['SCRIPT_NAME'];
278 290 $bFound = false;
279 291 $rootUrl = "";
280 292 while ($urlpath) {
... ...