From: Michael M Slusarz Date: Thu, 14 Jan 2010 21:55:14 +0000 (-0700) Subject: Update gollem to new Horde_Registry_Application format X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=db1627e147e8c7084904b2ccf45c236ddbcc13bf;p=horde.git Update gollem to new Horde_Registry_Application format --- diff --git a/gollem/clipboard.php b/gollem/clipboard.php index b401fc273..fc0a513a5 100644 --- a/gollem/clipboard.php +++ b/gollem/clipboard.php @@ -12,7 +12,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new Gollem_Application(array('init' => true)); +Horde_Registry::appInit('gollem'); $dir = Horde_Util::getFormData('dir'); diff --git a/gollem/edit.php b/gollem/edit.php index 4d4f7439a..bd9121f0d 100644 --- a/gollem/edit.php +++ b/gollem/edit.php @@ -12,7 +12,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new Gollem_Application(array('init' => true)); +Horde_Registry::appInit('gollem'); $actionID = Horde_Util::getFormData('actionID'); $driver = Horde_Util::getFormData('driver'); diff --git a/gollem/lib/Application.php b/gollem/lib/Application.php index 02d05650d..8409b5c76 100644 --- a/gollem/lib/Application.php +++ b/gollem/lib/Application.php @@ -1,4 +1,19 @@ - * 'init' - (boolean|array) If true, perform application init. If an - * array, perform application init and pass the array to init(). - * - */ - public function __construct($args = array()) - { - if (!empty($args['init'])) { - $this->init(is_array($args['init']) ? $args['init'] : array()); - } - } - - /** - * Gollem base initialization. + * Gollem initialization. * * Global variables defined: * $gollem_backends - A link to the current list of available backends * $gollem_be - A link to the current backend parameters in the session * $gollem_vfs - A link to the current VFS object for the active backend + * $notification - Notification object * - * @param array $args Optional arguments: - *
-     * 'authentication' - (string) The type of authentication to use:
-     *   'horde' - Only use horde authentication
-     *   'none'  - Do not authenticate
-     *   [DEFAULT] - Authenticate to backend; on no auth redirect to
-     *               login screen
-     * 'nocompress' - (boolean) Controls whether the page should be
-     *                compressed.
-     * 'session_control' - (string) Sets special session control limitations:
-     *   'readonly' - Start session readonly
-     *   [DEFAULT] - Start read/write session
-     * 
+ * Global constants defined: + * GOLLEM_TEMPLATES - (string) Location of template files. */ - public function init($args = array()) + protected function _init() { - $args = array_merge(array( - 'authentication' => null, - 'nocompress' => false, - 'session_control' => null - ), $args); - - self::$authType = $args['authentication']; - self::$noCompress = $args['nocompress']; - - // Registry. - $s_ctrl = 0; - switch ($args['session_control']) { - case 'readonly': - $s_ctrl = Horde_Registry::SESSION_READONLY; - break; - } - - $GLOBALS['registry'] = Horde_Registry::singleton($s_ctrl); - - try { - $GLOBALS['registry']->pushApp('gollem', array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => true)); - } catch (Horde_Exception $e) { - Horde_Auth::authenticateFailure('gollem', $e); - } - if (!defined('GOLLEM_TEMPLATES')) { define('GOLLEM_TEMPLATES', $GLOBALS['registry']->get('templates')); } // Notification system. - $notification = Horde_Notification::singleton(); - $notification->attach('status'); - - // Start compression. - if (!self::$noCompress) { - Horde::compressOutput(); - } + $GLOBALS['notification'] = Horde_Notification::singleton(); + $GLOBALS['notification']->attach('status'); // Set the global $gollem_be variable to the current backend's // parameters. diff --git a/gollem/lib/Block/tree_menu.php b/gollem/lib/Block/tree_menu.php index 75a993ea3..116918325 100644 --- a/gollem/lib/Block/tree_menu.php +++ b/gollem/lib/Block/tree_menu.php @@ -20,12 +20,8 @@ class Horde_Block_gollem_tree_menu extends Horde_Block { function _buildTree(&$tree, $indent = 0, $parent = null) { - require_once dirname(__FILE__) . '/../Application.php'; - new Gollem_Application(array('init' => true)); - - return; - // TODO + return; $icondir = $GLOBALS['registry']->getImageDir(); $login_url = Horde::applicationUrl('login.php'); diff --git a/gollem/manager.php b/gollem/manager.php index 88ba7f274..02bf714db 100644 --- a/gollem/manager.php +++ b/gollem/manager.php @@ -14,7 +14,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new Gollem_Application(array('init' => true)); +Horde_Registry::appInit('gollem'); $actionID = Horde_Util::getFormData('actionID'); $backkey = $_SESSION['gollem']['backend_key']; diff --git a/gollem/permissions.php b/gollem/permissions.php index 89116a31f..d5ac801af 100644 --- a/gollem/permissions.php +++ b/gollem/permissions.php @@ -9,7 +9,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new Gollem_Application(array('init' => true)); +Horde_Registry::appInit('gollem'); if (!Horde_Auth::isAdmin()) { Horde_Auth::authenticateFailure('gollem', $e); diff --git a/gollem/quota.php b/gollem/quota.php index f19307f39..7111408d5 100644 --- a/gollem/quota.php +++ b/gollem/quota.php @@ -11,7 +11,7 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -new Gollem_Application(array('init' => true)); +Horde_Registry::appInit('gollem'); /* Is this a popup window? */ $isPopup = $browser->hasFeature('javascript');