diff --git a/api/cron.php b/api/cron.php index f5d47e43e2af43e1d26a1f8a5e9af698bc7e0b8f..787460ee7c3042ee36a46ec39e8060fc73f5beaf 100644 --- a/api/cron.php +++ b/api/cron.php @@ -13,7 +13,7 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ -@chdir(realpath(dirname(__FILE__)).'/'); //Change dir. +@chdir(dirname(__FILE__).'/'); //Change dir. require('api.inc.php'); if (!osTicket::is_cli()) diff --git a/api/pipe.php b/api/pipe.php index 7cf1ad1b4f7c5edd88ba75cb5c7c66b683a109dc..249cfc8a79ffef59dee8295b7feb2e8ffd94f4f2 100644 --- a/api/pipe.php +++ b/api/pipe.php @@ -15,7 +15,7 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ ini_set('memory_limit', '256M'); //The concern here is having enough mem for emails with attachments. -@chdir(realpath(dirname(__FILE__)).'/'); //Change dir. +@chdir(dirname(__FILE__).'/'); //Change dir. require('api.inc.php'); //Only local piping supported via pipe.php diff --git a/bootstrap.php b/bootstrap.php index ff7cf6b641d84a1aafc42bbbb299612817bf7fba..5aaad77ba3e973906d2b095f7fbf5b31b08e222e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -261,7 +261,11 @@ class Bootstrap { } #Get real path for root dir ---linux and windows -define('ROOT_DIR',str_replace('\\', '/', realpath(dirname(__FILE__))).'/'); +$here = dirname(__FILE__); +$here = ($h = realpath($here)) ? $h : $here; +define('ROOT_DIR',str_replace('\\', '/', $here.'/')); +unset($here); unset($h); + define('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path. define('PEAR_DIR',INCLUDE_DIR.'pear/'); define('SETUP_DIR',ROOT_DIR.'setup/'); diff --git a/client.inc.php b/client.inc.php index 2ab016d15c6a252af4816ef867748c991f8fd760..7aeae56ee32283d4c8def33a1a8348ffb2b16404 100644 --- a/client.inc.php +++ b/client.inc.php @@ -15,7 +15,7 @@ **********************************************************************/ if(!strcasecmp(basename($_SERVER['SCRIPT_NAME']),basename(__FILE__))) die('kwaheri rafiki!'); -$thisdir=str_replace('\\', '/', realpath(dirname(__FILE__))).'/'; +$thisdir=str_replace('\\', '/', dirname(__FILE__)).'/'; if(!file_exists($thisdir.'main.inc.php')) die('Fatal Error.'); require_once($thisdir.'main.inc.php'); diff --git a/include/class.i18n.php b/include/class.i18n.php index 8958315bc5fbdc019cc605735e6f060dcb98bd65..3d721e8eb7d2769884aae68e1fbb3cbb29ac2828 100644 --- a/include/class.i18n.php +++ b/include/class.i18n.php @@ -150,7 +150,7 @@ class DataTemplate { foreach ($langs as $l) { if (file_exists("{$this->base}/$l/$path")) { $this->lang = $l; - $this->filepath = realpath("{$this->base}/$l/$path"); + $this->filepath = Misc::realpath("{$this->base}/$l/$path"); break; } } diff --git a/include/class.misc.php b/include/class.misc.php index 41edef9f6bd7515e8264db429d0dea3b4fdc3251..e0b9559b93c4470554474ba691ec01daaae5e7ae 100644 --- a/include/class.misc.php +++ b/include/class.misc.php @@ -139,5 +139,10 @@ class Misc { return $output; } + function realpath($path) { + $rp = realpath($path); + return $rp ? $rp : $path; + } + } ?> diff --git a/include/class.pdf.php b/include/class.pdf.php index 1555de7727ec8b70848585470a643538b4ac9343..8346ee3c735a43de303008670fe9e3b6fb101e3d 100644 --- a/include/class.pdf.php +++ b/include/class.pdf.php @@ -14,7 +14,7 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ -define('THIS_DIR', str_replace('\\', '/', realpath(dirname(__FILE__))) . '/'); //Include path.. +define('THIS_DIR', str_replace('\\', '/', Misc::realpath(dirname(__FILE__))) . '/'); //Include path.. require_once(INCLUDE_DIR.'mpdf/mpdf.php'); diff --git a/pages/index.php b/pages/index.php index fc65aebc11b59fa80c0cb28860b562ab8f2e4e22..f646858352e9cb8e34b16300f9e6713b6930f392 100644 --- a/pages/index.php +++ b/pages/index.php @@ -14,7 +14,7 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ -@chdir(realpath(dirname(__file__).'/../')); +@chdir(dirname(__file__).'/../'); require_once('client.inc.php'); require_once(INCLUDE_DIR.'class.format.php'); diff --git a/setup/cli/modules/deploy.php b/setup/cli/modules/deploy.php index aa123bfcb1de9524ddb3b9bf3d291450eb866d62..8fc0e142bcbd7e0485291a10f333c0f3f0a6e7ed 100644 --- a/setup/cli/modules/deploy.php +++ b/setup/cli/modules/deploy.php @@ -35,7 +35,7 @@ class Deployment extends Unpacker { if (is_file($start . '/main.inc.php')) break; $start .= '/..'; } - return realpath($start); + return Misc::realpath($start); } /** @@ -92,7 +92,7 @@ class Deployment extends Unpacker { if (!is_dir($this->destination)) if (!@mkdir($this->destination, 0751, true)) die("Destination path does not exist and cannot be created"); - $this->destination = realpath($this->destination).'/'; + $this->destination = Misc::realpath($this->destination).'/'; # Determine if this is an upgrade, and if so, where the include/ # folder is currently located diff --git a/setup/cli/modules/unpack.php b/setup/cli/modules/unpack.php index 55fe6ab5a35299bd4e1c3017a40b7aab8342823f..3411c94eb6c102d94e0dd2d29c8fac9c66e2a0fa 100644 --- a/setup/cli/modules/unpack.php +++ b/setup/cli/modules/unpack.php @@ -41,7 +41,7 @@ class Unpacker extends Module { if (is_dir($start . '/upload')) break; $start .= '/..'; } - return realpath($start.'/upload'); + return Misc::realpath($start.'/upload'); } function change_include_dir($include_path) {