From 06f8705baffa100e04b56d41595ef7b2ac3216d3 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 9 Jun 2009 13:21:29 -0600 Subject: [PATCH] Move *_BASE determination to base.load.php. --- chora/index.php | 5 ++--- chora/lib/base.load.php | 28 ++++++++++++++++++++++++++++ chora/test.php | 9 ++------- imp/ajax.php | 14 ++------------ imp/cache.php | 14 ++------------ imp/index.php | 13 +------------ imp/lib/base.load.php | 28 ++++++++++++++++++++++++++++ imp/lib/base.php | 19 ++----------------- imp/test.php | 9 ++------- ingo/index.php | 13 +------------ ingo/lib/base.load.php | 28 ++++++++++++++++++++++++++++ ingo/lib/base.php | 19 ++----------------- ingo/test.php | 9 ++------- kronolith/add.php | 3 +-- kronolith/ajax.php | 14 ++------------ kronolith/attend.php | 3 +-- kronolith/attendees.php | 3 +-- kronolith/contacts.php | 3 +-- kronolith/data.php | 3 +-- kronolith/delete.php | 3 +-- kronolith/edit.php | 3 +-- kronolith/event.php | 3 +-- kronolith/fb.php | 3 +-- kronolith/imple.php | 3 +-- kronolith/index.php | 4 ++-- kronolith/lib/base.load.php | 28 ++++++++++++++++++++++++++++ kronolith/lib/base.php | 18 ++---------------- kronolith/new.php | 3 +-- kronolith/perms.php | 3 +-- kronolith/pref_api.php | 2 +- kronolith/search.php | 3 +-- kronolith/test.php | 9 ++------- 32 files changed, 152 insertions(+), 170 deletions(-) create mode 100644 chora/lib/base.load.php create mode 100644 imp/lib/base.load.php create mode 100644 ingo/lib/base.load.php create mode 100644 kronolith/lib/base.load.php diff --git a/chora/index.php b/chora/index.php index 05362c2fc..5ccfb14a8 100644 --- a/chora/index.php +++ b/chora/index.php @@ -9,15 +9,14 @@ * @package Chora */ -define('CHORA_BASE', dirname(__FILE__)); +require_once dirname(__FILE__) . '/lib/base.load.php'; $chora_configured = (is_readable(CHORA_BASE . '/config/conf.php') && is_readable(CHORA_BASE . '/config/sourceroots.php') && is_readable(CHORA_BASE . '/config/mime_drivers.php') && is_readable(CHORA_BASE . '/config/prefs.php')); if (!$chora_configured) { - /* Chora isn't configured. */ - require CHORA_BASE . '/../lib/Test.php'; + require HORDE_BASE . '/lib/Test.php'; Horde_Test::configFilesMissing('Chora', CHORA_BASE, array('conf.php', 'prefs.php', 'mime_drivers.php'), array('sourceroots.php' => 'This file defines all of the source repositories that you wish Chora to display.')); diff --git a/chora/lib/base.load.php b/chora/lib/base.load.php new file mode 100644 index 000000000..a763fd5ec --- /dev/null +++ b/chora/lib/base.load.php @@ -0,0 +1,28 @@ + */ -@define('INGO_BASE', dirname(__FILE__)); +require_once dirname(__FILE__) . '/base.load.php'; $ingo_configured = (is_readable(INGO_BASE . '/config/conf.php') && is_readable(INGO_BASE . '/config/prefs.php') && is_readable(INGO_BASE . '/config/backends.php') && is_readable(INGO_BASE . '/config/fields.php')); if (!$ingo_configured) { - if (!defined('HORDE_BASE')) { - /* 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(INGO_BASE . '/lib/base.local.php')) { - include INGO_BASE . '/lib/base.local.php'; - } else { - define('HORDE_BASE', INGO_BASE . '/..'); - } - } - require HORDE_BASE . '/lib/Test.php'; Horde_Test::configFilesMissing('Ingo', INGO_BASE, array('conf.php', 'prefs.php', 'backends.php'), diff --git a/ingo/lib/base.load.php b/ingo/lib/base.load.php new file mode 100644 index 000000000..6c330a126 --- /dev/null +++ b/ingo/lib/base.load.php @@ -0,0 +1,28 @@ + */ -@define('KRONOLITH_BASE', dirname(__FILE__)); -require_once KRONOLITH_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/base.php'; $path = Util::getFormData('imple'); if (!$path) { diff --git a/kronolith/index.php b/kronolith/index.php index a2f0efabe..e990d366b 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -6,12 +6,12 @@ * not receive such a file, see also http://www.fsf.org/copyleft/gpl.html. */ -@define('KRONOLITH_BASE', dirname(__FILE__)); +require_once dirname(__FILE__) . '/lib/base.load.php'; $kronolith_configured = (is_readable(KRONOLITH_BASE . '/config/conf.php') && is_readable(KRONOLITH_BASE . '/config/prefs.php')); if (!$kronolith_configured) { - require KRONOLITH_BASE . '/../lib/Test.php'; + require HORDE_BASE . '/lib/Test.php'; Horde_Test::configFilesMissing('Kronolith', KRONOLITH_BASE, array('conf.php', 'prefs.php')); } diff --git a/kronolith/lib/base.load.php b/kronolith/lib/base.load.php new file mode 100644 index 000000000..373081dfb --- /dev/null +++ b/kronolith/lib/base.load.php @@ -0,0 +1,28 @@ +pushApp('kronolith', !defined('AUTH_HANDLER'))), $conf = &$GLOBALS['conf']; define('KRONOLITH_TEMPLATES', $registry->get('templates')); -/* Find the base file path of Kronolith. */ -if (!defined('KRONOLITH_BASE')) { - define('KRONOLITH_BASE', $kronolith_dir . '/..'); -} - /* Horde framework libraries. */ require_once 'Horde/Help.php'; diff --git a/kronolith/new.php b/kronolith/new.php index 45b6b8d5c..935a6c8d4 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -8,8 +8,7 @@ * @author Chuck Hagenbuch */ -@define('KRONOLITH_BASE', dirname(__FILE__)); -require KRONOLITH_BASE . '/lib/base.php'; +require dirname(__FILE__) . '/lib/base.php'; /* Check permissions. */ if (Kronolith::hasPermission('max_events') !== true && diff --git a/kronolith/perms.php b/kronolith/perms.php index 364d70f5e..2956ed92d 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -9,8 +9,7 @@ * @author Jan Schneider */ -@define('KRONOLITH_BASE', dirname(__FILE__)); -require_once KRONOLITH_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/base.php'; require_once 'Horde/Group.php'; $shares = &Horde_Share::singleton('kronolith'); diff --git a/kronolith/pref_api.php b/kronolith/pref_api.php index a7a925400..3daae1ceb 100644 --- a/kronolith/pref_api.php +++ b/kronolith/pref_api.php @@ -8,7 +8,7 @@ * @author Chuck Hagenbuch */ -@define('HORDE_BASE', dirname(dirname(__FILE__))); +require_once dirname(__FILE__) . '/lib/base.load.php'; require_once HORDE_BASE . '/lib/core.php'; $registry = &Registry::singleton(); diff --git a/kronolith/search.php b/kronolith/search.php index 9d6987371..9727a80f2 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -8,8 +8,7 @@ * @author Meilof Veeningen */ -@define('KRONOLITH_BASE', dirname(__FILE__)); -require_once KRONOLITH_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/base.php'; /* Get search parameters. */ $search_mode = Util::getFormData('search_mode', 'basic'); diff --git a/kronolith/test.php b/kronolith/test.php index 62c79b882..de0ccf1aa 100644 --- a/kronolith/test.php +++ b/kronolith/test.php @@ -1,11 +1,6 @@