From: Michael M Slusarz Date: Thu, 15 Jan 2009 04:35:29 +0000 (-0700) Subject: Add base.local.php file to allow symlinking of IMP X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=75fd3d4da49d111f456856f5c8fa470895f35cc9;p=horde.git Add base.local.php file to allow symlinking of IMP Mirroring cjh's changes to horde/core.php - allows (for now) a way to install IMP in a directory other than directly under horde (i.e. symlinking). --- diff --git a/.gitignore b/.gitignore index 86f711e35..ff5246f07 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ libs .settings *~ .#* +imp/lib/base.local.php diff --git a/imp/ajax.php b/imp/ajax.php index c8feda480..7b7cb63ac 100644 --- a/imp/ajax.php +++ b/imp/ajax.php @@ -142,8 +142,16 @@ function _getQuota() } // Need to load Util:: to give us access to Util::getPathInfo(). +$imp_dir = dirname(__FILE__); if (!defined('HORDE_BASE')) { - define('HORDE_BASE', dirname(__FILE__) . '/..'); + /* Temporary fix - if horde does not live directly under the imp + * directory, the HORDE_BASE constant should be defined in + * imp/lib/base.local.php. */ + if (file_exists($imp_dir . '/lib/base.local.php')) { + include $imp_dir . '/lib/base.local.php'; + } else { + define('HORDE_BASE', $imp_dir . '/..'); + } } require_once HORDE_BASE . '/lib/core.php'; $action = basename(Util::getPathInfo()); @@ -162,7 +170,7 @@ if (in_array($action, array('chunkContent', 'Html2Text', 'Text2Html', 'GetReplyD $dimp_logout = ($action == 'LogOut'); $session_timeout = 'json'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once $imp_dir . '/lib/base.php'; // Process common request variables. $mbox = Util::getPost('view'); diff --git a/imp/cache.php b/imp/cache.php index 267856d0e..d36891c09 100644 --- a/imp/cache.php +++ b/imp/cache.php @@ -19,8 +19,16 @@ $expire_time = 525600; /* Load IMP.php to access IMP::getPathInfo(). */ +$imp_dir = dirname(__FILE__); if (!defined('HORDE_BASE')) { - define('HORDE_BASE', dirname(__FILE__) . '/..'); + /* Temporary fix - if horde does not live directly under the imp + * directory, the HORDE_BASE constant should be defined in + * imp/lib/base.local.php. */ + if (file_exists($imp_dir . '/lib/base.local.php')) { + include $imp_dir . '/lib/base.local.php'; + } else { + define('HORDE_BASE', $imp_dir . '/..'); + } } require_once HORDE_BASE . '/lib/core.php'; $path_info = trim(Util::getPathInfo(), '/'); @@ -47,7 +55,7 @@ if ($type == 'fckeditor') { } $session_control = 'readonly'; $session_timeout = 'none'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once $imp_dir . '/lib/base.php'; switch ($type) { case 'css': diff --git a/imp/lib/base.php b/imp/lib/base.php index 674fbc96c..99b8f882f 100644 --- a/imp/lib/base.php +++ b/imp/lib/base.php @@ -31,19 +31,28 @@ * @package IMP */ +$imp_dir = dirname(__FILE__); + // Check for a prior definition of HORDE_BASE. if (!defined('HORDE_BASE')) { - define('HORDE_BASE', dirname(__FILE__) . '/../..'); + /* Temporary fix - if horde does not live directly under the imp + * directory, the HORDE_BASE constant should be defined in + * imp/lib/base.local.php. */ + if (file_exists($imp_dir . '/base.local.php')) { + include $imp_dir . '/base.local.php'; + } else { + define('HORDE_BASE', $imp_dir . '/../..'); + } } // Find the base file path of IMP. if (!defined('IMP_BASE')) { - define('IMP_BASE', dirname(__FILE__) . '/..'); + define('IMP_BASE', $imp_dir . '/..'); } // Load the Horde Framework core, and set up inclusion paths. require_once HORDE_BASE . '/lib/core.php'; -Horde_Autoloader::addClassPattern('/^IMP_/', dirname(__FILE__)); +Horde_Autoloader::addClassPattern('/^IMP_/', $imp_dir); // Registry. $s_ctrl = 0;