Commit eca9992b230b949e3e9fbdecdb22fa27bcf77f25

Authored by Megan
1 parent 489dd4ad

Modified the guessRootUrl - if the rooturl contains the full path then it is set to empty.

Committed by: Megan Watson
Reviewed by: Kevin Fourie
Showing 1 changed file with 9 additions and 1 deletions
config/dmsDefaults.php
... ... @@ -393,7 +393,7 @@ class KTInit {
393 393  
394 394 // {{{ guessRootUrl()
395 395 function guessRootUrl() {
396   - $urlpath = str_replace(KT_DIR, '', $_SERVER['SCRIPT_NAME']);
  396 + $urlpath = $_SERVER['SCRIPT_NAME'];
397 397 $bFound = false;
398 398 $rootUrl = '';
399 399 while ($urlpath) {
... ... @@ -416,6 +416,14 @@ class KTInit {
416 416 if ($rootUrl) {
417 417 $rootUrl = '/' . $rootUrl;
418 418 }
  419 +
  420 + // If the rootUrl contains KT_DIR then it is the full path and not relative to the apache document root
  421 + // We return an empty string which will work for all stack installs but might break source installs.
  422 + // However this situation should only crop up when running background scripts and can be avoided by setting
  423 + // the rootUrl in the config settings.
  424 + if(strpos($rootUrl, KT_DIR) !== false){
  425 + return '';
  426 + }
419 427 return $rootUrl;
420 428 }
421 429 return '';
... ...