forked from munkireport/munkireport-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·97 lines (76 loc) · 2.31 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
define( 'KISS', 1 );
// Front controller
define('FC', __FILE__ .'/' );
define('APP_ROOT', dirname(__FILE__) .'/' );
// Load config
load_conf();
// Load conf (keeps variables out of global space)
function load_conf()
{
$conf = array();
$GLOBALS['conf'] =& $conf;
// Load default configuration
require_once(APP_ROOT . "config_default.php");
if ((include_once APP_ROOT . "config.php") !== 1)
{
fatal(APP_ROOT. "config.php is missing!<br>
Unfortunately, Munkireport does not work without it</p>");
}
// Convert auth_config to config item
if(isset($auth_config))
{
$conf['auth']['auth_config'] = $auth_config;
}
}
/**
* Get config item
* @param string config item
* @param string default value (optional)
* @author AvB
**/
function conf($cf_item, $default = '')
{
return array_key_exists($cf_item, $GLOBALS['conf']) ? $GLOBALS['conf'][$cf_item] : $default;
}
/**
* Fatal error, show message and die
*
* @author AvB
**/
function fatal($msg)
{
include('assets/html/fatal_error.html');
exit(1);
}
//===============================================
// Defines
//===============================================
define('INDEX_PAGE', conf('index_page'));
define('SYS_PATH', conf('system_path') );
define('APP_PATH', conf('application_path') );
define('VIEW_PATH', conf('view_path'));
define('MODULE_PATH', conf('module_path'));
define('CONTROLLER_PATH', conf('controller_path'));
define('EXT', '.php'); // Default extension
//===============================================
// Debug
//===============================================
ini_set('display_errors', conf('debug') ? 'On' : 'Off' );
error_reporting( conf('debug') ? E_ALL : 0 );
//===============================================
// Includes
//===============================================
require( SYS_PATH.'kissmvc.php' );
require( APP_PATH.'helpers/site_helper'.EXT );
//===============================================
// Timezone and Locale
//===============================================
date_default_timezone_set( conf('timezone') );
setlocale(LC_ALL, conf('locale'));
set_exception_handler('uncaught_exception_handler');
//===============================================
// Start the controller
//===============================================
$uri_protocol = conf('uriProtocol');
new Engine($conf['routes'],'show','index',$conf['uri_protocol']);