-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.web.php
executable file
·59 lines (53 loc) · 1.9 KB
/
index.web.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
<?php
include_once 'lib/adianti/util/TAdiantiLoader.class.php';
spl_autoload_register(array('TAdiantiLoader', 'autoload_web'));
define('APPLICATION_NAME', 'framework');
$uri = 'http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
new TSession;
if (isset($_GET['template']))
{
TSession::setValue('template', $_GET['template']);
}
else
{
$template = TSession::getValue('template') ?
TSession::getValue('template') : 'theme1';
}
if (TSession::getValue('started'))
{
date_default_timezone_set(TSession::getValue('timezone'));
$lang = TSession::getValue('language');
}
else
{
$ini = parse_ini_file('application.ini');
$lang = $ini['language'];
date_default_timezone_set($ini['timezone']);
TSession::setValue('timezone', $ini['timezone']);
TSession::setValue('language', $ini['language']);
TSession::setValue('started', TRUE);
}
TAdiantiCoreTranslator::setLanguage($lang);
TApplicationTranslator::setLanguage($lang);
ob_start();
$menu = TMenuBar::newFromXML('menu.xml');
$menu->show();
$menu_string = ob_get_contents();
ob_end_clean();
$content = file_get_contents("app/templates/{$template}/layout.html");
$content = TApplicationTranslator::translateTemplate($content);
$content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$template}/libraries.html"), $content);
$content = str_replace('{URI}', $uri, $content);
$content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content);
$content = str_replace('{template}', $template, $content);
$content = str_replace('{MENU}', $menu_string, $content);
$css = TPage::getLoadedCSS();
$js = TPage::getLoadedJS();
$content = str_replace('{HEAD}', $css.$js, $content);
if (isset($_REQUEST['class']))
{
$url = http_build_query($_REQUEST);
$content = str_replace('//#javascript_placeholder#', "__adianti_load_page('engine.php?{$url}');", $content);
}
echo $content;
?>