For the setup: try to make the URL detection work even if the actual PHP file is not part of the URL (i.e when index.php is implicitely added when browsing a folder)

SVN:trunk[1347]
This commit is contained in:
Denis Flaven
2011-07-22 11:53:02 +00:00
parent 7470c8e72e
commit 0e75824247

View File

@@ -419,7 +419,18 @@ class utils
}
else
{
throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'");
// Second attempt without index.php at the end...
$sCurrentRelativePath = str_replace('index.php', '', $sCurrentRelativePath);
$sAppRootPos = strpos($sAbsoluteUrl, $sCurrentRelativePath);
if ($sAppRootPos !== false)
{
$sAppRootUrl = substr($sAbsoluteUrl, 0, $sAppRootPos); // remove the current page and path
}
else
{
// No luck...
throw new Exception("Failed to determine application root path $sAbsoluteUrl ($sCurrentRelativePath) APPROOT:'$sAppRoot'");
}
}
return $sAppRootUrl;
}