forked from Ma-ve/TPP.org
/
index.php
51 lines (41 loc) · 1002 Bytes
/
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
$time = microtime(true);
prioIncludes();
includes();
new Init();
if(TPP_DEBUG) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_error_handler("exception_error_handler", E_ALL);
}
TPP::initializeConnection(new mysqli(DB_HOST, DB_USER, DB_PASS, DB_DATABASE . TWITCHVERSION));
$site = new SiteController();
$site->actionIndex();
echo '<h1>loaded in ' . round(microtime(true) - $time, 7) . ' secs</h1>';
exit();
function prioIncludes() {
$priorityIncludes = array(
'helpers' => array(
'ErrorHandler',
),
'controllers' => array(
'Controller',
),
'models' => array(
'TPP',
'Model',
));
foreach($priorityIncludes as $key => $prio) {
foreach($prio as $pr) {
include_once($key . '/' . $pr . '.php');
}
}
}
function includes() {
$includes = array('controllers', 'models', 'helpers');
foreach($includes as $inc) {
foreach(glob($inc . "/*.php") as $filename) {
include_once($filename);
}
}
}