Remove Horde's base.php file
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 31 Dec 2009 20:40:22 +0000 (13:40 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 31 Dec 2009 22:45:40 +0000 (15:45 -0700)
62 files changed:
horde/admin/alarms.php
horde/admin/cmdshell.php
horde/admin/datatree.php
horde/admin/groups.php
horde/admin/perms/addchild.php
horde/admin/perms/delete.php
horde/admin/perms/edit.php
horde/admin/perms/index.php
horde/admin/phpshell.php
horde/admin/sessions.php
horde/admin/setup/config.php
horde/admin/setup/diff.php
horde/admin/setup/index.php
horde/admin/setup/scripts.php
horde/admin/signup_confirm.php
horde/admin/sqlshell.php
horde/admin/user.php
horde/index.php
horde/lib/Application.php
horde/lib/base.php [deleted file]
horde/login.php
horde/rampage.php
horde/rpc.php
horde/scripts/alarms.php
horde/scripts/cookie_login.php
horde/scripts/get_login.php
horde/scripts/http_login_refer.php
horde/scripts/import_squirrelmail_file_prefs.php
horde/scripts/import_squirrelmail_sql_prefs.php
horde/scripts/upgrades/2008-04-09_horde_syncml_map.php
horde/scripts/upgrades/convert_datatree_groups_to_sql.php
horde/scripts/upgrades/convert_datatree_perms_to_sql.php
horde/scripts/upgrades/migrate_user_categories.php
horde/scripts/upgrades/move_history_out_of_datatree.php
horde/services/cache.php
horde/services/cacheview.php
horde/services/changepassword.php
horde/services/confirm.php
horde/services/facebook.php
horde/services/go.php
horde/services/help/index.php
horde/services/images/view.php
horde/services/imple.php
horde/services/javascript.php
horde/services/keyboard.php
horde/services/language.php
horde/services/logintasks.php
horde/services/obrowser/index.php
horde/services/portal/cloud_search.php
horde/services/portal/edit.php
horde/services/portal/index.php
horde/services/portal/mobile.php
horde/services/portal/rpcsum.php
horde/services/portal/sidebar.php
horde/services/portal/syncml.php
horde/services/problem.php
horde/services/resetpassword.php
horde/services/shares/edit.php
horde/services/snooze.php
horde/services/twitter.php
horde/services/twitterapi.php
horde/signup.php

index dcba1d3..022b2ef 100644 (file)
@@ -8,11 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $horde_alarm = Horde_Alarm::factory();
 $methods = array();
index 010c99e..65e4213 100644 (file)
@@ -8,11 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $title = _("Command Shell");
 require HORDE_TEMPLATES . '/common-header.inc';
index 2498432..a883e4d 100644 (file)
@@ -26,13 +26,10 @@ function addTree($parent, $parent_id, $indent = 1)
     }
 }
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-require_once 'Horde/DataTree.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
+require_once 'Horde/DataTree.php';
 $tree = Horde_Tree::factory('datatree', 'Html');
 $tree->setOption('alternate', true);
 
index e5b9f77..7d52428 100644 (file)
@@ -8,13 +8,10 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-require_once 'Horde/Group.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
+require_once 'Horde/Group.php';
 $groups = Group::singleton();
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
index acf6378..b11564b 100644 (file)
@@ -9,11 +9,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /* Set up the form variables. */
 $vars = Horde_Variables::getDefaultVariables();
index 18c9786..244a32c 100644 (file)
@@ -9,11 +9,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /* Set up the form variables. */
 $vars = Horde_Variables::getDefaultVariables();
index d8471b4..cc46d0f 100644 (file)
@@ -9,11 +9,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /* Set up the form variables. */
 $vars = &Horde_Variables::getDefaultVariables();
index dce25f8..faf2201 100644 (file)
@@ -9,11 +9,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $perm_id = Horde_Util::getFormData('perm_id');
 
index e3db880..e63f4cb 100644 (file)
@@ -8,11 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $title = _("PHP Shell");
 Horde::addScriptFile('stripe.js', 'horde');
