/
index.php
174 lines (118 loc) · 3.69 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
/******************* Init *******************/
//user
//thinkedit
require_once('thinkedit.init.php');
require_once ROOT . '/class/url.class.php';
// helpers classes :
//url
$url = new url();
$cache_id = 'node_' . $url->get('node_id');
$cache_enabled = true;
//$cache_enabled = false;
if ($url->get('refresh'))
{
if ($thinkedit->outputcache->get($cache_id))
{
$thinkedit->outputcache->remove($cache_id);
}
}
if ($url->get('clear_cache'))
{
$thinkedit->outputcache->clean();
}
if ($cache_enabled && $thinkedit->outputcache->start($cache_id))
{
require_once ROOT . '/lib/thinkedit/template.lib.php';
echo te_admin_toolbox();
if (function_exists('xdebug_dump_function_profile') && !$thinkedit->isInProduction())
{
xdebug_dump_function_profile(4);
}
exit;
}
else
{
/******************* Node *******************/
$node = $thinkedit->newNode();
if ($url->get('node_id'))
{
$node->setId($url->get('node_id'));
if (!$node->load())
{
//include(ROOT . '/design/default/header.template.php');
include(ROOT . '/design/' . $thinkedit->configuration->getDesign() . '/404.template.php');
//include(ROOT . '/design/default/footer.template.php');
die();
}
}
else
{
if ($node->loadRootNode())
{
}
else
{
die('<h1>There is no root node in the DB, your website is empty, aborting. Go to install and create your first node!</h1>');
}
}
/******************* Content *******************/
$content = $node->getContent();
$content->load();
/******************* Relations *******************/
$relation = $thinkedit->newRelation();
/******************* Menu *******************/
require_once ROOT . '/class/menu.breadcrumb.class.php';
$breadcrumb = new menu_breadcrumb($node);
require_once ROOT . '/class/menu.main.class.php';
$main_menu = new menu_main();
require_once ROOT . '/class/menu.child.class.php';
$child_menu = new menu_child($node);
require_once ROOT . '/class/menu.sitemap.class.php';
$sitemap = new menu_sitemap($node);
require_once ROOT . '/class/menu.context.class.php';
$context_menu = new menu_context($node);
require_once ROOT . '/class/menu.sibling.class.php';
$sibling_menu = new menu_sibling($node);
/******************* Template helpers (aka "tags") *******************/
require_once ROOT . '/lib/thinkedit/template.lib.php';
/******************* Choose template *******************/
// Which design ?
$design = $thinkedit->configuration->getDesign();
// find the right template
// if a file called $content->getType .template.php exists, it is used as the template else, we use content.template.php
if ($node->get('template'))
{
$template_file = ROOT . '/design/'. $design . '/templates/' . $node->get('template');
}
else
{
$template_file = ROOT . '/design/'. $design . '/' . $content->getType() . '.template.php';
}
if (!file_exists($template_file))
{
$template_file = ROOT . '/design/'. $design .'/content.template.php';
}
/******************* Render *******************/
// include header
include(ROOT . '/design/'. $design .'/header.template.php');
// include template
include($template_file);
// include footer
include(ROOT . '/design/'. $design .'/footer.template.php');
if ($cache_enabled)
{
$thinkedit->outputcache->end();
}
}
/*
echo 'Total Queries : ' . $thinkedit->db->getTotalQueries();
echo '<br/>';
echo 'Total time : ' . $thinkedit->timer->render();
*/
echo te_admin_toolbox();
if (function_exists('xdebug_dump_function_profile') && !$thinkedit->isInProduction())
{
xdebug_dump_function_profile(4);
}
?>