-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
68 lines (59 loc) · 1.64 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
<?php
function exceptionErrorHandler( $errno, $errstr, $errfile, $errline )
{
throw new ErrorException( $errstr, $errno, 0, $errfile, $errline );
}
set_error_handler("exceptionErrorHandler");
try
{
include('config.php');
}
catch ( ErrorException $ex )
{
echo "Unable to load weborama configuration file. <br />";
echo "Please check <a href='https://github.com/Oyana/weborama/wiki/Installation'> weborama installation wiki</a>. <br />";
}
try
{
session_name(APP_NAME);
session_start();
}
catch ( ErrorException $ex )
{
echo "Unable to start session. <br />";
echo "Please check your php configuration.";
}
try
{
require_once('routes.php');
}
catch ( ErrorException $ex )
{
echo "Unable to load weborama routes file. <br />";
echo "Please check <a href='https://github.com/Oyana/weborama/wiki/Routing'> weborama routes wiki</a>. <br />";
}
/*
|-------------------------------------------------------
| AUTOLOADER
|-------------------------------------------------------
|
| Autoload Framework function in /framework/ directory
| depending on some configuration (DEBUG_LVL, DB_TYPE, etc).
| Note that only the index.php file of each folder is loaded.
|
*/
//load these files first
require_once __DIR__ . '/framework/debugging/Debug.php';
require_once __DIR__ . '/framework/helpers/Helpers.php';
//load other folders
$files = glob(__DIR__ . '/framework/*/*.php');
//remove routing from autoload (to call it last)
if(($key = array_search(__DIR__ . '/framework/routing/Routing.php', $files)) !== false) {
unset($files[$key]);
}
//autoload
foreach($files as $file){
require_once $file;
}
//launch routing
require_once __DIR__ . '/framework/routing/Routing.php';