index e3e0800..adb673c 100644 (file)
@@ -8,11 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    Horde::authenticationFailureRedirect();
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $type = !empty($conf['sessionhandler']['type']) ? $conf['sessionhandler']['type'] : 'none';
 if ($type == 'external') {
index 3105183..70a5845 100644 (file)
@@ -8,12 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-require_once 'Horde/Config.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 if (!Horde_Util::extensionExists('domxml') &&
     !Horde_Util::extensionExists('dom')) {
@@ -32,6 +28,8 @@ if (empty($app) || !in_array($app, $registry->listApps(array('inactive', 'hidden
 }
 
 $vars = Horde_Variables::getDefaultVariables();
+
+require_once 'Horde/Config.php';
 $form = new ConfigForm($vars, $app);
 $form->setButtons(sprintf(_("Generate %s Configuration"), $appname));
 if (file_exists($registry->get('fileroot', $app) . '/config/conf.bak.php')) {
index dfca461..cda5df1 100644 (file)
@@ -9,11 +9,8 @@
  * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /* Set up the diff renderer. */
 $render_type = Horde_Util::getFormData('render', 'inline');
index 0303911..74945b4 100644 (file)
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /**
  * Does an FTP upload to save the configuration.
index 14f32ff..362d75c 100644 (file)
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 /* Get form data. */
 $setup = Horde_Util::getFormData('setup');
index 62bbc75..7b8a9ff 100644 (file)
@@ -8,8 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-$horde_authentication = 'none';
 require_once dirname(__FILE__) . '/../lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
 
 // Make sure signups are enabled before proceeding
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
index cd169fe..5ca84d0 100644 (file)
@@ -8,11 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
-
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
 $title = _("SQL Shell");
 Horde::addScriptFile('stripe.js', 'horde');
index ad90298..ae50d4c 100644 (file)
@@ -8,11 +8,9 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('admin' => true));
 
-if (!Horde_Auth::isAdmin()) {
-    throw new Horde_Exception('Forbidden.');
-}
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
 if ($conf['signup']['allow'] && $conf['signup']['approve']) {
index 08310d8..ad88249 100644 (file)
@@ -10,9 +10,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-$horde_authentication = 'none';
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Horde_Application(array('authentication' => 'none', 'nologintasks' => true));
 
 $main_page = Horde_Util::nonInputVar('horde_login_url', Horde_Util::getFormData('url'));
 
index 0542061..b2bbdd1 100644 (file)
 /**
  * Horde 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 (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
  * @package Horde
  */
+
+/* Load the Horde Framework core (needed to autoload
+ * Horde_Registry_Application::). */
+require_once dirname(__FILE__) . '/core.php';
+
 class Horde_Application extends Horde_Registry_Application
 {
+    /**
+     * The application's version.
+     *
+     * @var string
+     */
     public $version = '4.0-git';
 
     /**
+     * Constructor.
+     *
+     * Global variables defined:
+     *   $notification - Notification object
+     *   $registry     - Registry object
+     *
+     * Global constants defined:
+     *   HORDE_TEMPLATES - (string) Location of template files.
+     *
+     * @param array $args  Optional arguments:
+     * <pre>
+     * 'admin' - (boolean) Require authenticated user to be and admin?
+     * 'authentication' - (string) The type of authentication to use:
+     *   'none'  - Do not authenticate
+     *   'throw' - Authenticate; on no auth, throw a Horde_Exception
+     *   [DEFAULT] - Authenticate; on no auth redirect to login screen
+     * 'nocompress' - (boolean) Controls whether the page should be
+     *                compressed.
+     * 'nologintasks' - (boolean) If set, don't perform logintasks (never
+     *                  performed if authentication is 'none').
+     * 'session_control' - (string) Sets special session control limitations:
+     *   'none' - Do not start a session
+     *   'readonly' - Start session readonly
+     *   [DEFAULT] - Start read/write session
+     * </pre>
+     */
+    public function __construct($args = array())
+    {
+        $args = array_merge(array(
+            'admin' => false,
+            'authentication' => null,
+            'nocompress' => false,
+            'nologintasks' => false,
+            'session_control' => null
+        ), $args);
+
+        // Registry.
+        $s_ctrl = 0;
+        switch ($args['session_control']) {
+        case 'none':
+            $s_ctrl = Horde_Registry::SESSION_NONE;
+            break;
+
+        case 'readonly':
+            $s_ctrl = Horde_Registry::SESSION_READONLY;
+            break;
+        }
+        $GLOBALS['registry'] = Horde_Registry::singleton($s_ctrl);
+
+        try {
+            $GLOBALS['registry']->pushApp('horde', array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => !$args['nologintasks']));
+
+            if ($args['admin'] && !Horde_Auth::isAdmin()) {
+                throw new Horde_Exception('Not an admin');
+            }
+        } catch (Horde_Exception $e) {
+            if ($args['authentication'] == 'throw') {
+                throw $e;
+            }
+
+            Horde_Auth::authenticateFailure('horde', $e);
+        }
+
+        if (!defined('HORDE_TEMPLATES')) {
+            define('HORDE_TEMPLATES', $GLOBALS['registry']->get('templates'));
+        }
+
+        $GLOBALS['notification'] = Horde_Notification::singleton();
+        $GLOBALS['notification']->attach('status');
+
+        // Start compression.
+        if (!$args['nocompress']) {
+            Horde::compressOutput();
+        }
+    }
+
+    /**
      * Returns a list of available permissions.
      */
     public function perms()
diff --git a/horde/lib/base.php b/horde/lib/base.php
deleted file mode 100644 (file)
index 524380f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * Horde base inclusion file.
- *
- * This file brings in all of the dependencies that Horde framework-level
- * scripts will need, and sets up objects that all scripts use.
- *
- * The following global variables are used:
- * <pre>
- * $horde_authentication - The type of authentication to use:
- *   'ignore' - Authenticate; on no auth, ignore error
- *   'none' - Do not authenticate
- *   [DEFAULT] - Authenticate; on no auth, redirect to login screen
- * $horde_no_compress - Controls whether the page should be compressed
- * $horde_no_logintasks - Don't perform logintasks (logintasks are never
- *                        performend if $horde_authentication == 'none')
- * $horde_session_control - Sets special session control limitations:
- *   'none' - Do not start a session
- *   'readonly' - Start session readonly
- *   [DEFAULT] - Start read/write session
- * </pre>
- *
- * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- */
-
-// Load the Horde Framework core, and set up inclusion paths.
-require_once dirname(__FILE__) . '/core.php';
-
-// Registry.
-$s_ctrl = 0;
-switch (Horde_Util::nonInputVar('horde_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);
-
-$authentication = Horde_Util::nonInputVar('horde_authentication');
-try {
-    $registry->pushApp('horde', array('check_perms' => ($authentication != 'none'), 'logintasks' => (($authentication != 'none') && !Horde_Util::nonInputVar('horde_no_logintasks'))));
-} catch (Horde_Exception $e) {
-    if (($e->getCode() == Horde_Registry::AUTH_FAILURE) &&
-        ($authentication == 'ignore')) {
-        /* Push app without doing checks. */
-        $registry->pushApp('horde', array('check_perms' => false));
-    } else {
-        Horde_Auth::authenticateFailure('horde', $e);
-    }
-}
-$conf = &$GLOBALS['conf'];
-@define('HORDE_TEMPLATES', $registry->get('templates'));
-
-// Notification System.
-$notification = Horde_Notification::singleton();
-$notification->attach('status');
-
-// Compress output
-if (!Horde_Util::nonInputVar('horde_no_compress')) {
-    Horde::compressOutput();
-}
index 5767292..7f49a84 100644 (file)
@@ -73,11 +73,12 @@ function _getLogoutReasonString($code)
 
 /* Try to login - if we are doing auth to an app, we need to auth to
  * Horde first or else we will lose the session. Ignore any auth errors.
- * Transparent authentication is handled by the Horde_Registry::pushApp() call
- * in base.php. */
-$horde_authentication = 'ignore';
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/lib/base.php';
+ * Transparent authentication is handled by the Horde_Application::
+ * constructor. */
+require_once dirname(__FILE__) . '/lib/Application.php';
+try {
+    new Horde_Application(array('authentication' => 'throw', 'nologintasks' => true));
+} catch (Horde_Exception $e) {}
 
 $app = Horde_Util::getFormData('app');
 $is_auth = Horde_Auth::getAuth();
index 8fce3d4..84a086b 100644 (file)
@@ -23,7 +23,8 @@
  * no nested components?
  */
 
-require_once dirname(__FILE__) . '/lib/base.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Horde_Application();
 
 // Set up our request and routing objects
 $request = new Horde_Controller_Request_Http();
index 854dd5f..07395d8 100644 (file)
@@ -19,7 +19,8 @@
 
 require_once dirname(__FILE__) . '/lib/core.php';
 
-$input = null;
+$input = $session_control = null;
+$nocompress = false;
 $params = array();
 
 /* Look at the Content-type of the request, if it is available, to try
@@ -31,13 +32,13 @@ if (!empty($_SERVER['PATH_INFO']) ||
     if (strpos($_SERVER['CONTENT_TYPE'], 'application/vnd.syncml+xml') !== false) {
         $serverType = 'Syncml';
         /* Syncml does its own session handling. */
-        $horde_session_control = 'none';
-        $horde_no_compress = true;
+        $session_control = 'none';
+        $nocompress = true;
     } elseif (strpos($_SERVER['CONTENT_TYPE'], 'application/vnd.syncml+wbxml') !== false) {
         $serverType = 'Syncml_Wbxml';
         /* Syncml does its own session handling. */
-        $horde_session_control = 'none';
-        $horde_no_compress = true;
+        $session_control = 'none';
+        $nocompress = true;
     } elseif (strpos($_SERVER['CONTENT_TYPE'], 'text/xml') !== false) {
         $input = Horde_Rpc::getInput();
         /* Check for SOAP namespace URI. */
@@ -61,7 +62,7 @@ if (!empty($_SERVER['PATH_INFO']) ||
 if ($serverType == 'Soap' &&
     (!isset($_SERVER['REQUEST_METHOD']) ||
      $_SERVER['REQUEST_METHOD'] != 'POST')) {
-    $horde_session_control = 'none';
+    $session_control = 'none';
     $params['requireAuthorization'] = false;
     if (Horde_Util::getGet('wsdl') !== null) {
         $input = 'wsdl';
@@ -77,8 +78,7 @@ if (($ra = Horde_Util::getGet('requestMissingAuthorization')) !== null) {
 }
 
 /* Load base libraries. */
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none', 'nocompress' => $nocompress, 'session_control' => $session_control));
 
 /* Load the RPC backend based on $serverType. */
 $server = Horde_Rpc::factory($serverType, $params);
index 3ec0998..a75115a 100755 (executable)
@@ -22,8 +22,7 @@ if (!Horde_Cli::runningFromCLI()) {
 Horde_Cli::init();
 
 // Include needed libraries.
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
 
 // Authenticate as administrator.
 if (!count($conf['auth']['admins'])) {
index 256a124..8198691 100644 (file)
@@ -8,8 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
index 9031e6a..f05a695 100644 (file)
@@ -8,8 +8,8 @@
  * @author Joel Vandal <joel@scopserv.com>
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
index 7d76879..6dcfa9e 100644 (file)
@@ -8,7 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once '../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application();
 
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
index 28889a8..a98218d 100755 (executable)
@@ -38,8 +38,9 @@ if ($argc != 2) {
 $data = $argv[1];
 
 // Make sure we load Horde base to get the auth config
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
+
 require_once dirname(__FILE__) . '/import_squirrelmail_prefs.php';
 
 // Get list of SquirrelMail pref files
index 4c73788..62ced20 100755 (executable)
@@ -37,8 +37,8 @@ if ($argc != 2) {
 $dsn = $argv[1];
 
 // Make sure we load Horde base to get the auth config
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
+
 require_once dirname(__FILE__) . '/import_squirrelmail_prefs.php';
 
 // Connect to database.
index 6c9a77a..19b8be2 100755 (executable)
@@ -18,10 +18,9 @@ if (!Horde_Cli::runningFromCLI()) {
 Horde_Cli::init();
 $cli = Horde_Cli::singleton();
 
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
-require_once 'Horde/DataTree.php';
+new Horde_Application(array('authentication' => 'none'));
 
+require_once 'Horde/DataTree.php';
 $datatree = DataTree::factory('sql',
                               array_merge(
                                   Horde::getDriverConfig('datatree', 'sql'),
index 39d81da..9c5bd77 100755 (executable)
@@ -7,7 +7,6 @@
 
 // Do CLI checks and environment setup first.
 require_once dirname(__FILE__) . '/../../lib/core.php';
-require_once 'Horde/Group.php';
 
 // Make sure no one runs this from the web.
 if (!Horde_Cli::runningFromCLI()) {
@@ -18,9 +17,9 @@ if (!Horde_Cli::runningFromCLI()) {
 // some variables, etc.
 Horde_Cli::init();
 
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
 
+require_once 'Horde/Group.php';
 $g = Group::factory();
 
 $group_query = '
index 70448bd..177cc22 100755 (executable)
@@ -17,8 +17,7 @@ if (!Horde_Cli::runningFromCLI()) {
 // some variables, etc.
 Horde_Cli::init();
 
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
 
 $p = Perms::factory('datatree');
 
index 16fea1d..a118b85 100755 (executable)
@@ -20,8 +20,8 @@ if (!Horde_Cli::runningFromCLI()) {
 // some variables, etc.
 Horde_Cli::init();
 
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
+new Horde_Application(array('authentication' => 'none'));
+
 $cli = Horde_Cli::singleton();
 $cManager = new Horde_Prefs_CategoryManager();
 $apps = $registry->listApps(array('hidden', 'notoolbar', 'active', 'admin'));
index 61ff5fb..0209fab 100755 (executable)
@@ -21,13 +21,12 @@ $cli = Horde_Cli::singleton();
 $cli->writeln($cli->yellow("Beginning migration. This may take a very long time to complete."));
 $cli->writeln();
 
-$horde_authentication = 'none';
-require_once HORDE_BASE . '/lib/base.php';
-require_once 'Horde/DataTree.php';
+new Horde_Application(array('authentication' => 'none'));
 
+require_once 'Horde/DataTree.php';
 $datatree = DataTree::factory('sql', array_merge(Horde::getDriverConfig('datatree', 'sql'),
                                                  array('group' => 'horde.history')));
-$db = &$datatree->_db;
+$db = $datatree->_db;
 
 $cli->writeln('Fetching all history objects from the data tree.'); ob_flush();
 $objects = $db->getAll("SELECT c.datatree_id, c.datatree_name, c.datatree_parents, c.datatree_order FROM horde_datatree c WHERE c.group_uid = 'horde.history' order by datatree_id",DB_FETCHMODE_ASSOC);
index efe0892..8c20bd4 100644 (file)
@@ -40,9 +40,8 @@ if (empty($args['nocache'])) {
 } else {
     $session_cache_limiter = 'nocache';
 }
-$horde_no_logintasks = true;
-$horde_session_control = 'readonly';
-require_once HORDE_BASE . '/lib/base.php';
+
+new Horde_Application(array('authentication' => 'none', 'session_control' => 'readonly'));
 
 switch ($type) {
 case 'app':
index f8c0252..253ada1 100644 (file)
@@ -8,8 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 $cid = Horde_Util::getFormData('cid');
 if (empty($cid)) {
index 9a9ceeb..7f9ebe6 100644 (file)
@@ -8,8 +8,8 @@
  * @author Jason Felice <jason.m.felice@gmail.com>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 // Make sure auth backend allows passwords to be reset.
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
index d80542c..650d841 100644 (file)
@@ -8,8 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 $identity = Horde_Prefs_Identity::singleton();
 list($message, $type) = $identity->confirmIdentity(Horde_Util::getFormData('h'));
index 908ea82..c29ce2f 100644 (file)
@@ -9,7 +9,9 @@
  *
  * @author Michael J. Rubinsky <mrubinsk@horde.org>
  */
-require_once dirname(__FILE__) . '/../lib/base.php';
+
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application();
 
 if (empty($GLOBALS['conf']['facebook']['enabled']) ||
     empty($GLOBALS['conf']['facebook']['key']) ||
index 9b7f4e0..d65bb44 100644 (file)
@@ -12,9 +12,8 @@
  * @author Marko Djukic <marko@oblo.com>
  */
 
-$horde_authentication = 'none';
-$horde_session_control = 'none';
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none', 'session_control' => 'none'));
 
 if (empty($_GET['url'])) {
     exit;
index ca61844..80807bd 100644 (file)
@@ -6,8 +6,8 @@
  * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 $rtl = isset(Horde_Nls::$config['rtl'][$language]);
 $title = _("Help");
index c846865..1a7a022 100644 (file)
@@ -10,8 +10,8 @@
  * @author Marko Djukic <marko@oblo.com>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 /* Get file info. The following parameters are available:
  *  'f' - the filename.
index ac85263..27faf72 100644 (file)
@@ -58,21 +58,16 @@ if (!empty($args['post'])) {
     }
 }
 
-/* Determine if we can get away with a readonly session */
-if (empty($args['sessionWrite'])) {
-    $horde_session_control = 'readonly';
-}
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+new Horde_Application(array('nologintasks' => true, 'session_control' => empty($args['sessionWrite']) ? 'readonly' : null));
 
+$impleargs = $impleName;
 if (isset($args['impleApp'])) {
     $registry = Horde_Registry::singleton();
     $registry->pushApp($args['impleApp']);
-    $imple = Horde_Ajax_Imple::factory(array($args['impleApp'], $impleName));
-} else {
-    $imple = Horde_Ajax_Imple::factory($impleName);
+    $impleargs = array($args['impleApp'], $impleName);
 }
 
+$imple = Horde_Ajax_Imple::factory($impleargs);
 $result = $imple->handle($args, $post);
 
 $ct = empty($_SERVER['Content-Type'])
index b42bea9..f65fb8e 100644 (file)
@@ -8,9 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-$registry = Horde_Registry::singleton(Horde_Registry::SESSION_READONLY);
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('session_control' => 'readonly'));
 
 // Figure out if we've been inlined, or called directly.
 $send_headers = strstr($_SERVER['PHP_SELF'], 'javascript.php');
@@ -21,17 +20,9 @@ if (!empty($app) && !empty($file) && strpos($file, '..') === false) {
     $script_file = $registry->get('templates', $app) . '/javascript/' . $file;
     if (file_exists($script_file)) {
         $registry->pushApp($app, array('check_perms' => false));
-        $script = Horde_Util::bufferOutput('require', $script_file);
-
-        if ($send_headers) {
-            /* Compress the JS. We need this explicit call since we
-             * don't include base.php in this file. */
-            Horde::compressOutput();
-
-            header('Cache-Control: no-cache');
-            header('Content-Type: text/javascript');
-        }
 
-        echo $script;
+        header('Cache-Control: no-cache');
+        header('Content-Type: text/javascript');
+        require $script_file;
     }
 }
index c774031..cb0686e 100644 (file)
@@ -8,8 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 $title = _("Special Character Input");
 require HORDE_TEMPLATES . '/common-header.inc';
index cd10bf5..d205bce 100644 (file)
@@ -10,7 +10,8 @@
  * @author Marko Djukic <marko@oblo.com>
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application();
 
 /* Set the language. */
 $_SESSION['horde_language'] = Horde_Nls::select();
index 9acd261..838bbca 100644 (file)
@@ -11,8 +11,8 @@
  * @author Michael Slusarz <slusarz@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 /* If no 'module' parameter passed in, die with an error. */
 if (!($app = basename(Horde_Util::getFormData('app')))) {
index 3d6b035..5a31ae3 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';
+new Horde_Application();
 
 $path = Horde_Util::getFormData('path');
 
index cb3d50b..172fbe3 100644 (file)
@@ -14,8 +14,8 @@
  * @author Michael J. Rubinksy <mrubinsk@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('nologintaks' => true));
 
 // If/when more apps support the searchTags api calls, we should probably
 // find a better solution to putting the apps hardcoded like this.
index 014e283..b97f873 100644 (file)
@@ -10,7 +10,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
 
 // Instantiate the blocks objects.
 $blocks = Horde_Block_Collection::singleton('portal');
index d45a74a..7c384f0 100644 (file)
@@ -8,7 +8,8 @@
  * @author Mike Cochrane <mike@graftonhall.co.nz>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
 
 // Get full name.
 $identity = Horde_Prefs_Identity::singleton();
index aa34bd3..5a9df83 100644 (file)
@@ -8,12 +8,8 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
-
-if (!Horde_Auth::getAuth()) {
-    header('Location: ' . Horde_Util::addParameter(Horde::applicationUrl('login.php', true), 'url', Horde::selfUrl(), false));
-    exit;
-}
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
 
 $identity = Horde_Prefs_Identity::singleton();
 $fullname = $identity->getValue('fullname');
index a8af20b..6e4c507 100644 (file)
@@ -8,7 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
 
 $rpc_servers = @unserialize($prefs->getValue('remote_summaries'));
 if (!is_array($rpc_servers)) {
index ca5b071..7279488 100644 (file)
@@ -202,8 +202,8 @@ function buildMenu()
     return $menu;
 }
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 if (!Horde_Auth::getAuth() && !$conf['menu']['always']) {
     Horde_Auth::authenticateFailure();
index 7d985ae..6979936 100644 (file)
@@ -8,7 +8,8 @@
  * @author Karsten Fourmont <karsten@horde.org>
  */
 
-require_once dirname(__FILE__) . '/../../lib/base.php';
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
 
 $backend = SyncML_Backend::factory('Horde');
 
index 023e248..cf1a1e7 100644 (file)
@@ -16,8 +16,8 @@ function _returnToPage()
     exit;
 }
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 if (!Horde::showService('problem')) {
     _returnToPage();
index 221ae8c..33601e6 100644 (file)
@@ -8,8 +8,8 @@
  * @author Marko Djukic <marko@oblo.com>
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 // Make sure auth backend allows passwords to be reset.
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
index e306bb4..745a77c 100644 (file)
@@ -8,6 +8,14 @@
  * @author Chuck Hagenbuch <chuck@horde.org>
  */
 
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+new Horde_Application();
+
+// Exit if the user shouldn't be able to change share permissions.
+if (!empty($conf['share']['no_sharing'])) {
+    throw new Horde_Exception('Permission denied.');
+}
+
 $fieldsList = array(
     'show' => 0,
     'read' => 1,
@@ -15,15 +23,6 @@ $fieldsList = array(
     'delete' => 3
 );
 
-@define('HORDE_BASE', dirname(__FILE__) . '/../..');
-require_once dirname(__FILE__) . '/../../lib/base.php';
-require_once 'Horde/Group.php';
-
-// Exit if the user shouldn't be able to change share permissions.
-if (!empty($conf['share']['no_sharing'])) {
-    exit('permission denied');
-}
-
 $app = Horde_Util::getFormData('app');
 $shares = Horde_Share::singleton($app);
 $groups = Group::singleton();
index 238116a..eb2b354 100644 (file)
@@ -8,8 +8,8 @@
  * @author Jan Schneider <jan@horde.org>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 $alarm = Horde_Alarm::factory();
 $id = Horde_Util::getPost('alarm');
index 58195f8..8f30689 100644 (file)
@@ -9,7 +9,8 @@
  *
  */
 
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application();
 
 if (empty($GLOBALS['conf']['twitter']['enabled'])) {
     $horde_url = Horde::url($registry->get('webroot', 'horde') . '/index.php');
index f12ce30..08a5c07 100644 (file)
@@ -13,8 +13,8 @@
  * @author Ben Klang <ben@alkaloid.net>
  */
 
-$horde_no_logintasks = true;
-require_once dirname(__FILE__) . '/../lib/base.php';
+require_once dirname(__FILE__) . '/../lib/Application.php';
+new Horde_Application(array('nologintasks' => true));
 
 $twitter = new Services_Twitter($_SESSION['horde']['twitterblock']['username'],
                                 $_SESSION['horde']['twitterblock']['password']);
index 26373f7..fbf6d84 100644 (file)
@@ -8,9 +8,8 @@
  * @author Marko Djukic <marko@oblo.com>
  */
 
-$horde_authentication = 'none';
-require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Auth/Signup.php';
+require_once dirname(__FILE__) . '/lib/Application.php';
+new Horde_Application(array('authentication' => 'none'));
 
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 
@@ -31,6 +30,7 @@ if (is_a($signup, 'PEAR_Error')) {
 }
 
 $vars = Horde_Variables::getDefaultVariables();
+require_once 'Horde/Auth/Signup.php';
 $formsignup = new HordeSignupForm($vars);
 if ($formsignup->validate()) {
     $formsignup->getInfo($vars, $info);