-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.php
52 lines (36 loc) · 1.12 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
40
41
42
43
44
45
46
47
48
49
50
51
<?php namespace App;
try {
require 'system/functions.php';
require 'constants.php';
convertWarningsToExceptions();
// Init composer auto-loading
if (!@include_once("vendor/autoload.php")) {
exit('Run composer install');
}
date_default_timezone_set(DEFAULT_TIMEZONE);
// Load config
if (!include('config.php')) {
$errors[] = 'No config.php. Please make a copy of config.sample.php and name it config.php and configure it.';
require 'templates/error_template.php';
exit();
}
// Default env is development
if (!defined('ENV')) define('ENV', ENV_DEVELOPMENT);
// Load sentry
require 'templates/partials/sentry.php';
new Application;
} catch (\mysqli_sql_exception $e) { // Catch DatabaseException specifically
if (ENV == ENV_PRODUCTION) {
handleProductionError($e);
}else{
Db::displayError($e);
}
exit();
} catch (\Exception $e) { // General exception handling
// To see the error message in dev
if (ENV == ENV_PRODUCTION) {
handleProductionError($e);
exit();
}
throw $e;
}