File: core.php

package info (click to toggle)
php-horde 5.2.1%2Bdebian0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 12,196 kB
  • sloc: php: 11,089; xml: 6,460; sh: 96; makefile: 33; sql: 1
file content (70 lines) | stat: -rw-r--r-- 2,438 bytes parent folder | download | duplicates (2)
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
<?php
/**
 * Horde Application Framework core services file.
 *
 * This file sets up any necessary include path variables and includes
 * the minimum required Horde libraries.
 *
 * Copyright 1999-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL-2). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl.
 *
 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl LGPL-2
 * @package  Horde
 */

/* Turn PHP stuff off that can really screw things up. */
ini_set('allow_url_include', 0);
ini_set('tidy.clean_output', 0);

// TODO: Removed from PHP as of 5.4.0
if (PHP_MINOR_VERSION < 4) {
    ini_set('magic_quotes_runtime', 0);
    ini_set('magic_quotes_sybase', 0);
}

/* Exit immediately if register_globals is active.
 * register_globals may return 'Off' on some systems. See Bug #10062. */
if (($rg = ini_get('register_globals')) && (strcasecmp($rg, 'off') !== 0)) {
    exit('Register globals is enabled. Exiting.');
}

$dirname = __DIR__;

if (!defined('HORDE_BASE')) {
    define('HORDE_BASE', $dirname . '/..');
}

ini_set('include_path', $dirname . PATH_SEPARATOR . ini_get('include_path'));
if (file_exists(HORDE_BASE . '/config/horde.local.php')) {
    include_once HORDE_BASE . '/config/horde.local.php';
}

/* Set up autoload paths for core Horde libs (located in lib/). This can't
 * be defined in Horde_Autoloader since the current directory path can not be
 * determined there. */
if (!@include_once 'Horde/Autoloader/Cache.php') {
    require_once 'Horde/Autoloader/Default.php';
}
$__autoloader->addClassPathMapper(
    new Horde_Autoloader_ClassPathMapper_PrefixString('Horde', $dirname)
);

/* Sanity checking - if we can't even load the Horde_ErrorHandler file, then
 * the installation is all sorts of busted. */
if (!class_exists('Horde_ErrorHandler')) {
    exit('Cannot find base Horde directories. Please reinstall Horde and/or correctly configure the install paths.');
}

/* Default exception handler for uncaught exceptions. The default fatal
 * exception handler output may include things like passwords, etc. so don't
 * output this unless an admin. */
set_exception_handler(array('Horde_ErrorHandler', 'fatal'));

/* Catch errors. */
set_error_handler(array('Horde_ErrorHandler', 'errorHandler'), E_ALL | E_STRICT);

/* Catch fatal errors. */
register_shutdown_function(array('Horde_ErrorHandler', 'catchFatalError'));