-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
41 lines (32 loc) · 1.12 KB
/
main.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
<?php
require_once 'includes/constants.php';
$missingVariables = ''; $requiredCount = count(REQUIRED_ENVIRONMENT_VARIABLES);
foreach (REQUIRED_ENVIRONMENT_VARIABLES as $index => $requiredKey) {
if (!isset($_SERVER[$requiredKey])) {
$missingVariables .= $requiredKey . (
$index < $requiredCount - 1
? (
$index == $requiredCount - 2
? ' and ' // if it's just one step before the end
: ', ' // if it's not the last key, but not near the end
)
: '.' // if it's the last key
);
}
}
if (!empty($missingVariables)) {
print
'Couldn\'t complete startup: <br>
<br>
The following required environment variables are missing: ' . $missingVariables . ' <br>
<br>
Please supply them, restart the server, and try again.';
exit();
}
if (!isset($initializeDatabase) || $initializeDatabase) {
require_once 'includes/database.php';
$database = new Database();
}
require_once 'includes/functions.php';
require_once 'vendor/autoload.php';
?>