Fix locally modifiable file paths.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 16 Mar 2009 14:31:37 +0000 (08:31 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 16 Mar 2009 14:31:37 +0000 (08:31 -0600)
chora/test.php
imp/test.php
ingo/test.php
kronolith/test.php

index 435efab..4f6844f 100644 (file)
@@ -9,7 +9,13 @@
  */
 
 /* Include Horde's core.php file. */
-include_once '../lib/core.php';
+$filedir = dirname(__FILE__);
+if (file_exists($filedir . '/lib/base.local.php')) {
+    include_once $filedir . '/lib/base.local.php';
+} elseif (!defined('HORDE_BASE')) {
+    define('HORDE_BASE', $filedir . '/..');
+}
+include_once HORDE_BASE . '/lib/core.php';
 
 /* We should have loaded the String class, from the Horde_Util
    package, in core.php. If String:: isn't defined, then we're not
@@ -20,16 +26,16 @@ if (!class_exists('String')) {
 }
 
 /* Initialize the Horde_Test:: class. */
-if (!is_readable('../lib/Test.php')) {
+if (!is_readable(HORDE_BASE . '/lib/Test.php')) {
     echo 'ERROR: You must install Horde before running this script.';
     exit;
 }
-require_once '../lib/Test.php';
+require_once HORDE_BASE . '/lib/Test.php';
 $horde_test = new Horde_Test;
 
 /* Chora version. */
 $module = 'Chora';
-require_once './lib/version.php';
+require_once $filedir . '/lib/version.php';
 $module_version = CHORA_VERSION;
 
 /* Chora configuration files. */
index 14e7d35..0722901 100644 (file)
@@ -15,7 +15,6 @@
 
 function _doConnectionTest()
 {
-    require_once 'Horde/Imap/Client.php';
     $imap_config = array(
         'username' => isset($_POST['user']) ? $_POST['user'] : '',
         'password' => isset($_POST['passwd']) ? $_POST['passwd'] : '',
@@ -93,7 +92,13 @@ function _errorMsg($e)
 
 
 /* Include Horde's core.php file. */
-include_once '../lib/core.php';
+$filedir = dirname(__FILE__);
+if (file_exists($filedir . '/lib/base.local.php')) {
+    include_once $filedir . '/lib/base.local.php';
+} elseif (!defined('HORDE_BASE')) {
+    define('HORDE_BASE', $filedir . '/..');
+}
+include_once HORDE_BASE . '/lib/core.php';
 
 /* We should have loaded the String class, from the Horde_Util
  * package, in core.php. If String:: isn't defined, then we're not
@@ -104,16 +109,17 @@ if (!class_exists('String')) {
 }
 
 /* Initialize the Horde_Test:: class. */
-if (!is_readable('../lib/Test.php')) {
+if (!is_readable(HORDE_BASE . '/lib/Test.php')) {
     echo 'ERROR: You must install Horde before running this script.';
     exit;
 }
-require_once '../lib/Test.php';
+
+require_once HORDE_BASE . '/lib/Test.php';
 $horde_test = new Horde_Test;
 
 /* IMP version. */
 $module = 'IMP';
-require_once './lib/version.php';
+require_once $filedir .'/lib/version.php';
 $module_version = IMP_VERSION;
 
 require TEST_TEMPLATES . 'header.inc';
index ab9b637..25f7aa2 100644 (file)
  */
 
 /* Include Horde's core.php file. */
-include_once '../lib/core.php';
+$filedir = dirname(__FILE__);
+if (file_exists($filedir . '/lib/base.local.php')) {
+        include_once $filedir . '/lib/base.local.php';
+} elseif (!defined('HORDE_BASE')) {
+        define('HORDE_BASE', $filedir . '/..');
+}
+include_once HORDE_BASE . '/lib/core.php';
 
 /* We should have loaded the String class, from the Horde_Util
  * package, in core.php. If String:: isn't defined, then we're not
@@ -23,16 +29,16 @@ if (!class_exists('String')) {
 }
 
 /* Initialize the Horde_Test:: class. */
-if (!is_readable('../lib/Test.php')) {
+if (!is_readable(HORDE_BASE . '/lib/Test.php')) {
     echo 'ERROR: You must install Horde before running this script.';
     exit;
 }
-require_once '../lib/Test.php';
+require_once HORDE_BASE . '/lib/Test.php';
 $horde_test = new Horde_Test;
 
 /* Ingo version. */
 $module = 'Ingo';
-require_once './lib/version.php';
+require_once $filedir . '/lib/version.php';
 $module_version = INGO_VERSION;
 
 require TEST_TEMPLATES . 'header.inc';
index 91eabda..62c79b8 100644 (file)
@@ -1,6 +1,12 @@
 <?php
 /* Include Horde's core.php file. */
-include_once '../lib/core.php';
+$filedir = dirname(__FILE__);
+if (file_exists($filedir . '/lib/base.local.php')) {
+    include_once $filedir . '/lib/base.local.php';
+} elseif (!defined('HORDE_BASE')) {
+    define('HORDE_BASE', $filedir . '/..');
+}
+include_once HORDE_BASE . '/lib/core.php';
 
 /* We should have loaded the String class, from the Horde_Util package, in
  * core.php. If String:: isn't defined, then we're not finding some critical
@@ -11,16 +17,15 @@ if (!class_exists('String')) {
 }
 
 /* Initialize the Horde_Test:: class. */
-if (!is_readable('../lib/Test.php')) {
+if (!is_readable(HORDE_BASE . '/lib/Test.php')) {
     echo 'ERROR: You must install Horde before running this script.';
     exit;
 }
-require_once '../lib/Test.php';
+require_once HORDE_BASE . '/lib/Test.php';
 $horde_test = new Horde_Test;
 
-
 $module = 'Kronolith';
-require_once './lib/version.php';
+require_once $filedir . '/lib/version.php';
 $module_version = KRONOLITH_VERSION;
 
 require TEST_TEMPLATES . 'header.inc';