Remove base.php stuff from Kronolith
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 14 Jan 2010 20:03:10 +0000 (13:03 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 15 Jan 2010 06:54:35 +0000 (23:54 -0700)
52 files changed:
kronolith/add.php
kronolith/ajax.php
kronolith/attend.php
kronolith/attendees.php
kronolith/calendars/create.php
kronolith/calendars/delete.php
kronolith/calendars/edit.php
kronolith/calendars/index.php
kronolith/calendars/info.php
kronolith/calendars/remote_edit.php
kronolith/calendars/remote_subscribe.php
kronolith/calendars/remote_unsubscribe.php
kronolith/contacts.php
kronolith/data.php
kronolith/day.php
kronolith/delete.php
kronolith/edit.php
kronolith/event.php
kronolith/fb.php
kronolith/feed/index.php
kronolith/index.php
kronolith/lib/Ajax/Imple/TagActions.php
kronolith/lib/Api.php
kronolith/lib/Application.php
kronolith/lib/Block/month.php
kronolith/lib/Block/monthlist.php
kronolith/lib/Block/prevmonthlist.php
kronolith/lib/Block/summary.php
kronolith/lib/Block/tree_alarms.php
kronolith/lib/Tagger.php
kronolith/lib/base.load.php [deleted file]
kronolith/lib/base.php [deleted file]
kronolith/lib/tests/toicalendar.phpt
kronolith/month.php
kronolith/new.php
kronolith/perms.php
kronolith/resources/create.php
kronolith/resources/delete.php
kronolith/resources/edit.php
kronolith/resources/groups/create.php
kronolith/resources/groups/delete.php
kronolith/resources/groups/edit.php
kronolith/resources/groups/index.php
kronolith/resources/index.php
kronolith/scripts/agenda.php
kronolith/scripts/import_squirrelmail_calendar.php
kronolith/scripts/upgrades/convert_to_utc.php
kronolith/search.php
kronolith/view.php
kronolith/week.php
kronolith/workweek.php
kronolith/year.php

index 8ff0d29..cbbac3a 100644 (file)
@@ -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');
index 2d6cd9f..6b1c1e5 100644 (file)
@@ -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('&amp;', '&', 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');
index a7046aa..18bf4dc 100644 (file)
@@ -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');
index ebf2c9b..78a41c7 100644 (file)
@@ -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']) &&
index 97370c4..00812c4 100644 (file)
@@ -8,8 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-@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
index 641cf04..070c79f 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index e966047..189eb7e 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index a57208e..d221ec0 100644 (file)
@@ -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()) {
index 48f6934..97b1a8b 100644 (file)
@@ -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()) {
index 59cc64b..29062c6 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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
index 2dbb048..9af9a75 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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
index 781da5a..fb2db13 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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
index 60746ea..011fdb4 100644 (file)
@@ -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();
index a6e087e..536a928 100644 (file)
@@ -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';
index 797cea1..91b286c 100644 (file)
@@ -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'));
index 03aeba9..6069b17 100644 (file)
@@ -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';
index 99e40e0..5c26d1b 100644 (file)
@@ -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();
 
index b886e08..80c3767 100644 (file)
@@ -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);
index e97e96c..2a4ff2d 100644 (file)
@@ -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');
index 027887b..af00ffb 100644 (file)
@@ -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);
index 06c5f28..e511f06 100644 (file)
@@ -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') ||
index af4fdb9..2a2b98d 100644 (file)
@@ -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'];
index f4382fe..3522a9b 100644 (file)
@@ -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"));
index 516b50a..595fe36 100644 (file)
@@ -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:
+     * <pre>
+     * 'user' - (string) Set authentication to this user.
+     * </pre>
+     */
+    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);
 
index 5646e84..6fa2157 100644 (file)
@@ -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']);
index 9d2df75..7119669 100644 (file)
@@ -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');
index 110ea8e..0ff2560 100644 (file)
@@ -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;
index 5cd1f4f..68b9df2 100644 (file)
@@ -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']);
index 931ce90..52b63c1 100644 (file)
@@ -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();
index 0e56552..4591233 100644 (file)
@@ -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 (file)
index 8cee3a5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Script to determine the correct *_BASE values.
- *
- * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
- *
- * 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
- */
-
-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 . '/..');
-    }
-}
diff --git a/kronolith/lib/base.php b/kronolith/lib/base.php
deleted file mode 100644 (file)
index 6e1ee20..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/**
- * Kronolith base inclusion file.
- *
- * This file brings in all of the dependencies that every Kronolith
- * script will need, and sets up objects that all scripts use.
- *
- * The following global variables are used:
- * <pre>
- * $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
- * </pre>
- *
- * @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();
index 6e788e2..d8049be 100644 (file)
@@ -3,11 +3,9 @@ Kronolith_Event::toiCalendar() test.
 --FILE--
 <?php
 
-require 'Horde/Cli.php';
+require dirname(__FILE__) . '/../Application.php';
 Horde_Cli::init();
-$kronolith_authentication = 'none';
-require dirname(__FILE__) . '/../base.php';
-require 'Horde/iCalendar.php';
+Horde_Registry::appInit('kronolith', array('authentication' => 'none'));
 
 $driver = new Kronolith_Driver();
 $object = new Kronolith_Event_Sql($driver);
index 454ee07..036fe96 100644 (file)
@@ -8,7 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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');
index 3f89eab..b4c7724 100644 (file)
@@ -8,7 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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)
index 746c6a8..796734b 100644 (file)
@@ -9,7 +9,9 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-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');
index 8dfc94c..fa7df5c 100644 (file)
@@ -8,8 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-@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
index 55a8c23..cc172d6 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index 65e3884..6babaf1 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index e967e48..4c9f8cf 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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
index bae7782..7173020 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index aa3b17a..6aab3a8 100644 (file)
@@ -8,7 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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.
index f5fbd9e..e7ead6d 100644 (file)
@@ -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;
 }
 ?>
-</div>
\ No newline at end of file
+</div>
index 61141cf..30b4d7e 100644 (file)
@@ -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;
 }
 ?>
-</div>
\ No newline at end of file
+</div>
index b6ab743..e3af947 100755 (executable)
@@ -9,8 +9,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-$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()) {
index a813ba1..5b46ec2 100755 (executable)
@@ -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);
index aedc80b..8911667 100755 (executable)
@@ -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);
index 196a69f..387b53f 100644 (file)
@@ -8,7 +8,8 @@
  * @author Meilof Veeningen <meilof@gmail.com>
  */
 
-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');
index 32aff64..87be97b 100644 (file)
@@ -8,7 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-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) {
index 3971eca..c07cc9f 100644 (file)
@@ -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);
index df45e19..c5a51c2 100644 (file)
@@ -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);
index ddf6c42..5db8cde 100644 (file)
@@ -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;