-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
107 lines (55 loc) · 2.34 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
98
99
100
101
102
103
104
105
106
107
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);
// --------------------------------------------------------------------------------
// Begin bootstrap
include('./app/bootstrap.php');
// --------------------------------------------------------------------------------
// Setup router object
$router = Ecl::factory('Ecl_Mvc_Router', array (
'mvc_root' => $config['app.include_root'] ,
));
$router->baseUri($config['app.www']);
$router->controllerDefault('error');
$router->actionDefault('index');
// --------------------------------------------------------------------------------
// Setup model
include($config['app.include_root'].'/model.php');
$router->model($model);
// --------------------------------------------------------------------------------
// Setup routing instructions
$secure_base_url = preg_replace('#^http:#', 'https:', $config['app.www']);
// if the current scheme is HTTPS, then continue to use it
if ($model->get('request')->isSecure()) {
$router->baseUri($secure_base_url);
} else {
// If using HTTPS, switch to it if user is authenticated
if ($config['app.use_https']) {
if (!$model->get('user')->isAnonymous()) {
$router->baseUri($secure_base_url);
}
}
}
include($config['app.include_root'].'/routes.php');
// --------------------------------------------------------------------------------
// Setup layout
include($config['app.include_root'].'/classes/kc_layout.php');
$router->layout(new Kc_Layout());
if (empty($config['layout.template_file'])) {
$router->layout()->setTemplate('kitcatalogue');
} else {
$layout_template_file = $config['app.local_root'].DIRECTORY_SEPARATOR.'layouts'.DIRECTORY_SEPARATOR.$config['layout.template_file'];
if (!file_exists($layout_template_file)) {
die("The configuration file defined a non-existent template in 'layout.template_file'.");
} else {
$router->layout()->setTemplateFile($layout_template_file);
}
}
$router->layout()->addBreadcrumb('Home', $router->makeAbsoluteUri('/'));
// --------------------------------------------------------------------------------
// Setup any plugins defined in the local plugins folder and add them to the model
include($config['app.include_root'].'/plugins.php');
// --------------------------------------------------------------------------------
// Route and dispatch current request
$router->dispatch();
?>