From 6f73885ab4a9f0420e1707ef6483406c57d9ee54 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 31 Dec 2009 13:40:22 -0700 Subject: [PATCH] Remove Horde's base.php file --- horde/admin/alarms.php | 7 +- horde/admin/cmdshell.php | 7 +- horde/admin/datatree.php | 9 +-- horde/admin/groups.php | 9 +-- horde/admin/perms/addchild.php | 7 +- horde/admin/perms/delete.php | 7 +- horde/admin/perms/edit.php | 7 +- horde/admin/perms/index.php | 7 +- horde/admin/phpshell.php | 7 +- horde/admin/sessions.php | 7 +- horde/admin/setup/config.php | 10 +-- horde/admin/setup/diff.php | 7 +- horde/admin/setup/index.php | 7 +- horde/admin/setup/scripts.php | 7 +- horde/admin/signup_confirm.php | 2 +- horde/admin/sqlshell.php | 7 +- horde/admin/user.php | 6 +- horde/index.php | 5 +- horde/lib/Application.php | 93 ++++++++++++++++++++++ horde/lib/base.php | 67 ---------------- horde/login.php | 11 +-- horde/rampage.php | 3 +- horde/rpc.php | 16 ++-- horde/scripts/alarms.php | 3 +- horde/scripts/cookie_login.php | 4 +- horde/scripts/get_login.php | 4 +- horde/scripts/http_login_refer.php | 3 +- horde/scripts/import_squirrelmail_file_prefs.php | 5 +- horde/scripts/import_squirrelmail_sql_prefs.php | 4 +- .../upgrades/2008-04-09_horde_syncml_map.php | 5 +- .../upgrades/convert_datatree_groups_to_sql.php | 5 +- .../upgrades/convert_datatree_perms_to_sql.php | 3 +- horde/scripts/upgrades/migrate_user_categories.php | 4 +- .../upgrades/move_history_out_of_datatree.php | 7 +- horde/services/cache.php | 5 +- horde/services/cacheview.php | 4 +- horde/services/changepassword.php | 4 +- horde/services/confirm.php | 4 +- horde/services/facebook.php | 4 +- horde/services/go.php | 5 +- horde/services/help/index.php | 4 +- horde/services/images/view.php | 4 +- horde/services/imple.php | 13 +-- horde/services/javascript.php | 19 ++--- horde/services/keyboard.php | 4 +- horde/services/language.php | 3 +- horde/services/logintasks.php | 4 +- horde/services/obrowser/index.php | 3 +- horde/services/portal/cloud_search.php | 4 +- horde/services/portal/edit.php | 3 +- horde/services/portal/index.php | 3 +- horde/services/portal/mobile.php | 8 +- horde/services/portal/rpcsum.php | 3 +- horde/services/portal/sidebar.php | 4 +- horde/services/portal/syncml.php | 3 +- horde/services/problem.php | 4 +- horde/services/resetpassword.php | 4 +- horde/services/shares/edit.php | 17 ++-- horde/services/snooze.php | 4 +- horde/services/twitter.php | 3 +- horde/services/twitterapi.php | 4 +- horde/signup.php | 6 +- 62 files changed, 239 insertions(+), 273 deletions(-) delete mode 100644 horde/lib/base.php diff --git a/horde/admin/alarms.php b/horde/admin/alarms.php index dcba1d3e6..022b2efe5 100644 --- a/horde/admin/alarms.php +++ b/horde/admin/alarms.php @@ -8,11 +8,8 @@ * @author Jan Schneider */ -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(); diff --git a/horde/admin/cmdshell.php b/horde/admin/cmdshell.php index 010c99e05..65e4213cc 100644 --- a/horde/admin/cmdshell.php +++ b/horde/admin/cmdshell.php @@ -8,11 +8,8 @@ * @author Chuck Hagenbuch */ -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'; diff --git a/horde/admin/datatree.php b/horde/admin/datatree.php index 249843256..a883e4d0f 100644 --- a/horde/admin/datatree.php +++ b/horde/admin/datatree.php @@ -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); diff --git a/horde/admin/groups.php b/horde/admin/groups.php index e5b9f7722..7d52428cb 100644 --- a/horde/admin/groups.php +++ b/horde/admin/groups.php @@ -8,13 +8,10 @@ * @author Chuck Hagenbuch */ -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']); diff --git a/horde/admin/perms/addchild.php b/horde/admin/perms/addchild.php index acf637842..b11564bbe 100644 --- a/horde/admin/perms/addchild.php +++ b/horde/admin/perms/addchild.php @@ -9,11 +9,8 @@ * @author Jan Schneider */ -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(); diff --git a/horde/admin/perms/delete.php b/horde/admin/perms/delete.php index 18c97864c..244a32cd4 100644 --- a/horde/admin/perms/delete.php +++ b/horde/admin/perms/delete.php @@ -9,11 +9,8 @@ * @author Jan Schneider */ -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(); diff --git a/horde/admin/perms/edit.php b/horde/admin/perms/edit.php index d8471b4cf..cc46d0f4d 100644 --- a/horde/admin/perms/edit.php +++ b/horde/admin/perms/edit.php @@ -9,11 +9,8 @@ * @author Jan Schneider */ -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(); diff --git a/horde/admin/perms/index.php b/horde/admin/perms/index.php index dce25f891..faf2201f0 100644 --- a/horde/admin/perms/index.php +++ b/horde/admin/perms/index.php @@ -9,11 +9,8 @@ * @author Jan Schneider */ -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'); diff --git a/horde/admin/phpshell.php b/horde/admin/phpshell.php index e3db88060..e63f4cb90 100644 --- a/horde/admin/phpshell.php +++ b/horde/admin/phpshell.php @@ -8,11 +8,8 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/admin/sessions.php b/horde/admin/sessions.php index e3e080010..adb673cc5 100644 --- a/horde/admin/sessions.php +++ b/horde/admin/sessions.php @@ -8,11 +8,8 @@ * @author Chuck Hagenbuch */ -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') { diff --git a/horde/admin/setup/config.php b/horde/admin/setup/config.php index 3105183a0..70a5845ea 100644 --- a/horde/admin/setup/config.php +++ b/horde/admin/setup/config.php @@ -8,12 +8,8 @@ * @author Chuck Hagenbuch */ -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')) { diff --git a/horde/admin/setup/diff.php b/horde/admin/setup/diff.php index dfca461c5..cda5df180 100644 --- a/horde/admin/setup/diff.php +++ b/horde/admin/setup/diff.php @@ -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'); diff --git a/horde/admin/setup/index.php b/horde/admin/setup/index.php index 03039114a..74945b452 100644 --- a/horde/admin/setup/index.php +++ b/horde/admin/setup/index.php @@ -10,11 +10,8 @@ * @author Chuck Hagenbuch */ -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. diff --git a/horde/admin/setup/scripts.php b/horde/admin/setup/scripts.php index 14f32ffd0..362d75c8f 100644 --- a/horde/admin/setup/scripts.php +++ b/horde/admin/setup/scripts.php @@ -12,11 +12,8 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/admin/signup_confirm.php b/horde/admin/signup_confirm.php index 62bbc7523..7b8a9ffae 100644 --- a/horde/admin/signup_confirm.php +++ b/horde/admin/signup_confirm.php @@ -8,8 +8,8 @@ * @author Jan Schneider */ -$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']); diff --git a/horde/admin/sqlshell.php b/horde/admin/sqlshell.php index cd169fe87..5ca84d048 100644 --- a/horde/admin/sqlshell.php +++ b/horde/admin/sqlshell.php @@ -8,11 +8,8 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/admin/user.php b/horde/admin/user.php index ad9029845..ae50d4c20 100644 --- a/horde/admin/user.php +++ b/horde/admin/user.php @@ -8,11 +8,9 @@ * @author Chuck Hagenbuch */ -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']) { diff --git a/horde/index.php b/horde/index.php index 08310d831..ad8824984 100644 --- a/horde/index.php +++ b/horde/index.php @@ -10,9 +10,8 @@ * @author Chuck Hagenbuch */ -$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')); diff --git a/horde/lib/Application.php b/horde/lib/Application.php index 05420617e..b2bbdd12b 100644 --- a/horde/lib/Application.php +++ b/horde/lib/Application.php @@ -2,13 +2,106 @@ /** * 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: + *
+     * '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
+     * 
+ */ + 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 index 524380f07..000000000 --- a/horde/lib/base.php +++ /dev/null @@ -1,67 +0,0 @@ - - * $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 - * - * - * 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(); -} diff --git a/horde/login.php b/horde/login.php index 57672922a..7f49a84d2 100644 --- a/horde/login.php +++ b/horde/login.php @@ -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(); diff --git a/horde/rampage.php b/horde/rampage.php index 8fce3d459..84a086bdd 100644 --- a/horde/rampage.php +++ b/horde/rampage.php @@ -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(); diff --git a/horde/rpc.php b/horde/rpc.php index 854dd5fe5..07395d80e 100644 --- a/horde/rpc.php +++ b/horde/rpc.php @@ -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); diff --git a/horde/scripts/alarms.php b/horde/scripts/alarms.php index 3ec099835..a75115a83 100755 --- a/horde/scripts/alarms.php +++ b/horde/scripts/alarms.php @@ -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'])) { diff --git a/horde/scripts/cookie_login.php b/horde/scripts/cookie_login.php index 256a1245e..81986911a 100644 --- a/horde/scripts/cookie_login.php +++ b/horde/scripts/cookie_login.php @@ -8,8 +8,8 @@ * @author Jan Schneider */ -$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']); diff --git a/horde/scripts/get_login.php b/horde/scripts/get_login.php index 9031e6a7e..f05a695f3 100644 --- a/horde/scripts/get_login.php +++ b/horde/scripts/get_login.php @@ -8,8 +8,8 @@ * @author Joel Vandal */ -$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']); diff --git a/horde/scripts/http_login_refer.php b/horde/scripts/http_login_refer.php index 7d7687977..6dcfa9eb6 100644 --- a/horde/scripts/http_login_refer.php +++ b/horde/scripts/http_login_refer.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once '../lib/base.php'; +require_once dirname(__FILE__) . '/../lib/Application.php'; +new Horde_Application(); $auth = Horde_Auth::singleton($conf['auth']['driver']); diff --git a/horde/scripts/import_squirrelmail_file_prefs.php b/horde/scripts/import_squirrelmail_file_prefs.php index 28889a815..a98218d40 100755 --- a/horde/scripts/import_squirrelmail_file_prefs.php +++ b/horde/scripts/import_squirrelmail_file_prefs.php @@ -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 diff --git a/horde/scripts/import_squirrelmail_sql_prefs.php b/horde/scripts/import_squirrelmail_sql_prefs.php index 4c7378897..62ced204c 100755 --- a/horde/scripts/import_squirrelmail_sql_prefs.php +++ b/horde/scripts/import_squirrelmail_sql_prefs.php @@ -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. diff --git a/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php b/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php index 6c9a77a23..19b8be229 100755 --- a/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php +++ b/horde/scripts/upgrades/2008-04-09_horde_syncml_map.php @@ -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'), diff --git a/horde/scripts/upgrades/convert_datatree_groups_to_sql.php b/horde/scripts/upgrades/convert_datatree_groups_to_sql.php index 39d81dac6..9c5bd770c 100755 --- a/horde/scripts/upgrades/convert_datatree_groups_to_sql.php +++ b/horde/scripts/upgrades/convert_datatree_groups_to_sql.php @@ -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 = ' diff --git a/horde/scripts/upgrades/convert_datatree_perms_to_sql.php b/horde/scripts/upgrades/convert_datatree_perms_to_sql.php index 70448bdcc..177cc2260 100755 --- a/horde/scripts/upgrades/convert_datatree_perms_to_sql.php +++ b/horde/scripts/upgrades/convert_datatree_perms_to_sql.php @@ -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'); diff --git a/horde/scripts/upgrades/migrate_user_categories.php b/horde/scripts/upgrades/migrate_user_categories.php index 16fea1d12..a118b8522 100755 --- a/horde/scripts/upgrades/migrate_user_categories.php +++ b/horde/scripts/upgrades/migrate_user_categories.php @@ -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')); diff --git a/horde/scripts/upgrades/move_history_out_of_datatree.php b/horde/scripts/upgrades/move_history_out_of_datatree.php index 61ff5fb9f..0209fab42 100755 --- a/horde/scripts/upgrades/move_history_out_of_datatree.php +++ b/horde/scripts/upgrades/move_history_out_of_datatree.php @@ -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); diff --git a/horde/services/cache.php b/horde/services/cache.php index efe089215..8c20bd458 100644 --- a/horde/services/cache.php +++ b/horde/services/cache.php @@ -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': diff --git a/horde/services/cacheview.php b/horde/services/cacheview.php index f8c025235..253ada1b3 100644 --- a/horde/services/cacheview.php +++ b/horde/services/cacheview.php @@ -8,8 +8,8 @@ * @author Chuck Hagenbuch */ -$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)) { diff --git a/horde/services/changepassword.php b/horde/services/changepassword.php index 9a9ceeb3b..7f9ebe624 100644 --- a/horde/services/changepassword.php +++ b/horde/services/changepassword.php @@ -8,8 +8,8 @@ * @author Jason Felice */ -$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']); diff --git a/horde/services/confirm.php b/horde/services/confirm.php index d80542ca7..650d84159 100644 --- a/horde/services/confirm.php +++ b/horde/services/confirm.php @@ -8,8 +8,8 @@ * @author Jan Schneider */ -$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')); diff --git a/horde/services/facebook.php b/horde/services/facebook.php index 908ea8228..c29ce2f56 100644 --- a/horde/services/facebook.php +++ b/horde/services/facebook.php @@ -9,7 +9,9 @@ * * @author Michael J. Rubinsky */ -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']) || diff --git a/horde/services/go.php b/horde/services/go.php index 9b7f4e094..d65bb449a 100644 --- a/horde/services/go.php +++ b/horde/services/go.php @@ -12,9 +12,8 @@ * @author Marko Djukic */ -$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; diff --git a/horde/services/help/index.php b/horde/services/help/index.php index ca6184453..80807bdfe 100644 --- a/horde/services/help/index.php +++ b/horde/services/help/index.php @@ -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"); diff --git a/horde/services/images/view.php b/horde/services/images/view.php index c846865ed..1a7a02286 100644 --- a/horde/services/images/view.php +++ b/horde/services/images/view.php @@ -10,8 +10,8 @@ * @author Marko Djukic */ -$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. diff --git a/horde/services/imple.php b/horde/services/imple.php index ac8526346..27faf720a 100644 --- a/horde/services/imple.php +++ b/horde/services/imple.php @@ -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']) diff --git a/horde/services/javascript.php b/horde/services/javascript.php index b42bea91f..f65fb8ebc 100644 --- a/horde/services/javascript.php +++ b/horde/services/javascript.php @@ -8,9 +8,8 @@ * @author Chuck Hagenbuch */ -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; } } diff --git a/horde/services/keyboard.php b/horde/services/keyboard.php index c774031a2..cb0686ec5 100644 --- a/horde/services/keyboard.php +++ b/horde/services/keyboard.php @@ -8,8 +8,8 @@ * @author Chuck Hagenbuch */ -$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'; diff --git a/horde/services/language.php b/horde/services/language.php index cd10bf5bf..d205bce74 100644 --- a/horde/services/language.php +++ b/horde/services/language.php @@ -10,7 +10,8 @@ * @author Marko Djukic */ -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(); diff --git a/horde/services/logintasks.php b/horde/services/logintasks.php index 9acd2618c..838bbca17 100644 --- a/horde/services/logintasks.php +++ b/horde/services/logintasks.php @@ -11,8 +11,8 @@ * @author Michael Slusarz */ -$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')))) { diff --git a/horde/services/obrowser/index.php b/horde/services/obrowser/index.php index 3d6b03505..5a31ae3c2 100644 --- a/horde/services/obrowser/index.php +++ b/horde/services/obrowser/index.php @@ -8,7 +8,8 @@ * @author Chuck Hagenbuch */ -require_once dirname(__FILE__) . '/../../lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +new Horde_Application(); $path = Horde_Util::getFormData('path'); diff --git a/horde/services/portal/cloud_search.php b/horde/services/portal/cloud_search.php index cb3d50b3e..172fbe305 100644 --- a/horde/services/portal/cloud_search.php +++ b/horde/services/portal/cloud_search.php @@ -14,8 +14,8 @@ * @author Michael J. Rubinksy */ -$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. diff --git a/horde/services/portal/edit.php b/horde/services/portal/edit.php index 014e2834b..b97f873fa 100644 --- a/horde/services/portal/edit.php +++ b/horde/services/portal/edit.php @@ -10,7 +10,8 @@ * @author Jan Schneider */ -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'); diff --git a/horde/services/portal/index.php b/horde/services/portal/index.php index d45a74aa4..7c384f0fa 100644 --- a/horde/services/portal/index.php +++ b/horde/services/portal/index.php @@ -8,7 +8,8 @@ * @author Mike Cochrane */ -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(); diff --git a/horde/services/portal/mobile.php b/horde/services/portal/mobile.php index aa34bd33b..5a9df8357 100644 --- a/horde/services/portal/mobile.php +++ b/horde/services/portal/mobile.php @@ -8,12 +8,8 @@ * @author Chuck Hagenbuch */ -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'); diff --git a/horde/services/portal/rpcsum.php b/horde/services/portal/rpcsum.php index a8af20ba6..6e4c50739 100644 --- a/horde/services/portal/rpcsum.php +++ b/horde/services/portal/rpcsum.php @@ -8,7 +8,8 @@ * @author Jan Schneider */ -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)) { diff --git a/horde/services/portal/sidebar.php b/horde/services/portal/sidebar.php index ca5b071f2..72794887c 100644 --- a/horde/services/portal/sidebar.php +++ b/horde/services/portal/sidebar.php @@ -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(); diff --git a/horde/services/portal/syncml.php b/horde/services/portal/syncml.php index 7d985ae8d..697993606 100644 --- a/horde/services/portal/syncml.php +++ b/horde/services/portal/syncml.php @@ -8,7 +8,8 @@ * @author Karsten Fourmont */ -require_once dirname(__FILE__) . '/../../lib/base.php'; +require_once dirname(__FILE__) . '/../../lib/Application.php'; +new Horde_Application(); $backend = SyncML_Backend::factory('Horde'); diff --git a/horde/services/problem.php b/horde/services/problem.php index 023e2483b..cf1a1e71f 100644 --- a/horde/services/problem.php +++ b/horde/services/problem.php @@ -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(); diff --git a/horde/services/resetpassword.php b/horde/services/resetpassword.php index 221ae8c18..33601e65c 100644 --- a/horde/services/resetpassword.php +++ b/horde/services/resetpassword.php @@ -8,8 +8,8 @@ * @author Marko Djukic */ -$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']); diff --git a/horde/services/shares/edit.php b/horde/services/shares/edit.php index e306bb4cb..745a77c2a 100644 --- a/horde/services/shares/edit.php +++ b/horde/services/shares/edit.php @@ -8,6 +8,14 @@ * @author Chuck Hagenbuch */ +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(); diff --git a/horde/services/snooze.php b/horde/services/snooze.php index 238116a01..eb2b35410 100644 --- a/horde/services/snooze.php +++ b/horde/services/snooze.php @@ -8,8 +8,8 @@ * @author Jan Schneider */ -$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'); diff --git a/horde/services/twitter.php b/horde/services/twitter.php index 58195f83b..8f306896a 100644 --- a/horde/services/twitter.php +++ b/horde/services/twitter.php @@ -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'); diff --git a/horde/services/twitterapi.php b/horde/services/twitterapi.php index f12ce3080..08a5c07fe 100644 --- a/horde/services/twitterapi.php +++ b/horde/services/twitterapi.php @@ -13,8 +13,8 @@ * @author Ben Klang */ -$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']); diff --git a/horde/signup.php b/horde/signup.php index 26373f7f2..fbf6d84e2 100644 --- a/horde/signup.php +++ b/horde/signup.php @@ -8,9 +8,8 @@ * @author Marko Djukic */ -$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); -- 2.11.0