-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
39 lines (32 loc) · 1.1 KB
/
index.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
<?php
// This definition will prevent any files to be loaded outside of this file.
define('MICROLIGHT', 'v1.0.1');
try {
// Load user details
if (!file_exists('includes/user.config.php')) {
throw new Exception(
'User config file not found. Please run /install.php'
);
}
require_once('includes/user.config.php');
// Load configuration
require_once('includes/config.php');
// Determine what post to show
ml_showing();
ml_database_setup();
ml_load_posts();
ml_database_close();
} catch (\Throwable $e) {
// TODO: Display a nice error message here instead. Reset global variables
// and set `$showing` to an error code which can be displayed by the theme.
echo "<h1>Error</h1>";
echo "<p><strong>Message:</strong> {$e->getMessage()}</p>";
echo "<p><strong>Code:</strong> {$e->getCode()}</p>";
echo "<p>Consider <a href='install.php'>installing</a> if you haven't already.</p>";
die();
}
// Initialise the theme
require_once("themes/" . Config::THEME . "/index.php");
// Kill the PHP script. Some free web hosts like to inject their tracking
// scripts and this should hopefully prevent that.
die();