forked from drlippman/IMathAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
31 lines (25 loc) · 1.12 KB
/
init.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
<?php
require_once(__DIR__ . "/includes/sanitize.php");
// Load site config.
if (!file_exists(__DIR__ . "/config.php")) {
// Can't use $basesiteurl here, as it's defined in config.php.
$httpMode = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
? 'https://' : 'http://';
header('Location: ' . Sanitize::url($httpMode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/install.php"));
}
require_once(__DIR__ . "/config.php");
// Store PHP sessions in the database.
require_once(__DIR__ . "/includes/session.php");
if (!isset($use_local_sessions)) {
session_set_save_handler(new SessionDBHandler(), true);
}
// OWASP CSRF Protector
if (!empty($CFG['use_csrfp']) && (!isset($init_skip_csrfp) || (isset($init_skip_csrfp) && false == $init_skip_csrfp))) {
require_once(__DIR__ . "/csrfp/libs/csrf/csrfprotector.php");
csrfProtector::init();
}
// Load validate.php?
if (!isset($init_skip_validate) || (isset($init_skip_validate) && false == $init_skip_validate)) {
require_once(__DIR__ . "/validate.php");
}