-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
60 lines (47 loc) · 1.74 KB
/
index.php
File metadata and controls
60 lines (47 loc) · 1.74 KB
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
<?php
/*
* Codengine
* FilePath: index.php
*/
session_start();
require_once 'app/registry.php';
try {
// get the instance of the registry
$registry = Registry::getInstance();
// ... load the Codengine configuration and extensions
require_once 'app/config.php';
$registry->set("config", $_CONFIG);
require_once 'app/base/View/View.base.php';
$registry->set("view", $_CONFIG);
// than execute all other Codengine extenstions
$_CONFIG = $registry->get("config");
$_CONFIG = $registry->get("view");
// basic classes
require_once 'app/base/Security/Security.base.php';
$registry->set("sec", new Security()); // security
if($_CONFIG['db']['enabled'] === true) { // load db if enabled
require_once 'app/base/Database/Database.base.php';
$registry->set("db", new Database($_CONFIG['db']['hostname'], $_CONFIG['db']['username'], $_CONFIG['db']['password'], $_CONFIG['db']['dbname']));
$DB = $registry->get("db");
}
if($_CONFIG['upload']['enabled'] === true) { // load file uploading if enabled
require_once 'app/base/Upload/Upload.base.php';
$registry->set("upload", new Upload());
}
if($_CONFIG['language']['enabled'] === true) { // load language stacks if enabled
require_once 'app/base/Language/Language.base.php';
$registry->set("language", new Language($_CONFIG));
}
if($_CONFIG['api'] === true || $_CONFIG['api'] == 'enabled') { // load api communication if enabled. 'enabled' for backward compatibility.
require_once 'app/base/API/API.base.php';
$registry->set("api", new API());
}
$controllers = array_filter(scandir('app/controllers'), function($item) {
return !is_dir('app/controllers/' . $item);
});
// now load the routing system
require_once 'app/route.php';
} catch(Exception $e) {
echo $e->getMessage();
}
?>