File: base.php

package info (click to toggle)
kronolith 1.1.4-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,212 kB
  • ctags: 1,074
  • sloc: php: 4,187; sh: 724; xml: 522; makefile: 96; sql: 42; perl: 20
file content (76 lines) | stat: -rw-r--r-- 2,417 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
<?php
/**
 * Kronolith base inclusion file.
 *
 * $Horde: kronolith/lib/base.php,v 1.34.2.9 2003/05/08 21:16:33 chuck Exp $
 *
 * This file brings in all of the dependencies that every Kronolith
 * script will need, and sets up objects that all scripts use.
 */

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

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

// Browser detection library
require_once HORDE_BASE . '/lib/Browser.php';
$browser = &new Browser();
if ($browser->hasQuirk('cache_ssl_downloads')
    && isset($_SERVER['HTTPS'])
    && ($_SERVER['HTTPS'] == 'on')) {
    session_cache_limiter('private, must-revalidate');
}

// Registry
require_once HORDE_BASE . '/lib/Registry.php';
$registry = &Registry::singleton();
$registry->pushApp('kronolith');
$conf = &$GLOBALS['conf'];
@define('KRONOLITH_TEMPLATES', $registry->getParam('templates'));

// set error reporting according to config settings
error_reporting($conf['debug_level']);

// set max execution time according to config settings
set_time_limit($conf['max_exec_time']);

// Horde base libraries
require_once HORDE_BASE . '/lib/Horde.php';
require_once HORDE_BASE . '/lib/Auth.php';

// Kronolith base library
require_once KRONOLITH_BASE . '/lib/Kronolith.php';

// Don't allow access unless there is a Horde login
if (!Auth::getAuth()) {
    $url = Horde::url($registry->getParam('webroot', 'horde') . '/login.php', true);
    header('Location: ' . Kronolith::addParameter($url, 'url', $_SERVER['PHP_SELF']));
    exit;
}

// Help
require_once HORDE_BASE . '/lib/Help.php';

// Notification sytem
require_once HORDE_BASE . '/lib/Notification.php';
require_once KRONOLITH_BASE . '/lib/Notification/kronolith.php';
$notification = &Notification::singleton();
$notification->attach('status', null, 'Notification_status_kronolith');

// PEAR Date_Calc
require_once 'Date/Calc.php';

// Set the timezone variable, if available.
$timezone = $GLOBALS['prefs']->getValue('timezone');
if (!empty($timezone)) {
    putenv('TZ=' . $timezone);
}

// Open the users calendar
$GLOBALS['calendar'] = &Kronolith_Driver::factory($conf['calendar']['driver'], $conf['calendar']['params']);
if ($GLOBALS['calendar'] === false) {
    Horde::fatal(PEAR::raiseError(_("Unable to create calendar instance.")), __FILE__, __LINE__);
}
$GLOBALS['calendar']->open(Auth::getAuth());