public static function run($debug = FALSE) { $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : ''; $static = isset($_REQUEST['static']) ? $_REQUEST['static'] : ''; $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : ''; $content = ''; set_error_handler(array('TCoreApplication', 'errorHandler')); if (class_exists($class)) { if ($static) { $rf = new ReflectionMethod($class, $method); if ($rf->isStatic()) { call_user_func(array($class, $method), $_REQUEST); } else { call_user_func(array(new $class(), $method), $_REQUEST); } } else { try { $page = new $class($_GET); ob_start(); $page->show($_GET); $content = ob_get_contents(); ob_end_clean(); } catch (Exception $e) { ob_start(); if ($debug) { new TExceptionView($e); $content = ob_get_contents(); } else { new TMessage('error', $e->getMessage()); $content = ob_get_contents(); } ob_end_clean(); } } } else { if (function_exists($method)) { call_user_func($method, $_REQUEST); } else { new TMessage('error', "<b>Error</b>: class <b><i><u>{$class}</u></i></b> not found"); } } if (!$static) { echo TPage::getLoadedCSS(); } echo TPage::getLoadedJS(); echo $content; }
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); } }
require_once 'init.php'; $theme = 'frontend'; new TSession(); if (TSession::getValue('logged')) { $content = file_get_contents("app/templates/{$theme}/layoutManual.html"); } else { $content = file_get_contents("app/templates/{$theme}/login.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('{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); if (isset($_REQUEST['changeContent'])) { $contenToChange = $_REQUEST['changeContent']; switch ($contenToChange) { case 'clients': $insideContent = file_get_contents("app/resources/manual/clients.html"); break; case 'calendar': $insideContent = file_get_contents("app/resources/manual/calendar.html"); break; case 'notes': $insideContent = file_get_contents("app/resources/manual/notes.html"); break; case 'stock': $insideContent = file_get_contents("app/resources/manual/stock.html");