From: Michael M Slusarz Date: Thu, 14 Jan 2010 20:03:10 +0000 (-0700) Subject: Remove base.php stuff from Kronolith X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9befa6aa309c929db0d4a2b0370c157084fa4943;p=horde.git Remove base.php stuff from Kronolith --- diff --git a/kronolith/add.php b/kronolith/add.php index 8ff0d29a0..cbbac3aaf 100644 --- a/kronolith/add.php +++ b/kronolith/add.php @@ -6,7 +6,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); if (!Horde_Util::getFormData('cancel')) { $targetcalendar = Horde_Util::getFormData('targetcalendar'); diff --git a/kronolith/ajax.php b/kronolith/ajax.php index 2d6cd9fb6..6b1c1e545 100644 --- a/kronolith/ajax.php +++ b/kronolith/ajax.php @@ -55,9 +55,7 @@ function saveEvent($event) return $result; } -// Need to load Horde_Util:: to give us access to Horde_Util::getPathInfo(). -require_once dirname(__FILE__) . '/lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; $action = basename(Horde_Util::getPathInfo()); if (empty($action)) { // This is the only case where we really don't return anything, since @@ -68,12 +66,26 @@ if (empty($action)) { // The following actions do not need write access to the session and // should be opened read-only for performance reasons. +$session_control = null; if (in_array($action, array())) { - $kronolith_session_control = 'readonly'; + $session_control = 'readonly'; } -$kronolith_session_timeout = 'json'; -require_once KRONOLITH_BASE . '/lib/base.php'; +try { + Horde_Registry::appInit('kronolith', array('authentication' => 'throw', 'session_control' => $session_control)); +} catch (Horde_Exception $e) { + /* Handle session timeouts when they come from an AJAX request. */ + if (($e->getCode() == Horde_Registry::AUTH_FAILURE) && + ($action != 'LogOut')) { + $notification = Horde_Notification::singleton(); + $k_notify = $notification->attach('status', array(), 'Kronolith_Notification_Listener_Status'); + $notification->push(str_replace('&', '&', Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'kronolith.timeout', array('content.raw')); + Horde::sendHTTPResponse(Horde::prepareResponse(null, $k_notify), 'json'); + exit; + } + + Horde_Auth::authenticateFailure('kronolith', $e); +} // Process common request variables. $cacheid = Horde_Util::getPost('cacheid'); diff --git a/kronolith/attend.php b/kronolith/attend.php index a7046aa8e..18bf4dc30 100644 --- a/kronolith/attend.php +++ b/kronolith/attend.php @@ -9,8 +9,8 @@ * @package Kronolith */ -$kronolith_authentication = 'none'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none')); $cal = Horde_Util::getFormData('c'); $id = Horde_Util::getFormData('e'); diff --git a/kronolith/attendees.php b/kronolith/attendees.php index ebf2c9b9a..78a41c74d 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -7,7 +7,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); // Get the current attendees array from the session cache. $attendees = (isset($_SESSION['kronolith']['attendees']) && diff --git a/kronolith/calendars/create.php b/kronolith/calendars/create.php index 97370c481..00812c4a3 100644 --- a/kronolith/calendars/create.php +++ b/kronolith/calendars/create.php @@ -8,8 +8,9 @@ * @author Chuck Hagenbuch */ -@define('KRONOLITH_BASE', dirname(dirname(__FILE__))); -require_once KRONOLITH_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/CreateCalendar.php'; // Exit if this isn't an authenticated user or if the user can't diff --git a/kronolith/calendars/delete.php b/kronolith/calendars/delete.php index 641cf04fe..070c79f09 100644 --- a/kronolith/calendars/delete.php +++ b/kronolith/calendars/delete.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/DeleteCalendar.php'; // Exit if this isn't an authenticated user. diff --git a/kronolith/calendars/edit.php b/kronolith/calendars/edit.php index e96604791..189eb7e45 100644 --- a/kronolith/calendars/edit.php +++ b/kronolith/calendars/edit.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/EditCalendar.php'; // Exit if this isn't an authenticated user. diff --git a/kronolith/calendars/index.php b/kronolith/calendars/index.php index a57208ede..d221ec0ce 100644 --- a/kronolith/calendars/index.php +++ b/kronolith/calendars/index.php @@ -21,7 +21,8 @@ function shorten_url($url, $separator = '...', $first_chunk_length = 35, $last_c return $url; } -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); // Exit if this isn't an authenticated user. if (!Horde_Auth::getAuth()) { diff --git a/kronolith/calendars/info.php b/kronolith/calendars/info.php index 48f6934d4..97b1a8bd8 100644 --- a/kronolith/calendars/info.php +++ b/kronolith/calendars/info.php @@ -6,7 +6,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); // Exit if this isn't an authenticated user. if (!Horde_Auth::getAuth()) { diff --git a/kronolith/calendars/remote_edit.php b/kronolith/calendars/remote_edit.php index 59cc64b1f..29062c6e7 100644 --- a/kronolith/calendars/remote_edit.php +++ b/kronolith/calendars/remote_edit.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/EditRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't diff --git a/kronolith/calendars/remote_subscribe.php b/kronolith/calendars/remote_subscribe.php index 2dbb048af..9af9a757e 100644 --- a/kronolith/calendars/remote_subscribe.php +++ b/kronolith/calendars/remote_subscribe.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/SubscribeRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't diff --git a/kronolith/calendars/remote_unsubscribe.php b/kronolith/calendars/remote_unsubscribe.php index 781da5a3d..fb2db1303 100644 --- a/kronolith/calendars/remote_unsubscribe.php +++ b/kronolith/calendars/remote_unsubscribe.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/UnsubscribeRemoteCalendar.php'; // Exit if this isn't an authenticated user or if the user can't diff --git a/kronolith/contacts.php b/kronolith/contacts.php index 60746ea98..011fdb40d 100644 --- a/kronolith/contacts.php +++ b/kronolith/contacts.php @@ -6,7 +6,8 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); if (!Horde_Auth::getAuth()) { Horde_Util::closeWindowJS(); diff --git a/kronolith/data.php b/kronolith/data.php index a6e087e0a..536a9284c 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -16,7 +16,8 @@ function _cleanup() return Horde_Data::IMPORT_FILE; } -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); if (!$conf['menu']['import_export']) { require KRONOLITH_BASE . '/index.php'; diff --git a/kronolith/day.php b/kronolith/day.php index 797cea103..91b286caf 100644 --- a/kronolith/day.php +++ b/kronolith/day.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView('Day'); $title = $view->getTime($prefs->getValue('date_format')); diff --git a/kronolith/delete.php b/kronolith/delete.php index 03aeba91b..6069b1719 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); if (Kronolith_Resource::isResourceCalendar($c = Horde_Util::getFormData('calendar'))) { $driver = 'Resource'; diff --git a/kronolith/edit.php b/kronolith/edit.php index 99e40e0d0..5c26d1bd7 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -37,7 +37,8 @@ function _check_max() return true; } -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $kronolith_driver = Kronolith::getDriver(); diff --git a/kronolith/event.php b/kronolith/event.php index b886e0810..80c376748 100644 --- a/kronolith/event.php +++ b/kronolith/event.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $viewName = Horde_Util::getFormData('view', 'Event'); $view = Kronolith::getView($viewName); diff --git a/kronolith/fb.php b/kronolith/fb.php index e97e96c5e..2a4ff2d5f 100644 --- a/kronolith/fb.php +++ b/kronolith/fb.php @@ -9,9 +9,8 @@ * @package Kronolith */ -$kronolith_authentication = 'none'; -$kronolith_session_control = 'none'; -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'session_control' => 'none')); // We want to always generate UTF-8 iCalendar data. Horde_Nls::setCharset('UTF-8'); diff --git a/kronolith/feed/index.php b/kronolith/feed/index.php index 027887b0a..af00ffbd9 100644 --- a/kronolith/feed/index.php +++ b/kronolith/feed/index.php @@ -21,9 +21,8 @@ function _no_access($status, $reason, $body) exit; } -$kronolith_authentication = 'none'; -$kronolith_session_control = 'readonly'; -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'session_control' => 'readonly')); $calendar = Horde_Util::getFormData('c'); $share = $kronolith_shares->getShare($calendar); diff --git a/kronolith/index.php b/kronolith/index.php index 06c5f2880..e511f068d 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -6,7 +6,8 @@ * not receive such a file, see also http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); /* Load traditional interface? */ if (!$prefs->getValue('dynamic_view') || !$browser->hasFeature('xmlhttpreq') || diff --git a/kronolith/lib/Ajax/Imple/TagActions.php b/kronolith/lib/Ajax/Imple/TagActions.php index af4fdb9b8..2a2b98dfa 100644 --- a/kronolith/lib/Ajax/Imple/TagActions.php +++ b/kronolith/lib/Ajax/Imple/TagActions.php @@ -40,7 +40,6 @@ class Kronolith_Ajax_Imple_TagActions extends Horde_Ajax_Imple_Base */ public function handle($args, $post) { - require_once dirname(__FILE__) . '/../../base.php'; global $ansel_storage; $request = $args['action']; diff --git a/kronolith/lib/Api.php b/kronolith/lib/Api.php index f4382fe2e..3522a9b4f 100644 --- a/kronolith/lib/Api.php +++ b/kronolith/lib/Api.php @@ -55,8 +55,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function browse($path = '', $properties = array()) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; global $registry; // Default properties. @@ -266,9 +264,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function put($path, $content, $content_type) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (substr($path, 0, 9) == 'kronolith') { $path = substr($path, 9); } @@ -395,9 +390,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function path_delete($path) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (substr($path, 0, 9) == 'kronolith') { $path = substr($path, 9); } @@ -446,8 +438,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function listCalendars($owneronly = false, $permission = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; if (is_null($permission)) { $permission = Horde_Perms::SHOW; } @@ -465,9 +455,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function listUids($calendar = null, $startstamp = 0, $endstamp = 0) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (empty($calendar)) { $calendar = Kronolith::getDefaultCalendar(); } @@ -508,9 +495,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function listBy($action, $timestamp, $calendar = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (empty($calendar)) { $calendar = Kronolith::getDefaultCalendar(); } @@ -541,9 +525,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function getActionTimestamp($uid, $action, $calendar = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (empty($calendar)) { $calendar = Kronolith::getDefaultCalendar(); } @@ -573,9 +554,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function import($content, $contentType, $calendar = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (!isset($calendar)) { $calendar = Kronolith::getDefaultCalendar(Horde_Perms::EDIT); } @@ -659,8 +637,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function quickAdd($text, $calendar = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; global $kronolith_shares; if (!isset($calendar)) { @@ -696,8 +672,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function export($uid, $contentType) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; global $kronolith_shares; $event = Kronolith::getDriver()->getByUID($uid); @@ -746,8 +720,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function exportCalendar($calendar, $contentType) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; global $kronolith_shares; if (!array_key_exists($calendar, @@ -807,9 +779,6 @@ class Kronolith_Api extends Horde_Registry_Api return true; } - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - $kronolith_driver = Kronolith::getDriver(); $events = $kronolith_driver->getByUID($uid, null, true); if (is_a($events, 'PEAR_Error')) { @@ -867,9 +836,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function replace($uid, $content, $contentType) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - $event = Kronolith::getDriver()->getByUID($uid); if (is_a($event, 'PEAR_Error')) { return $event; @@ -937,9 +903,6 @@ class Kronolith_Api extends Horde_Registry_Api public function getFreeBusy($startstamp = null, $endstamp = null, $calendar = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (is_null($calendar)) { $calendar = Kronolith::getDefaultCalendar(); } @@ -959,9 +922,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function eventFromUID($uid) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - $event = Kronolith::getDriver()->getByUID($uid); if (is_a($event, 'PEAR_Error')) { return $event; @@ -992,9 +952,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function updateAttendee($response, $sender = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - $uid = $response->getAttribute('UID'); if (is_a($uid, 'PEAR_Error')) { return $uid; @@ -1084,9 +1041,6 @@ class Kronolith_Api extends Horde_Registry_Api $calendars = null, $showRecurrence = true, $alarmsOnly = false) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (!isset($calendars)) { $calendars = array($GLOBALS['prefs']->getValue('default_share')); } elseif (!is_array($calendars)) { @@ -1114,8 +1068,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function listAlarms($time, $user = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; require_once 'Horde/Group.php'; $current_user = Horde_Auth::getAuth(); @@ -1284,9 +1236,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function lock($calendar, $event = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (!array_key_exists($calendar, Kronolith::listCalendars(false, Horde_Perms::EDIT))) { return PEAR::raiseError(_("Permission Denied")); @@ -1304,9 +1253,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function unlock($calendar, $lockid) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (!array_key_exists($calendar, Kronolith::listCalendars(false, Horde_Perms::EDIT))) { return PEAR::raiseError(_("Permission Denied")); @@ -1324,9 +1270,6 @@ class Kronolith_Api extends Horde_Registry_Api */ public function checkLocks($calendar, $event = null) { - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - if (!array_key_exists($calendar, Kronolith::listCalendars(false, Horde_Perms::READ))) { return PEAR::raiseError(_("Permission Denied")); diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index 516b50aa3..595fe3660 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -2,13 +2,92 @@ /** * Kronolith application API. * + * This file defines Horde's core API interface. Other core Horde libraries + * can interact with Horde through this API. + * + * See the enclosed file COPYING for license information (GPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * * @package Kronolith */ + +/* Determine the base directories. */ +if (!defined('KRONOLITH_BASE')) { + define('KRONOLITH_BASE', dirname(__FILE__) . '/..'); +} + +if (!defined('HORDE_BASE')) { + /* If Horde does not live directly under the app directory, the HORDE_BASE + * constant should be defined in config/horde.local.php. */ + if (file_exists(KRONOLITH_BASE . '/config/horde.local.php')) { + include KRONOLITH_BASE . '/config/horde.local.php'; + } else { + define('HORDE_BASE', KRONOLITH_BASE . '/..'); + } +} + +/* Load the Horde Framework core (needed to autoload + * Horde_Registry_Application::). */ +require_once HORDE_BASE . '/lib/core.php'; + class Kronolith_Application extends Horde_Registry_Application { + /** + * The application's version. + * + * @var string + */ public $version = 'H4 (3.0-git)'; /** + * Initialization function. + * + * Global variables defined: + * $kronolith_notify - A Horde_Notification_Listener object + * $kronolith_shares - TODO + * $notification - Notification object + * + * Global constants defined: + * KRONOLITH_TEMPLATES - (string) Location of template files. + * + * When calling Horde_Registry::appInit(), the following parameters are + * also supported: + *
+     * 'user' - (string) Set authentication to this user.
+     * 
+ */ + protected function _init() + { + if (isset($this->initParams['user'])) { + Horde_Auth::setAuth($this->initParams['user'], array()); + } + + if (!defined('KRONOLITH_TEMPLATES')) { + define('KRONOLITH_TEMPLATES', $GLOBALS['registry']->get('templates')); + } + + /* For now, autoloading the Content_* classes depend on there being a + * registry entry for the 'content' application that contains at least + * the fileroot entry. */ + Horde_Autoloader::addClassPattern('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/'); + if (!class_exists('Content_Tagger')) { + throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.'); + } + + /* Notification system. */ + $GLOBALS['notification'] = Horde_Notification::singleton(); + $GLOBALS['kronolith_notify'] = $GLOBALS['notification']->attach('status', null, 'Kronolith_Notification_Listener_Status'); + + /* Set the timezone variable, if available. */ + Horde_Nls::setTimeZone(); + + /* Create a share instance. */ + $GLOBALS['kronolith_shares'] = Horde_Share::singleton($GLOBALS['registry']->getApp()); + + Kronolith::initialize(); + } + + /** * Returns a list of available permissions. * * @return array An array describing all available permissions. @@ -250,9 +329,6 @@ class Kronolith_Application extends Horde_Registry_Application return PEAR::raiseError(_("You are not allowed to remove user data.")); } - $no_maint = true; - require_once dirname(__FILE__) . '/base.php'; - /* Remove all events owned by the user in all calendars. */ $result = Kronolith::getDriver()->removeUserData($user); diff --git a/kronolith/lib/Block/month.php b/kronolith/lib/Block/month.php index 5646e84e4..6fa2157e7 100644 --- a/kronolith/lib/Block/month.php +++ b/kronolith/lib/Block/month.php @@ -15,8 +15,6 @@ class Horde_Block_Kronolith_month extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', 'default' => '__all')); @@ -35,8 +33,6 @@ class Horde_Block_Kronolith_month extends Horde_Block { */ function _title() { - require_once dirname(__FILE__) . '/../base.php'; - $title = _("All Calendars"); $url = Horde::url($GLOBALS['registry']->getInitialPage(), true); if (isset($this->_params['calendar']) && @@ -61,10 +57,6 @@ class Horde_Block_Kronolith_month extends Horde_Block { { global $prefs; - // @TODO Remove this hack when maintenance is refactored. - $no_maint = true; - require_once dirname(__FILE__) . '/../base.php'; - if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') { if (empty($this->_share)) { $this->_share = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']); diff --git a/kronolith/lib/Block/monthlist.php b/kronolith/lib/Block/monthlist.php index 9d2df7546..711966950 100644 --- a/kronolith/lib/Block/monthlist.php +++ b/kronolith/lib/Block/monthlist.php @@ -14,8 +14,6 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', 'default' => '__all'), @@ -58,10 +56,6 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { */ function _content() { - // @TODO Remove this hack when maintenance is refactored. - $no_maint = true; - require_once dirname(__FILE__) . '/../base.php'; - global $registry, $prefs; Horde::addScriptFile('tooltips.js', 'horde'); diff --git a/kronolith/lib/Block/prevmonthlist.php b/kronolith/lib/Block/prevmonthlist.php index 110ea8e3d..0ff256037 100644 --- a/kronolith/lib/Block/prevmonthlist.php +++ b/kronolith/lib/Block/prevmonthlist.php @@ -14,8 +14,6 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { function _params() { - require_once dirname(__FILE__) . '/../base.php'; - $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', 'default' => '__all'), @@ -55,10 +53,6 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { */ function _content() { - // @TODO Remove this hack when maintenance is refactored. - $no_maint = true; - require_once dirname(__FILE__) . '/../base.php'; - global $registry, $prefs; $GLOBALS['from_block'] = true; diff --git a/kronolith/lib/Block/summary.php b/kronolith/lib/Block/summary.php index 5cd1f4fe1..68b9df277 100644 --- a/kronolith/lib/Block/summary.php +++ b/kronolith/lib/Block/summary.php @@ -22,10 +22,6 @@ class Horde_Block_Kronolith_summary extends Horde_Block { function _params() { - @define('KRONOLITH_BASE', dirname(__FILE__) . '/../..'); - - require_once KRONOLITH_BASE . '/lib/base.php'; - $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', 'default' => '__all'), @@ -79,8 +75,6 @@ class Horde_Block_Kronolith_summary extends Horde_Block { */ function _content() { - require_once dirname(__FILE__) . '/../base.php'; - Horde::addScriptFile('tooltips.js', 'horde'); $now = new Horde_Date($_SERVER['REQUEST_TIME']); diff --git a/kronolith/lib/Block/tree_alarms.php b/kronolith/lib/Block/tree_alarms.php index 931ce905d..52b63c16e 100644 --- a/kronolith/lib/Block/tree_alarms.php +++ b/kronolith/lib/Block/tree_alarms.php @@ -12,8 +12,6 @@ class Horde_Block_kronolith_tree_alarms extends Horde_Block { function _buildTree(&$tree, $indent = 0, $parent = null) { - require_once dirname(__FILE__) . '/../base.php'; - $horde_alarm = null; if (!empty($GLOBALS['conf']['alarms']['driver'])) { $horde_alarm = Horde_Alarm::factory(); diff --git a/kronolith/lib/Tagger.php b/kronolith/lib/Tagger.php index 0e5655278..4591233ec 100644 --- a/kronolith/lib/Tagger.php +++ b/kronolith/lib/Tagger.php @@ -8,10 +8,6 @@ * * @package Kronolith */ - -// NOTE: Still need this here in addition to base.php to avoid having to fully -// initialize kronolith for each autocomplete ajax request. -Horde_Autoloader::addClassPattern('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/'); class Kronolith_Tagger { /** diff --git a/kronolith/lib/base.load.php b/kronolith/lib/base.load.php deleted file mode 100644 index 8cee3a53c..000000000 --- a/kronolith/lib/base.load.php +++ /dev/null @@ -1,25 +0,0 @@ - - * $kronolith_authentication - The type of authentication to use: - * 'none' - Do not authenticate - * [DEFAULT] - Authenticate; on failure redirect to login screen - * $kronolith_session_control - Sets special session control limitations: - * 'none' - Do not start a session - * 'readonly' - Start session readonly - * [DEFAULT] - Start read-write session - * $no_compress - Controls whether the page should be compressed - * - * - * @package Kronolith - */ - -// Determine BASE directories. -require_once dirname(__FILE__) . '/base.load.php'; - -/* Load the Horde Framework core. */ -require_once HORDE_BASE . '/lib/core.php'; - -/* Registry. */ -$s_ctrl = 0; -switch (Horde_Util::nonInputVar('kronolith_session_control')) { -case 'none': - $s_ctrl = Horde_Registry::SESSION_NONE; - break; - -case 'readonly': - $s_ctrl = Horde_Registry::SESSION_READONLY; - break; -} -$registry = Horde_Registry::singleton($s_ctrl); - -try { - $registry->pushApp('kronolith', array('check_perms' => (Horde_Util::nonInputVar('kronolith_authentication') != 'none'), 'logintasks' => true)); -} catch (Horde_Exception $e) { - Horde_Auth::authenticateFailure('kronolith', $e); -} -$conf = &$GLOBALS['conf']; -define('KRONOLITH_TEMPLATES', $registry->get('templates')); - -/* For now, autoloading the Content_* classes depend on there being a registry - * entry for the 'content' application that contains at least the fileroot - * entry. */ -Horde_Autoloader::addClassPattern('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/'); -if (!class_exists('Content_Tagger')) { - throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.'); -} - -/* Notification system. */ -$GLOBALS['notification'] = Horde_Notification::singleton(); -$GLOBALS['kronolith_notify'] = $GLOBALS['notification']->attach('status', null, 'Kronolith_Notification_Listener_Status'); - -/* Start compression. */ -if (!Horde_Util::nonInputVar('no_compress')) { - Horde::compressOutput(); -} - -/* Set the timezone variable, if available. */ -Horde_Nls::setTimeZone(); - -/* Create a share instance. */ -$GLOBALS['kronolith_shares'] = Horde_Share::singleton($registry->getApp()); - -Kronolith::initialize(); diff --git a/kronolith/lib/tests/toicalendar.phpt b/kronolith/lib/tests/toicalendar.phpt index 6e788e22b..d8049be53 100644 --- a/kronolith/lib/tests/toicalendar.phpt +++ b/kronolith/lib/tests/toicalendar.phpt @@ -3,11 +3,9 @@ Kronolith_Event::toiCalendar() test. --FILE-- 'none')); $driver = new Kronolith_Driver(); $object = new Kronolith_Event_Sql($driver); diff --git a/kronolith/month.php b/kronolith/month.php index 454ee0779..036fe96c3 100644 --- a/kronolith/month.php +++ b/kronolith/month.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView('Month'); $title = $view->date->strftime('%B %Y'); diff --git a/kronolith/new.php b/kronolith/new.php index 3f89eab80..b4c77244a 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); /* Check permissions. */ $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true) diff --git a/kronolith/perms.php b/kronolith/perms.php index 746c6a884..796734b6c 100644 --- a/kronolith/perms.php +++ b/kronolith/perms.php @@ -9,7 +9,9 @@ * @author Jan Schneider */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once 'Horde/Group.php'; $shares = Horde_Share::singleton('kronolith'); diff --git a/kronolith/resources/create.php b/kronolith/resources/create.php index 8dfc94c2e..fa7df5cf2 100644 --- a/kronolith/resources/create.php +++ b/kronolith/resources/create.php @@ -8,8 +8,9 @@ * @author Chuck Hagenbuch */ -@define('KRONOLITH_BASE', dirname(dirname(__FILE__))); -require_once KRONOLITH_BASE . '/lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/CreateResource.php'; // Exit if this isn't an authenticated, administrative user diff --git a/kronolith/resources/delete.php b/kronolith/resources/delete.php index 55a8c238d..cc172d6e5 100644 --- a/kronolith/resources/delete.php +++ b/kronolith/resources/delete.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/DeleteResource.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/edit.php b/kronolith/resources/edit.php index 65e388455..6babaf164 100644 --- a/kronolith/resources/edit.php +++ b/kronolith/resources/edit.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/EditResource.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/groups/create.php b/kronolith/resources/groups/create.php index e967e4843..4c9f8cfe7 100644 --- a/kronolith/resources/groups/create.php +++ b/kronolith/resources/groups/create.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../../lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/CreateResourceGroup.php'; // Exit if this isn't an authenticated, administrative user diff --git a/kronolith/resources/groups/delete.php b/kronolith/resources/groups/delete.php index bae778280..71730201e 100644 --- a/kronolith/resources/groups/delete.php +++ b/kronolith/resources/groups/delete.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../../lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/DeleteResourceGroup.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/groups/edit.php b/kronolith/resources/groups/edit.php index aa3b17a10..6aab3a815 100644 --- a/kronolith/resources/groups/edit.php +++ b/kronolith/resources/groups/edit.php @@ -8,7 +8,9 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../../lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('kronolith'); + require_once KRONOLITH_BASE . '/lib/Forms/EditResourceGroup.php'; // Exit if this isn't an authenticated administrative user. diff --git a/kronolith/resources/groups/index.php b/kronolith/resources/groups/index.php index f5fbd9e59..e7ead6df3 100644 --- a/kronolith/resources/groups/index.php +++ b/kronolith/resources/groups/index.php @@ -3,7 +3,9 @@ * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/../../lib/base.php'; + +require_once dirname(__FILE__) . '/../../lib/Application.php'; +Horde_Registry::appInit('kronolith'); $title = _("Resource Groups"); @@ -86,4 +88,4 @@ function shorten_url($url, $separator = '...', $first_chunk_length = 35, $last_c return $url; } ?> - \ No newline at end of file + diff --git a/kronolith/resources/index.php b/kronolith/resources/index.php index 61141cfa6..30b4d7e1f 100644 --- a/kronolith/resources/index.php +++ b/kronolith/resources/index.php @@ -3,7 +3,9 @@ * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ -require_once dirname(__FILE__) . '/../lib/base.php'; + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('kronolith'); $title = _("Edit resources"); @@ -85,4 +87,4 @@ function shorten_url($url, $separator = '...', $first_chunk_length = 35, $last_c return $url; } ?> - \ No newline at end of file + diff --git a/kronolith/scripts/agenda.php b/kronolith/scripts/agenda.php index b6ab743f9..e3af94730 100755 --- a/kronolith/scripts/agenda.php +++ b/kronolith/scripts/agenda.php @@ -9,8 +9,8 @@ * @author Chuck Hagenbuch */ -$kronolith_authentication = 'none'; -require_once dirname(__FILE__) . '/../lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none')); // Make sure no one runs this from the web. if (!Horde_Cli::runningFromCLI()) { diff --git a/kronolith/scripts/import_squirrelmail_calendar.php b/kronolith/scripts/import_squirrelmail_calendar.php index a813ba1eb..5b46ec25e 100755 --- a/kronolith/scripts/import_squirrelmail_calendar.php +++ b/kronolith/scripts/import_squirrelmail_calendar.php @@ -15,7 +15,7 @@ */ // Do CLI checks and environment setup first. -require_once dirname(__FILE__) . '/../../lib/core.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; // Makre sure no one runs this from the web. if (!Horde_Cli::runningFromCli()) { @@ -37,16 +37,7 @@ $dsn = $argv[1]; $default_tz = date_default_timezone_get(); // Make sure we load Horde base to get the auth config -$horde_authentication = 'none'; -require_once HORDE_BASE . '/lib/base.php'; -if ($conf['auth']['admins']) { - Horde_Auth::setAuth($conf['auth']['admins'][0], array()); -} - -// Now that we are authenticated, we can load Kronolith's base. Otherwise, the -// share code breaks, causing a new, completely empty share to be created with -// no owner. -require_once dirname(__FILE__) . '/../lib/base.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'user' => $conf['auth']['admins'] ? $conf['auth']['admins'][0] : array())); // Connect to database. $db = DB::connect($dsn); diff --git a/kronolith/scripts/upgrades/convert_to_utc.php b/kronolith/scripts/upgrades/convert_to_utc.php index aedc80b48..891166721 100755 --- a/kronolith/scripts/upgrades/convert_to_utc.php +++ b/kronolith/scripts/upgrades/convert_to_utc.php @@ -5,8 +5,7 @@ */ /* Set up the CLI environment. */ -require_once dirname(__FILE__) . '/../../lib/base.load.php'; -require_once HORDE_BASE . '/lib/core.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; if (!Horde_Cli::runningFromCLI()) { exit("Must be run from the command line\n"); } @@ -14,8 +13,7 @@ $cli = Horde_Cli::singleton(); $cli->init(); /* Load required libraries. */ -$kronolith_authentication = 'none'; -require_once KRONOLITH_BASE . '/../../lib/base.php'; +Horde_Registry::appInit('kronolith', array('authentication' => 'none')); /* Prepare DB stuff. */ PEAR::staticPushErrorHandling(PEAR_ERROR_DIE); diff --git a/kronolith/search.php b/kronolith/search.php index 196a69f18..387b53f1c 100644 --- a/kronolith/search.php +++ b/kronolith/search.php @@ -8,7 +8,8 @@ * @author Meilof Veeningen */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); /* Get search parameters. */ $search_mode = Horde_Util::getFormData('search_mode', 'basic'); diff --git a/kronolith/view.php b/kronolith/view.php index 32aff648a..87be97b62 100644 --- a/kronolith/view.php +++ b/kronolith/view.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView(Horde_Util::getFormData('view')); if ($view) { diff --git a/kronolith/week.php b/kronolith/week.php index 3971ecaa7..c07cc9f3f 100644 --- a/kronolith/week.php +++ b/kronolith/week.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView('Week'); $title = sprintf(_("Week %d"), $view->week); diff --git a/kronolith/workweek.php b/kronolith/workweek.php index df45e195c..c5a51c288 100644 --- a/kronolith/workweek.php +++ b/kronolith/workweek.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView('WorkWeek'); $title = sprintf(_("Week %d"), $view->week); diff --git a/kronolith/year.php b/kronolith/year.php index ddf6c42a9..5db8cde3b 100644 --- a/kronolith/year.php +++ b/kronolith/year.php @@ -9,7 +9,8 @@ * @package Kronolith */ -require_once dirname(__FILE__) . '/lib/base.php'; +require_once dirname(__FILE__) . '/lib/Application.php'; +Horde_Registry::appInit('kronolith'); $view = Kronolith::getView('Year'); $title = $view->year;