/
index.php
51 lines (41 loc) · 1.63 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
<?php
use Adianti\Control\TPage;
use Adianti\Registry\TSession;
use Adianti\Widget\Menu\TMenu;
require_once 'init.php';
$uri = 'http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$template = 'theme1';
new TSession();
$menu_string = '';
if ( TSession::getValue('logged') )
{
$content = file_get_contents("app/templates/{$template}/layout.html");
ob_start();
$callback = array('PermissaoSistema', 'checkPermission');
$xml = new SimpleXMLElement(file_get_contents('menu.xml'));
$menu = new TMenu($xml, $callback, 0, 'nav collapse', '');
$menu->class = 'nav';
$menu->id = 'side-menu';
$menu->show();
$menu_string = ob_get_clean();
}
else
{
$content = file_get_contents("app/templates/{$template}/login.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);
$content = str_replace('{username}', TSession::getValue('nome'), $content);
$css = TPage::getLoadedCSS();
$js = TPage::getLoadedJS();
$content = str_replace('{HEAD}', $css.$js, $content);
if (isset($_REQUEST['class']) AND TSession::getValue('logged'))
{
$url = "class=Home";//http_build_query($_REQUEST);
$content = str_replace('//#javascript_placeholder#', "__adianti_load_page('engine.php?{$url}');", $content);
}
echo $content;