forked from adamfranco/harmoni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharmoni.inc.php
182 lines (153 loc) · 4.91 KB
/
harmoni.inc.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?PHP
/**
* This file sets up global harmoni options, includes important files,
* and defines a few crucial functions.
*
*
* @package harmoni
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: harmoni.inc.php,v 1.47 2008/02/06 15:37:40 adamfranco Exp $
*/
/* :: start the output buffer, if it's not already :: */
if (!ob_get_level()) ob_start();
/**
* Defines the global harmoni directory.
* @const string HARMONI The harmoni core directory.
**/
define("HARMONI",dirname(__FILE__).DIRECTORY_SEPARATOR."core".DIRECTORY_SEPARATOR);
/**
* Defines the global harmoni directory.
* @const string HARMONI_BASE The base harmoni directory.
**/
define("HARMONI_BASE",dirname(__FILE__).DIRECTORY_SEPARATOR);
define("HARMONIBASE",HARMONI_BASE);
define("SIMPLE_TEST",HARMONI.DIRECTORY_SEPARATOR."simple_test".DIRECTORY_SEPARATOR);
/**
* Defines where OKI interfaces for PHP are located.
* @const string OKI The OKI interfaces location.
*/
define("OKI",dirname(__FILE__).DIRECTORY_SEPARATOR."oki".DIRECTORY_SEPARATOR);
define("OKI2",dirname(__FILE__).DIRECTORY_SEPARATOR."oki2_0_1".DIRECTORY_SEPARATOR);
//require_once(OKI."inc.php");
/*********************************************************
* if magic quotes on then get rid of them as we assume that
* they are off.
*********************************************************/
if (get_magic_quotes_gpc()) {
// but really throw an error
print '
<HTML>
<HEAD>
<TITLE>ERROR</TITLE>
<STYLE TYPE="text/css">
body {
background-color: #eee;
margin: 50px 150px 50px 150px;
padding: 30px;
color: #333;
font-family: Verdana;
border: 1px dotted #555;
}
body p {
font-size: 12px;
text-align: center;
color: #955;
}
body div {
font-size: 18px;
font-weight: normal;
}
</STYLE>
</HEAD>
<BODY>
<P>Harmoni could not be initialized for the following reason:</P>
<DIV>
PHP\'s config directive <b>magic_quotes_gpc</b> is set to <b>On</b> and should be <b>Off</b>.
</DIV>
<p>To have Harmoni run in compatability mode (stripping slashes from the GET, POST, COOKIE, and REQUEST arrays, comment out lines 49-86 of harmoni.inc.php (this file/message).
</BODY>
</HTML>';
exit(1);
function array_walk_stripslashes(&$val, $key) {
if (is_array($val)) array_walk($val, 'array_walk_stripslashes');
else $val = stripslashes($val);
}
array_walk($_GET, 'array_walk_stripslashes');
array_walk($_POST, 'array_walk_stripslashes');
array_walk($_REQUEST, 'array_walk_stripslashes');
array_walk($_COOKIE, 'array_walk_stripslashes');
}
/*********************************************************
* Check that the PHP version is at least 5
*********************************************************/
$minPhpVersion = "5.2.0";
if (version_compare(phpversion(), $minPhpVersion, "<")) {
// but really throw an error
print '
<HTML>
<HEAD>
<TITLE>ERROR</TITLE>
<STYLE TYPE="text/css">
body {
background-color: #eee;
margin: 50px 150px 50px 150px;
padding: 30px;
color: #333;
font-family: Verdana;
border: 1px dotted #555;
}
body p {
font-size: 12px;
text-align: center;
color: #955;
}
body div {
font-size: 18px;
font-weight: normal;
}
</STYLE>
</HEAD>
<BODY>
<P>Harmoni could not be initialized for the following reason:</P>
<DIV>
PHP version <b>'.$minPhpVersion.'</b> or greater required. This host is using <b>'.phpversion().'</b>.
</DIV>
</BODY>
</HTML>';
exit(1);
}
/*********************************************************
* Create the Harmoni object - required
*********************************************************/
/* :: load the Framework config file :: */
require_once(HARMONIBASE."config/framework.cfg.php");
$harmoni = Harmoni::instance();
/*********************************************************
* Services
*********************************************************/
/**
* The name of the services variable.
* @const SERVICES_OBJECT The name of the services variable.
**/
define("SERVICES_OBJECT","__services__");
/* :: load the services :: */
require_once(HARMONI."services/Services.class.php");
/**
* The global Services object.
* @var object Services $__services__ The global Services object.
**/
$__services__ = new Services();
$GLOBALS[SERVICES_OBJECT] =$__services__;
/* :: load the Services registration config file :: */
require_once(HARMONIBASE."config/services.cfg.php");
/*********************************************************
* include other useful things
*********************************************************/
require_once(HARMONI."utilities/TemplateFactory.class.php");
require_once(HARMONI."utilities/MIMETypes.class.php");
require_once(HARMONI."architecture/events/EventTrigger.abstract.php");
require_once(HARMONI."architecture/events/EventListener.interface.php");
?>