forked from geoffhumphrey/brewcompetitiononlineentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.php
254 lines (215 loc) · 7.2 KB
/
paths.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?php
/**
* Module: paths.php
* Description: This module sets global file folder paths. Also houses
* specific, site-wide variables.
*
*/
/**
* The following are file path definitions for various
* script and document storage folders used/accessed by the
* application.
*/
define('ROOT',dirname( __FILE__ ).DIRECTORY_SEPARATOR);
define('ADMIN',ROOT.'admin'.DIRECTORY_SEPARATOR);
define('SSO',ROOT.'sso'.DIRECTORY_SEPARATOR);
define('EVALS',ROOT.'eval'.DIRECTORY_SEPARATOR);
define('CLASSES',ROOT.'classes'.DIRECTORY_SEPARATOR);
define('CONFIG',ROOT.'site'.DIRECTORY_SEPARATOR);
define('DB',ROOT.'includes'.DIRECTORY_SEPARATOR.'db'.DIRECTORY_SEPARATOR);
define('IMAGES',ROOT.'images'.DIRECTORY_SEPARATOR);
define('INCLUDES',ROOT.'includes'.DIRECTORY_SEPARATOR);
define('LIB',ROOT.'lib'.DIRECTORY_SEPARATOR);
define('MODS',ROOT.'mods'.DIRECTORY_SEPARATOR);
define('PROCESS',ROOT.'includes'.DIRECTORY_SEPARATOR.'process'.DIRECTORY_SEPARATOR);
define('SECTIONS',ROOT.'sections'.DIRECTORY_SEPARATOR);
define('COMPONENTS',ROOT.'components'.DIRECTORY_SEPARATOR);
define('TEMPLATES',ROOT.'templates'.DIRECTORY_SEPARATOR);
define('SETUP',ROOT.'setup'.DIRECTORY_SEPARATOR);
define('UPDATE',ROOT.'update'.DIRECTORY_SEPARATOR);
define('OUTPUT',ROOT.'output'.DIRECTORY_SEPARATOR);
define('USER_IMAGES',ROOT.'user_images'.DIRECTORY_SEPARATOR);
define('USER_DOCS',ROOT.'user_docs'.DIRECTORY_SEPARATOR);
define('USER_TEMP',ROOT.'user_temp'.DIRECTORY_SEPARATOR);
define('LANG',ROOT.'lang'.DIRECTORY_SEPARATOR);
define('DEBUGGING',ROOT.'includes'.DIRECTORY_SEPARATOR.'debug'.DIRECTORY_SEPARATOR);
/**
* --------------------------------------------------------
* Global Definitions
* --------------------------------------------------------
*/
/**
* The following are for use by the developer
* Default for all is FALSE
*/
define('HOSTED', FALSE);
define('NHC', FALSE);
define('SINGLE', FALSE);
define('EVALUATION', FALSE);
/**
* Enable to following to put your installation into
* "mainenance mode" - bypasses the default index.php script
* and displays the maintenance.php file to alert visitors.
* Default is FALSE.
*/
define('MAINT', FALSE);
/**
* Disable the following to utilize the Load Libraries
* Locally option if your installation is having trouble
* loading libraries via CDN.
* See http://www.brewcompetition.com/local-load
* Default is TRUE.
*/
define('CDN', TRUE);
/**
* Enable the following to put the site into "test mode"
* Useful for testing the PayPal IPN functions in their
* sandbox enfvironment, etc.
* Default is FALSE.
*/
define('TESTING', FALSE);
/**
* Enable the following to display php errors on screen.
* Default is FALSE.
*/
define('DEBUG', FALSE);
/**
* Enable the following to show a collapsable table of all
* session variables on screen.
* Default is FALSE.
*/
define('DEBUG_SESSION_VARS', FALSE);
/**
* Enable the following when receiving mySQL "column does
* not exist" errors and the like.
* This will trigger DB structure updates contained in the
* off_schedule_update.php file.
* ONLY enbable for a single refresh of the index.php
* page for performance issues.
* Default is FALSE.
*/
define('FORCE_UPDATE', FALSE);
/**
* Set the following to TRUE if receiving mod_security
* "Not Acceptable!" errors. This may not alleviate the
* problem, but it's a good first step in diagnosing
* why some mod_security errors are occurring.
* Default is FALSE.
*/
define('ENABLE_MARKDOWN', FALSE);
/**
* Set the following to TRUE if you would like to use
* PHPMailer to send emails from your BCOE&M installation.
* PHPMailer uses your server's SMTP configuration to send
* emails instead of using PHP's native mail() function,
* which may be disabled on certain web hosts.
* Requires configuration in the /site/config.mail.php file
* Default is FALSE.
*/
define('ENABLE_MAILER', FALSE);
/**
* --------------------------------------------------------
* Error Reporting
* --------------------------------------------------------
*/
ini_set('error_reporting', E_ALL ^ E_DEPRECATED);
ini_set('log_errors','On');
if (DEBUG) ini_set('display_errors','On');
else ini_set('display_errors','Off');
/**
* --------------------------------------------------------
* Load Configuration
* --------------------------------------------------------
*/
require_once (CONFIG.'config.php');
if (ENABLE_MAILER) require_once (CONFIG.'config.mail.php');
require_once (INCLUDES.'current_version.inc.php');
if (HOSTED) {
$installation_id = $prefix;
$session_expire_after = 30;
}
/** Using an MD5 of __FILE__ will ensure a different session
* name for multiple installs on the same domain name.
*
* @fixes https://github.com/geoffhumphrey/brewcompetitiononlineentry/issues/781
*/
if (empty($installation_id)) $prefix_session = md5(__FILE__);
else $prefix_session = md5($installation_id);
// **PREVENTING SESSION HIJACKING**
// Prevents javascript XSS attacks aimed to steal the session ID
ini_set('session.cookie_httponly', 1);
// **PREVENTING SESSION FIXATION**
// Session ID cannot be passed through URLs
ini_set('session.use_only_cookies', 1);
// Uses a secure connection (HTTPS) if possible
ini_set('session.cookie_secure', 1);
function is_session_started() {
if (php_sapi_name() !== 'cli' ) {
if (version_compare(phpversion(), '5.4.0', '>=')) {
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
} else {
return session_id() === '' ? FALSE : TRUE;
}
}
return FALSE;
}
if (is_session_started() === FALSE) {
session_name($prefix_session);
session_start();
}
if (isset($_SESSION['last_action'])) {
$seconds_inactive = time() - $_SESSION['last_action'];
$session_expire_after_seconds = $session_expire_after * 60;
if ($seconds_inactive >= $session_expire_after_seconds) {
session_unset();
session_destroy();
}
}
$_SESSION['last_action'] = time();
/**
* --------------------------------------------------------
* RECAPTCHA Keys
* One set is for hosted installations on brewcomp.com or
* brewcompetition.com - the other is for outside use.
* Per Google guidelines, all keys validate the domain from
* which it was generated:
* https://developers.google.com/recaptcha/docs/domain_validation
* You may need to change the second set with your own API keys if
* reCAPTCHA is not functioning on your self-hosted installation.
* Get started at: https://developers.google.com/recaptcha/
* --------------------------------------------------------
*/
if (HOSTED) {
$public_captcha_key = "6LdUsBATAAAAAEJYbnqmygjGK-S6CHCoGcLALg5W";
$private_captcha_key = "6LdUsBATAAAAAMPhk5yRSmY5BMXlBgcTjiLjiyPb";
}
else {
$public_captcha_key = "6LfHUCoUAAAAACHsPn8hpzbtzcpXatm-GXTTWuR3";
$private_captcha_key = "6LfHUCoUAAAAACNL-wzpAG3eIWQC-PpX6X3a0iaM";
}
/** Uncomment to display paths */
/*
echo ROOT."<br>";
echo ADMIN."<br>";
echo SSO."<br>";
echo CLASSES."<br>";
echo CONFIG."<br>";
echo DB."<br>";
echo IMAGES."<br>";
echo INCLUDES."<br>";
echo LIB."<br>";
echo MODS."<br>";
echo PROCESS."<br>";
echo SECTIONS."<br>";
echo COMPONENTS."<br>";
echo TEMPLATES."<br>";
echo SETUP."<br>";
echo UPDATE."<br>";
echo OUTPUT."<br>";
echo USER_IMAGES."<br>";
echo USER_DOCS."<br>";
echo USER_TEMP."<br>";
echo LANG."<br>";
echo DEBUGGING."<br>";
*/
?>