-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
78 lines (68 loc) · 2.65 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
<?php
session_start();
$controller = !empty($_GET['controller']) ? $_GET['controller'] : 'home';
$action = !empty($_GET['action']) ? $_GET['action'] : 'main';
if (!empty($controller) && !empty($action)) {
// Include controller according to url
$controllers = array(
'home' => 'Home',
'article' => 'ArticlePage',
'comments' => 'Comments',
'listing' => 'Listing',
'category' => 'CategoryPage',
'staticpages' => 'Staticpages',
'ajax' => 'Ajax',
);
if (array_key_exists($controller, $controllers)) {
ob_start();
include_once 'libraries/ReadConfig.php';
include_once 'libraries/MySQLConnector.php';
$mysql_connector = new MySQLConnector($cfg['host'], $cfg['username'], $cfg['password'], $cfg['dbname']);
// Include tools library
include_once 'libraries/Model.php';
include_once 'libraries/LibTools.php';
// Include parent controller
include_once 'libraries/Controller.php';
include_once 'libraries/Widget.php';
// Processing data for the widgets
foreach ($_activated_widgets as $widget) {
ob_start();
include_once 'widgets/' . $widget . '/controller.php';
$_wid_ctrl = new $widget($cfg, $mysql_connector);
$_wid_ctrl->_do_($action);
$_widgets_ctrl[$widget] = ob_get_contents();
ob_end_clean();
//Fetching widget view
$_widget_data = $_wid_ctrl->data;
ob_start();
include_once 'widgets/' . $widget . '/view.phtml';
$_widgets[$widget] = ob_get_contents();
ob_end_clean();
}
// Include called controller
$ctrlName = $controllers[$controller];
include_once 'controllers/' . $ctrlName . '.php';
$_ctrl = new $ctrlName($cfg, $mysql_connector);
$_ctrl->_do_($action);
$_controller_str = ob_get_contents();
ob_end_clean();
ob_start();
$_speedmsg = $_ctrl->speedmsg;
$view = $_ctrl->view;
$layout = $_ctrl->layout;
$layout_tpl = $_ctrl->layout_tpl;
if (!empty($_ctrl->view_tpl)) {
include_once 'views/' . $_ctrl->view_tpl;
} else {
include_once 'views/' . $ctrlName . '/' . $action . '.phtml';
}
$_view_str = ob_get_contents();
ob_end_clean();
include_once 'libraries/Layout.php';
if (!empty($_controller_str)) {
echo "<pre>";
var_dump($_controller_str);
echo "</pre>";
}
}
}