Skip to content
Snippets Groups Projects
Commit 45fdfa82 authored by Jared Hancock's avatar Jared Hancock
Browse files

Define ROOT_PATH in chrooted environments too

parent acd4f06d
No related branches found
No related tags found
No related merge requests found
...@@ -139,21 +139,17 @@ class Misc { ...@@ -139,21 +139,17 @@ class Misc {
return $output; return $output;
} }
function siteBaseUrl() { /* static */
# Detects Alias-ing function siteRootPath($main_inc_path) {
$paths = explode('/', $_SERVER['REQUEST_URI']); $root = str_replace('\\', '/', $main_inc_path);
# Drop the last item -- it will be the php page we're on $root2 = str_replace('\\','/', $_SERVER['DOCUMENT_ROOT']);
array_pop($paths); $path = '';
$leading = array(); while (strpos($_SERVER['DOCUMENT_ROOT'], $root) === false) {
while (count($paths)) { $lastslash = strrpos($root, '/');
if (in_array($paths[0], array('scp','client'))) $path = substr($root, $lastslash) . $path;
break; $root = substr($root, 0, $lastslash);
$leading[] = array_shift($paths);
} }
if (count($leading) > 1) return $path;
return implode('/', $leading);
else
return '';
} }
} }
......
...@@ -60,13 +60,6 @@ ...@@ -60,13 +60,6 @@
} }
#Set Dir constants #Set Dir constants
$here = substr(realpath(dirname(__file__)),
strlen($_SERVER['DOCUMENT_ROOT']));
// Determine the path in the URI used as the base of the osTicket
// installation
if (!defined('ROOT_PATH'))
define('ROOT_PATH', str_replace('\\', '/', $here.'/')); //root path. Damn directories
define('ROOT_DIR',str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/'); #Get real path for root dir ---linux and windows define('ROOT_DIR',str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/'); #Get real path for root dir ---linux and windows
define('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path. define('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path.
define('PEAR_DIR',INCLUDE_DIR.'pear/'); define('PEAR_DIR',INCLUDE_DIR.'pear/');
...@@ -75,6 +68,13 @@ ...@@ -75,6 +68,13 @@
define('UPGRADE_DIR', INCLUDE_DIR.'upgrader/'); define('UPGRADE_DIR', INCLUDE_DIR.'upgrader/');
define('I18N_DIR', INCLUDE_DIR.'i18n/'); define('I18N_DIR', INCLUDE_DIR.'i18n/');
require(INCLUDE_DIR.'class.misc.php');
// Determine the path in the URI used as the base of the osTicket
// installation
if (!defined('ROOT_PATH'))
define('ROOT_PATH', Misc::siteRootPath(realpath(dirname(__file__))).'/'); //root path. Damn directories
/*############## Do NOT monkey with anything else beyond this point UNLESS you really know what you are doing ##############*/ /*############## Do NOT monkey with anything else beyond this point UNLESS you really know what you are doing ##############*/
#Current version && schema signature (Changes from version to version) #Current version && schema signature (Changes from version to version)
...@@ -117,7 +117,6 @@ ...@@ -117,7 +117,6 @@
require(INCLUDE_DIR.'class.pagenate.php'); //Pagenate helper! require(INCLUDE_DIR.'class.pagenate.php'); //Pagenate helper!
require(INCLUDE_DIR.'class.log.php'); require(INCLUDE_DIR.'class.log.php');
require(INCLUDE_DIR.'class.crypto.php'); require(INCLUDE_DIR.'class.crypto.php');
require(INCLUDE_DIR.'class.misc.php');
require(INCLUDE_DIR.'class.timezone.php'); require(INCLUDE_DIR.'class.timezone.php');
require(INCLUDE_DIR.'class.http.php'); require(INCLUDE_DIR.'class.http.php');
require(INCLUDE_DIR.'class.signal.php'); require(INCLUDE_DIR.'class.signal.php');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment