mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT BASE_URL calculation now uses realpath() to calculate any symlinks in environment variable SCRIPT_FILENAME
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115058 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bc62ca473a
commit
bffd187e1e
@ -138,10 +138,10 @@ if(!defined('BASE_PATH')) {
|
||||
define('BASE_PATH', rtrim(dirname(dirname(dirname(__FILE__)))), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
if(!defined('BASE_URL')) {
|
||||
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting the common
|
||||
// elements
|
||||
if(substr($_SERVER['SCRIPT_FILENAME'],0,strlen(BASE_PATH)) == BASE_PATH) {
|
||||
$urlSegmentToRemove = substr($_SERVER['SCRIPT_FILENAME'],strlen(BASE_PATH));
|
||||
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting common elements
|
||||
$path = realpath($_SERVER['SCRIPT_FILENAME']);
|
||||
if(substr($path, 0, strlen(BASE_PATH)) == BASE_PATH) {
|
||||
$urlSegmentToRemove = substr($path, strlen(BASE_PATH));
|
||||
if(substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
|
||||
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
|
||||
define('BASE_URL', rtrim($baseURL, DIRECTORY_SEPARATOR));
|
||||
|
@ -37,9 +37,10 @@ if (
|
||||
define('BASE_PATH', rtrim(dirname(dirname(__FILE__))), DIRECTORY_SEPARATOR);
|
||||
}
|
||||
if(!defined('BASE_URL')) {
|
||||
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting the common elements
|
||||
if(substr($_SERVER['SCRIPT_FILENAME'],0,strlen(BASE_PATH)) == BASE_PATH) {
|
||||
$urlSegmentToRemove = substr($_SERVER['SCRIPT_FILENAME'],strlen(BASE_PATH));
|
||||
// Determine the base URL by comparing SCRIPT_NAME to SCRIPT_FILENAME and getting common elements
|
||||
$path = realpath($_SERVER['SCRIPT_FILENAME']);
|
||||
if(substr($path, 0, strlen(BASE_PATH)) == BASE_PATH) {
|
||||
$urlSegmentToRemove = substr($path, strlen(BASE_PATH));
|
||||
if(substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
|
||||
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
|
||||
define('BASE_URL', rtrim($baseURL, DIRECTORY_SEPARATOR));
|
||||
|
Loading…
Reference in New Issue
Block a user