diff --git a/kb/kb.inc.php b/kb/kb.inc.php index ed0ab8c21f803473c9a324cf033b235a58fc6f8a..a53c515cb7c90906ec930291b3e07a5ded6a5e95 100644 --- a/kb/kb.inc.php +++ b/kb/kb.inc.php @@ -13,7 +13,6 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ -define('ROOT_PATH','../'); require_once('../client.inc.php'); require_once(INCLUDE_DIR.'class.faq.php'); /* Bail out if knowledgebase is disabled or if we have no public-published FAQs. */ diff --git a/main.inc.php b/main.inc.php index 5ea6cc97fd2d48cae27fe99ab91c5e402b0c88a6..5f07a80e1b77d4026d02780c8f817b6e26aa3e05 100644 --- a/main.inc.php +++ b/main.inc.php @@ -60,7 +60,12 @@ } #Set Dir constants - if(!defined('ROOT_PATH')) define('ROOT_PATH','./'); //root path. Damn directories + $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('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path. @@ -127,8 +132,8 @@ require(INCLUDE_DIR.'mysql.php'); #Cookies - session_set_cookie_params(86400, dirname($_SERVER['PHP_SELF']), - $_SERVER['HTTP_HOST'], osTicket::is_https()); + session_set_cookie_params(86400, ROOT_PATH, $_SERVER['HTTP_HOST'], + osTicket::is_https()); #CURRENT EXECUTING SCRIPT. define('THISPAGE', Misc::currentURL()); diff --git a/pages/index.php b/pages/index.php index 78c49e73783c608b041f833745f14ba78ad5a2dc..75c5490dd7be32bd7be1de368cefeeee830ec432 100644 --- a/pages/index.php +++ b/pages/index.php @@ -15,7 +15,6 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ @chdir(realpath(dirname(__file__).'/../')); -define('ROOT_PATH','../'); require_once('client.inc.php'); require_once(INCLUDE_DIR.'class.format.php'); diff --git a/scp/staff.inc.php b/scp/staff.inc.php index 503c3cd413be64319882c255f9595029cbd0615d..77aa2c9b313900f2a38f0aad2872e4c64b22d266 100644 --- a/scp/staff.inc.php +++ b/scp/staff.inc.php @@ -17,7 +17,6 @@ if(basename($_SERVER['SCRIPT_NAME'])==basename(__FILE__)) die('Access denied'); if(!file_exists('../main.inc.php')) die('Fatal error... get technical support'); -define('ROOT_PATH','../'); //Path to the root dir. require_once('../main.inc.php'); if(!defined('INCLUDE_DIR')) die('Fatal error... invalid setting.');