base.php => Application.php
authorJan Schneider <jan@horde.org>
Thu, 4 Feb 2010 22:49:53 +0000 (23:49 +0100)
committerJan Schneider <jan@horde.org>
Thu, 4 Feb 2010 22:49:53 +0000 (23:49 +0100)
timeobjects/lib/Api.php
timeobjects/lib/Application.php
timeobjects/lib/base.php [deleted file]

index fbe7e4d..a683ab1 100644 (file)
@@ -25,8 +25,6 @@ class Timeobjects_Api extends Horde_Registry_Api
      */
     public function listTimeObjectCategories()
     {
-        require_once dirname(__FILE__) . '/base.php';
-
         // @TODO: Probably want to iterate the driver directory
         //        and dynamically build this list and/or maybe provide
         //        a $conf[] setting to explicitly disable certain drivers?
@@ -56,8 +54,6 @@ class Timeobjects_Api extends Horde_Registry_Api
      */
     public function listTimeObjects($time_categories, $start, $end)
     {
-        require_once dirname(__FILE__) . '/base.php';
-
         $return = array();
         foreach ($time_categories as $category) {
             $drv = TimeObjects_Driver::factory($category);
index 5a2134f..6d48984 100644 (file)
@@ -1,4 +1,24 @@
 <?php
+
+/* Determine the base directories. */
+if (!defined('TIMEOBJECTS_BASE')) {
+    define('TIMEOBJECTS_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(TIMEOBJECTS_BASE . '/config/horde.local.php')) {
+        include TIMEOBJECTS_BASE . '/config/horde.local.php';
+    } else {
+        define('HORDE_BASE', TIMEOBJECTS_BASE . '/..');
+    }
+}
+
+/* Load the Horde Framework core (needed to autoload
+ *  Horde_Registry_Application::). */
+require_once HORDE_BASE . '/lib/core.php';
+
 class Timeobjects_Application extends Horde_Registry_Application
 {
     public $version = 'H4 (0.1-git)';
diff --git a/timeobjects/lib/base.php b/timeobjects/lib/base.php
deleted file mode 100644 (file)
index e301d4c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * Base inclusion file
- *
- */
-
-if (!defined('TIMEOBJECTS_BASE')) {
-    define('TIMEOBJECTS_BASE', dirname(__FILE__) . '/..');
-}
-
-// Check for a prior definition of HORDE_BASE.
-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(TIMEOBJECTS_BASE . '/config/horde.local.php')) {
-        include TIMEOBJECTS_BASE . '/config/horde.local.php';
-    } else {
-        define('HORDE_BASE', TIMEOBJECTS_BASE . '/..');
-    }
-}
-
-/* Load the Horde Framework core. */
-require_once HORDE_BASE . '/lib/core.php';
-
-/* Registry. */
-$session_control = Horde_Util::nonInputVar('session_control');
-if ($session_control == 'none') {
-    $registry = new Horde_Registry(Horde_Registry::SESSION_NONE);
-} elseif ($session_control == 'readonly') {
-    $registry = new Horde_Registry(Horde_Registry::SESSION_READONLY);
-} else {
-    $registry = new Horde_Registry();
-}
-
-try {
-    $registry->pushApp('timeobjects', array('logintasks' => true));
-} catch (Horde_Exception $e) {
-    Horde_Auth::authenticateFailure('timeobjects', $e);
-}