public static function acesso($nivel) { $user = TSession::getValue('user'); if ($user->permissao < $nivel) { AdiantiCoreApplication::loadPage('Home'); } }
public static function run($debug = FALSE) { new TSession(); if ($_REQUEST) { parent::run($debug); } }
public static function run($debug = FALSE) { new TSession(); if ($_REQUEST) { $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : ''; if (TSession::getValue('logged')) { // logged $programs = (array) TSession::getValue('programs'); // programs with permission $programs = array_merge($programs, array('Adianti\\Base\\TStandardSeek' => TRUE, 'LoginForm' => TRUE, 'AdiantiMultiSearchService' => TRUE, 'AdiantiUploaderService' => TRUE, 'EmptyPage' => TRUE)); // default programs if (isset($programs[$class])) { parent::run($debug); } else { new TMessage('error', _t('Permission denied')); } } else { if ($class == 'LoginForm') { parent::run($debug); } else { new TMessage('error', _t('Permission denied'), new TAction(array('LoginForm', 'onLogout'))); } } } }
function __construct() { parent::__construct(); parent::set_title('Adianti Framework :: Samples'); $this->content = new GtkFixed(); $vbox = new GtkVBox(); $scroll = new GtkScrolledWindow(); $scroll->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS); $scroll->set_size_request(200, -1); $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader.png'), false, false); $MenuBar = TMenuBar::newFromXML('menu.xml'); $vbox->pack_start($MenuBar, false, false); $vbox->pack_start($this->content, true, true); parent::add($vbox); parent::show_all(); }
public static function run($debug = FALSE) { new TSession(); $lang = TSession::getValue('language') ? TSession::getValue('language') : 'en'; TAdiantiCoreTranslator::setLanguage($lang); TApplicationTranslator::setLanguage($lang); if ($_REQUEST) { $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : ''; if (!TSession::getValue('logged') and $class !== 'LoginForm') { echo TPage::getLoadedCSS(); echo TPage::getLoadedJS(); new TMessage('error', 'Not logged'); return; } parent::run($debug); } }
<?php require_once 'init.php'; $theme = 'theme2'; new TSession(); if (TSession::getValue('logged')) { $content = file_get_contents("app/templates/{$theme}/layout.html"); $menu_string = AdiantiMenuBuilder::parse('menu.xml', $theme); $content = str_replace('{MENU}', $menu_string, $content); } else { $content = file_get_contents("app/templates/{$theme}/login.html"); } // $content = TApplicationTranslator::translateTemplate($content); $content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$theme}/libraries.html"), $content); $content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content); $content = str_replace('{template}', $theme, $content); $content = str_replace('{username}', TSession::getValue('username'), $content); $content = str_replace('{frontpage}', TSession::getValue('frontpage'), $content); $content = str_replace('{query_string}', $_SERVER["QUERY_STRING"], $content); $css = TPage::getLoadedCSS(); $js = TPage::getLoadedJS(); $content = str_replace('{HEAD}', $css . $js, $content); echo $content; if (TSession::getValue('logged')) { if (isset($_REQUEST['class'])) { $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : NULL; AdiantiCoreApplication::loadPage($_REQUEST['class'], $method, $_REQUEST); } } else { AdiantiCoreApplication::loadPage('LoginForm', '', $_REQUEST); }
<?php require_once 'init.php'; new TSession(); ob_start(); if (TSession::getValue('user_login')) { $theme = 'Agenda'; } else { $theme = 'Login'; } $content = file_get_contents("app/templates/{$theme}/layout.html"); $content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$theme}/libraries.html"), $content); $content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content); $content = str_replace('{template}', $theme, $content); $css = TPage::getLoadedCSS(); $js = TPage::getLoadedJS(); $content = str_replace('{HEAD}', $css . $js, $content); echo $content; if (isset($_REQUEST['class'])) { $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : NULL; AdiantiCoreApplication::loadPage($_REQUEST['class'], $method, $_REQUEST); } else { AdiantiCoreApplication::loadPage('Home'); }
public function logout() { TSession::freeSession(); AdiantiCoreApplication::gotoPage('Home'); }
<?php require_once 'init.php'; $theme = 'theme1'; new TSession(); ob_start(); $menu = TMenuBar::newFromXML('menu.xml'); $menu->show(); $menu_string = ob_get_clean(); $content = file_get_contents("app/templates/{$theme}/layout.html"); $content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$theme}/libraries.html"), $content); $content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content); $content = str_replace('{template}', $theme, $content); $content = str_replace('{MENU}', $menu_string, $content); $css = TPage::getLoadedCSS(); $js = TPage::getLoadedJS(); $content = str_replace('{HEAD}', $css . $js, $content); echo $content; if (isset($_REQUEST['class'])) { $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : NULL; AdiantiCoreApplication::loadPage($_REQUEST['class'], $method, $_REQUEST); }