function cmfcClassesCoreStandAlone::getCalculatedLocations in Calendar Systems 6.3
Same name and namespace in other branches
- 8 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
- 8.2 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
- 6 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
- 7.3 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
- 7 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
- 7.2 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::getCalculatedLocations()
* This function calculates the base location of package in filesystem and in browser * This is a critical function for other packages to work properly * By default it points to the real path when symlinks are used * * Site with subdomain should set siteFolderPath manually and also pass siteFolderPathBrowser (http://domain.com)
File
- calendar/
lib/ classesCore.class.inc.php, line 91
Class
- cmfcClassesCoreStandAlone
- all cmf classes inherit from this class
Code
function getCalculatedLocations($options, $parameters) {
$server = $_SERVER;
if (!isset($server['DOCUMENT_ROOT'])) {
$server['DOCUMENT_ROOT'] = str_replace('\\', '/', substr($server['SCRIPT_FILENAME'], 0, 0 - strlen($server['PHP_SELF'])));
}
if (isset($server['DOCUMENT_ROOT'])) {
if (strpos('ASD@#$@#$#23423' . dirname(__FILE__), 'ASD@#$@#$#23423' . $server['DOCUMENT_ROOT']) === false) {
$server['DOCUMENT_ROOT'] = '/chroot' . $server['DOCUMENT_ROOT'];
}
}
if (!isset($options['pageFolderPath'])) {
$options['pageFolderPath'] = dirname($server['SCRIPT_FILENAME']);
$options['pageFolderPath'] = str_replace(array(
'/',
'\\',
), DIRECTORY_SEPARATOR, $options['pageFolderPath']);
}
if (!isset($options['pageFolderPathBrowser'])) {
$options['pageFolderPathBrowser'] = dirname($server['SCRIPT_NAME']);
}
if (!isset($options['siteFolderPath'])) {
$options['siteFolderPath'] = $server['DOCUMENT_ROOT'];
if (is_link($options['siteFolderPath'])) {
$options['siteFolderPath'] = readlink($options['siteFolderPath']);
}
}
if (!isset($options['siteFolderPathBrowser'])) {
$options['siteFolderPathBrowser'] = '';
}
if (!isset($options['packageFolderPath'])) {
$options['packageFolderPath'] = dirname($parameters['filePath']);
$options['siteFolderPath'] = str_replace(array(
'/',
'\\',
), DIRECTORY_SEPARATOR, $options['siteFolderPath']);
}
if (!isset($options['packageFolderPathBrowser'])) {
$fileRelativePath = $options['siteFolderPathBrowser'] . '/' . str_replace($options['siteFolderPath'], '', $options['packageFolderPath']);
$options['packageFolderPathBrowser'] = cmfcDirectory::normalizePath($fileRelativePath);
}
if (!isset($options['cmfFolderPath'])) {
$options['cmfFolderPath'] = realpath($options['packageFolderPath'] . '/../../..');
$options['cmfFolderPath'] = str_replace(array(
'/',
'\\',
), DIRECTORY_SEPARATOR, $options['cmfFolderPath']);
}
if (!isset($options['cmfFolderPathBrowser'])) {
$fileRelativePath = $options['siteFolderPathBrowser'] . '/' . str_replace($options['siteFolderPath'], '', $options['cmfFolderPath']);
$options['cmfFolderPathBrowser'] = cmfcDirectory::normalizePath($fileRelativePath);
}
return $options;
}