/** * Get smarty template * @return Smarty smarty object */ public static function getSmartyTemplate() { $smarty = new \SmartyBC(); $useTheme = !defined('OPENBIZ_USE_THEME') ? 0 : OPENBIZ_USE_THEME; if ($useTheme) { $theme = Openbizx::$app->getCurrentTheme(); $themePath = $theme; // Openbizx::$app->getConfiguration()->GetThemePath($theme); if (is_dir(OPENBIZ_THEME_PATH . "/" . $themePath . "/template")) { $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/template"; } else { $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/templates"; } $smarty->setTemplateDir($templateRoot); $compileDir = defined('OPENBIZ_SMARTY_CPL_PATH') ? OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath : $templateRoot . "/cpl"; $smarty->setCompileDir($compileDir); $smarty->setConfigDir($templateRoot . "/cfg"); $smarty->config_load('tpl.conf'); } else { if (defined('SMARTY_TPL_PATH')) { $smarty->setTemplateDir(SMARTY_TPL_PATH); } if (defined('OPENBIZ_SMARTY_CPL_PATH')) { $smarty->setCompileDir(OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath); } if (defined('SMARTY_CFG_PATH')) { $smarty->setConfigDir(SMARTY_CFG_PATH); } } if (!is_dir($smarty->compile_dir)) { mkdir($smarty->compile_dir, 0777); } // load the config file which has the images and css url defined $smarty->assign('app_url', OPENBIZ_APP_URL); $smarty->assign('app_index', OPENBIZ_APP_INDEX_URL); $smarty->assign('js_url', OPENBIZ_JS_URL); $smarty->assign('css_url', OPENBIZ_THEME_URL . "/" . $theme . "/css"); $smarty->assign('resource_url', OPENBIZ_RESOURCE_URL); $smarty->assign('resource_php', OPENBIZ_RESOURCE_PHP); $smarty->assign('theme_js_url', OPENBIZ_THEME_URL . "/" . $theme . "/js"); $smarty->assign('theme_url', OPENBIZ_THEME_URL . "/" . $theme); $smarty->assign('image_url', OPENBIZ_THEME_URL . "/" . $theme . "/images"); $smarty->assign('lang', strtolower(I18n::getCurrentLangCode())); $smarty->assign('lang_name', I18n::getCurrentLangCode()); return $smarty; }
// e.g. http://dev.freebg.de/lang/ define("LITO_MAIN_CSS", LITO_ROOT_PATH_URL . 'css/' . LITO_THEMES); define("LITO_JS_URL", LITO_ROOT_PATH_URL . 'js/'); define("LITO_GLOBAL_IMAGE_URL", LITO_ROOT_PATH_URL . 'images/'); $lang_suffix = "de"; require LITO_ROOT_PATH . 'options/options.php'; require LITO_INCLUDES_PATH . 'functions.php'; require LITO_INCLUDES_PATH . 'smarty/SmartyBC.class.php'; // Smarty class laden und pr�fen $time_start = explode(' ', substr(microtime(), 1)); $time_start = $time_start[1] + $time_start[0]; $tpl = new SmartyBC(); $tpl->template_dir = LITO_THEMES_PATH; $tpl->compile_dir = LITO_CACHE_PATH . 'Smarty/templates_c/' . LITO_THEMES . '/'; $tpl->cache_dir = LITO_CACHE_PATH . 'Smarty/cache/ ' . LITO_THEMES . '/'; $tpl->config_load(LITO_LANG_PATH . 'core/lang_' . $lang_suffix . '.php'); $tpl->assign('GAME_TITLE_TEXT', $op_set_gamename); $is_loged_in = 0; if (isset($_SESSION['userid'])) { $is_loged_in = 1; // if Game Online or Offline if ($op_set_offline == 1 && $modul_name != "logout") { show_error($op_set_offline_message, "core", 0); exit; } // load Userdata array $result = $db->query("SELECT u.*,c.* FROM cc" . $n . "_users AS u, cc" . $n . "_countries AS c WHERE u.userid='" . $_SESSION['userid'] . "' AND u.activeid=c.islandid"); $userdata = $db->fetch_array($result); $db->unbuffered_query("UPDATE cc" . $n . "_users SET lastactive='" . time() . "' WHERE userid='" . $userdata['userid'] . "'"); //disabled Admingame login if (intval($db->num_rows($result)) == 0 && $modul_name != "logout") {