Update gollem to new Horde_Registry_Application format
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 14 Jan 2010 21:55:14 +0000 (14:55 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 15 Jan 2010 06:54:35 +0000 (23:54 -0700)
gollem/clipboard.php
gollem/edit.php
gollem/lib/Application.php
gollem/lib/Block/tree_menu.php
gollem/manager.php
gollem/permissions.php
gollem/quota.php

index b401fc2..fc0a513 100644 (file)
@@ -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');
 
index 4d4f743..bd9121f 100644 (file)
@@ -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');
index 02d0565..8409b5c 100644 (file)
@@ -1,4 +1,19 @@
 <?php
+/**
+ * Gollem 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.
+ *
+ * @author  Amith Varghese (amith@xalan.com)
+ * @author  Michael Slusarz (slusarz@curecanti.org)
+ * @author  Ben Klang (bklang@alkaloid.net)
+ * @package Gollem
+ */
+
 /* Determine the base directories. */
 if (!defined('GOLLEM_BASE')) {
     define('GOLLEM_BASE', dirname(__FILE__) . '/..');
@@ -18,17 +33,6 @@ if (!defined('HORDE_BASE')) {
  *  Horde_Registry_Application::). */
 require_once HORDE_BASE . '/lib/core.php';
 
-/**
- * Gollem application API.
- *
- * This file defines Gollem's external API interface. Other
- * applications can interact with Gollem through this API.
- *
- * @author  Amith Varghese (amith@xalan.com)
- * @author  Michael Slusarz (slusarz@curecanti.org)
- * @author  Ben Klang (bklang@alkaloid.net)
- * @package Gollem
- */
 class Gollem_Application extends Horde_Registry_Application
 {
     /**
@@ -39,96 +43,26 @@ class Gollem_Application extends Horde_Registry_Application
     public $version = 'H4 (2.0-git)';
 
     /**
-     * The auth type to use.
-     *
-     * @var string
-     */
-    static public $authType = null;
-
-    /**
-     * Disable compression of pages?
-     *
-     * @var boolean
-     */
-    static public $noCompress = false;
-
-    /**
-     * Constructor.
-
-     * @param array $args  The following entries:
-     * <pre>
-     * 'init' - (boolean|array) If true, perform application init. If an
-     *          array, perform application init and pass the array to init().
-     * </pre>
-     */
-    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:
-     * <pre>
-     * '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
-     * </pre>
+     * 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.
index 75a993e..1169183 100644 (file)
@@ -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');
index 88ba7f2..02bf714 100644 (file)
@@ -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'];
index 89116a3..d5ac801 100644 (file)
@@ -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);
index f19307f..7111408 100644 (file)
@@ -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');