forked from future-analytics/reusingdublin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
57 lines (44 loc) · 1.14 KB
/
bootstrap.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
<?php
namespace ReusingDublin;
use ReusingDublin;
/**
* @package ReusingDublin
* @author daithi coombes <webeire@gmail.com>
*/
/**
* @constant
*/
define('REUSINGDUBLIN_DIR', realpath(dirname(__FILE__)));
define('REUSINGDUBLIN_DEBUG', 1);
define('REUSINGDUBLIN_UPLOADS', REUSINGDUBLIN_DIR.'/uploads');
// end constants
// debug?
if(defined(REUSINGDUBLIN_DEBUG) && REUSINGDUBLIN_DEBUG==1){
error_reporting(E_ALL);
ini_set('display_errors', 'on');
}// end debug
/**
* Autoloader.
* @param string $class The class name including namespace
*/
spl_autoload_register(function($class){
$file = REUSINGDUBLIN_DIR . '/lib/' . str_replace("ReusingDublin\\", "", $class) . '.php';
if(is_readable($file))
require_once($file);
});
require_once(REUSINGDUBLIN_DIR.'/vendor/autoload.php');
/**
* Configuration
*/
try{
new \ReusingDublin\Config(require_once(REUSINGDUBLIN_DIR . '/config.php'));
} catch (Exception $e) {
if(!is_readable(REUSINGDUBLIN_DIR . '/config.php'))
die("Can't read config.php file. Please see README.md for installation instructions");
die($e->message);
}
/**
* Model object
*/
global $db;
$db = Model::factory();