-
Notifications
You must be signed in to change notification settings - Fork 24
/
exponent_bootstrap.php
105 lines (92 loc) · 3.6 KB
/
exponent_bootstrap.php
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
##################################################
#
# Copyright (c) 2004-2023 OIC Group, Inc.
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/** @define "BASE" "." */
/**
* Minimum PHP version check
*/
//if (version_compare(PHP_VERSION, '5.6.0', 'lt')) {
// echo "<h1 style='padding:10px;border:5px solid #992222;color:red;background:white;position:absolute;top:100px;left:300px;width:400px;z-index:999'>
// PHP 5.6.0+ is required! Please refer to the Exponent documentation for details:<br />
// <a href=\"http://docs.exponentcms.org/docs/current/requirements-running-exponent-cms\" target=\"_blank\">http://docs.exponentcms.org/</a>
// </h1>";
// die();
//}
// Following code allows magic_quotes to be on without screwing stuff up.
// magic quotes feature was removed in php 5.4.0
//if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc())
//{
// /**
// * @param $value
// * @return mixed
// */
// function stripslashes_deep($value) {
// return is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
// }
//
// $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
// $_GET = array_map('stripslashes_deep', $_GET);
// $_POST = array_map('stripslashes_deep', $_POST);
// $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
//}
// for scripts that want to bootstrap minimally, we will need _realpath()
// if it isn't already defined.
if (!function_exists('__realpath')) {
/**
* @param $path
* @return string
*/
function __realpath($path) {
$realpath = realpath($path);
if ($realpath) { // allow for relative paths accidently passed
$path = str_replace('\\', '/', $realpath);
if (!empty($path[1]) && $path[1] === ':') {
// We can't just check for C:/, because windows users may have the IIS webroot on X: or F:, etc.
$path = substr($path, 2);
}
}
return $path;
}
}
// Process user-defined constants first in overrides.php (if it exists)
@include_once('overrides.php');
// load constants for paths and other environment not overridden in overrides.php
require_once(dirname(__realpath(__FILE__)) . '/exponent_constants.php');
// load the code version
require_once(BASE . 'exponent_version.php');
/*
* EXPONENT Constant
*
* The EXPONENT Constant signals to other parts of the system that they are operating within the confines
* of the Exponent v2 Framework. (Module actions check this -- if it is not defined, they must abort).
*/
define('EXPONENT', EXPONENT_VERSION_MAJOR);
// load the constants from the global config and then default config settings
require_once(BASE . 'framework/core/subsystems/expSettings.php'); // we don't have our autoloader loaded yet
// check to ensure the request is coming from our server if not a cli/script call
if (php_sapi_name() !== 'cli' && (!isset($_SERVER['HTTP_HOST']) || ($_SERVER['HTTP_HOST'] != SITE_URL && SITE_URL !== '0'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
exit;
}
// Process PHP-wrapper settings (ini_sets and settings, and autoloader)
require_once(BASE . 'exponent_php_setup.php');
if (function_exists('gd_info')) {
$info = gd_info();
define('EXPONENT_HAS_GD',($info['GD Version'] === 'Not Supported' ? 0 : 1));
} else {
define('EXPONENT_HAS_GD', 0);
}
?>