Add base.local.php file to allow symlinking of IMP
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 04:35:29 +0000 (21:35 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 04:35:29 +0000 (21:35 -0700)
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).

.gitignore
imp/ajax.php
imp/cache.php
imp/lib/base.php

index 86f711e..ff5246f 100644 (file)
@@ -6,3 +6,4 @@ libs
 .settings
 *~
 .#*
+imp/lib/base.local.php
index c8feda4..7b7cb63 100644 (file)
@@ -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');
index 267856d..d36891c 100644 (file)
 $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':
index 674fbc9..99b8f88 100644 (file)
  * @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;