File: base.php

package info (click to toggle)
gollem 1.0.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,416 kB
  • ctags: 433
  • sloc: php: 2,088; xml: 359; makefile: 74; sh: 11
file content (90 lines) | stat: -rw-r--r-- 2,967 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
 * Gollem base inclusion file. This file brings in all of the
 * dependencies that every Gollem script will need, and sets up
 * objects that all scripts use.
 *
 * The following variables, defined in the script that calls this one, are
 * used:
 *   $authentication   - The authentication mode to use.
 *   $no_compress      - Controls whether the page should be compressed.
 *   $session_control  - Sets special session control limitations.
 *
 * This file creates the following global variables:
 *   $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
 *
 * $Horde: gollem/lib/base.php,v 1.60 2005/03/22 06:37:54 slusarz Exp $
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

// Check for a prior definition of HORDE_BASE (perhaps by an
// auto_prepend_file definition for site customization).
if (!defined('HORDE_BASE')) {
    @define('HORDE_BASE', dirname(__FILE__) . '/../..');
}

// Load the Horde Framework core, and set up inclusion paths.
require_once HORDE_BASE . '/lib/core.php';

// Registry.
if (Util::nonInputVar('session_control') == 'readonly') {
    $registry = &Registry::singleton(HORDE_SESSION_READONLY);
} else {
    $registry = &Registry::singleton();
}

if (is_a(($pushed = $registry->pushApp('gollem', !defined('AUTH_HANDLER'))), 'PEAR_Error')) {
    if ($pushed->getCode() == 'permission_denied') {
        Horde::authenticationFailureRedirect();
    }
    Horde::fatal($pushed, __FILE__, __LINE__, false);
}
$conf = &$GLOBALS['conf'];
@define('GOLLEM_TEMPLATES', $registry->get('templates'));

// Notification system.
$notification = &Notification::singleton();
$notification->attach('status');

// Find the base file path of Gollem.
@define('GOLLEM_BASE', dirname(__FILE__) . '/..');

// If Gollem isn't responsible for Horde auth, and no one is logged into
// Horde, redirect to the login screen.
if (!(Auth::isAuthenticated() || (Auth::getProvider() == 'gollem'))) {
    Horde::authenticationFailureRedirect();
}

// Horde base libraries.
require_once 'Horde/Secret.php';

// VFS.
require_once 'VFS.php';

/* Set the global $gollem_be variable to the current backend's parameters. */
if (empty($_SESSION['gollem']['backend_key'])) {
    $GLOBALS['gollem_be'] = null;
} else {
    $GLOBALS['gollem_be'] = &$_SESSION['gollem']['backends'][$_SESSION['gollem']['backend_key']];
}

// Gollem base library.
require_once GOLLEM_BASE . '/lib/Gollem.php';
Gollem::loadBackendList();

// Help.
require_once 'Horde/Help.php';

// Start compression.
if (!Util::nonInputVar('no_compress')) {
    Horde::compressOutput();
}

$authentication = Util::nonInputVar('authentication');
if ($authentication !== 'none') {
    Gollem::checkAuthentication(true, $authentication);
}