<?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__) . '/..');
* 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
{
/**
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.