/** * Constructor */ function BxDolTemplate($sRootPath = BX_DIRECTORY_PATH_ROOT, $sRootUrl = BX_DOL_URL_ROOT) { parent::BxDolMistake(); $this->_sPrefix = 'BxDolTemplate'; $this->_sRootPath = $sRootPath; $this->_sRootUrl = $sRootUrl; $this->_sInjectionsTable = 'sys_injections'; $this->_sInjectionsCache = BX_DOL_TEMPLATE_INJECTIONS_CACHE; $this->_sCodeKey = 'skin'; $this->_sCode = $GLOBALS['MySQL']->getParam('template'); if (empty($this->_sCode)) { $this->_sCode = BX_DOL_TEMPLATE_DEFAULT_CODE; } //--- Check selected template in COOKIE(the lowest priority) ---// $sCode = empty($_COOKIE[$this->_sCodeKey]) ? '' : $_COOKIE[$this->_sCodeKey]; if (!empty($sCode) && preg_match('/^[A-Za-z0-9_-]+$/', $sCode) && file_exists($this->_sRootPath . 'templates/tmpl_' . $sCode) && !is_file($this->_sRootPath . 'templates/tmpl_' . $sCode)) { $this->_sCode = $sCode; } //--- Check selected template in GET(the highest priority) ---// $sCode = empty($_GET[$this->_sCodeKey]) ? '' : $_GET[$this->_sCodeKey]; if (!empty($sCode) && preg_match('/^[A-Za-z0-9_-]+$/', $sCode) && file_exists($this->_sRootPath . 'templates/tmpl_' . $sCode) && !is_file($this->_sRootPath . 'templates/tmpl_' . $sCode)) { $this->_sCode = $sCode; $aUrl = parse_url($GLOBALS['site']['url']); $sPath = isset($aUrl['path']) && !empty($aUrl['path']) ? $aUrl['path'] : '/'; if (!bx_get('preview')) { setcookie($this->_sCodeKey, $this->_sCode, time() + 60 * 60 * 24 * 365, $sPath); } if (isset($_GET[$this->_sCodeKey])) { bx_import('BxDolPermalinks'); $oPermalinks = new BxDolPermalinks(); if ($oPermalinks->redirectIfNecessary(array($this->_sCodeKey))) { exit; } } } $this->_sKeyWrapperHtml = '__'; $this->_sFolderHtml = ''; $this->_sFolderCss = 'css/'; $this->_sFolderImages = 'images/'; $this->_sFolderIcons = 'images/icons/'; $this->_aTemplates = array(); $this->addLocation('system', $this->_sRootPath, $this->_sRootUrl); $this->addLocationJs('system_inc_js', BX_DIRECTORY_PATH_INC . 'js/', BX_DOL_URL_ROOT . 'inc/js/'); $this->addLocationJs('system_inc_js_classes', BX_DIRECTORY_PATH_INC . 'js/classes/', BX_DOL_URL_ROOT . 'inc/js/classes/'); $this->addLocationJs('system_plugins_jquery', BX_DIRECTORY_PATH_PLUGINS . 'jquery/', BX_DOL_URL_PLUGINS . 'jquery/'); $this->addLocationJs('system_plugins_tinymce', BX_DIRECTORY_PATH_PLUGINS . 'tiny_mce/', BX_DOL_URL_PLUGINS . 'tiny_mce/'); $this->_bCacheEnable = !defined('BX_DOL_CRON_EXECUTE') && getParam('sys_template_cache_enable') == 'on'; $this->_sCacheFolderUrl = ''; $this->_sCachePublicFolderUrl = BX_DOL_URL_CACHE_PUBLIC; $this->_sCachePublicFolderPath = BX_DIRECTORY_PATH_CACHE_PUBLIC; $this->_sCacheFilePrefix = "bx_templ_"; $this->_bImagesInline = getParam('sys_template_cache_image_enable') == 'on'; $this->_iImagesMaxSize = (int) getParam('sys_template_cache_image_max_size') * 1024; $bArchive = getParam('sys_template_cache_compress_enable') == 'on'; $this->_bCssCache = !defined('BX_DOL_CRON_EXECUTE') && getParam('sys_template_cache_css_enable') == 'on'; $this->_bCssArchive = $this->_bCssCache && $bArchive; $this->_sCssCachePrefix = $this->_sCacheFilePrefix . 'css_'; $this->_bJsCache = !defined('BX_DOL_CRON_EXECUTE') && getParam('sys_template_cache_js_enable') == 'on'; $this->_bJsArchive = $this->_bJsCache && $bArchive; $this->_sJsCachePrefix = $this->_sCacheFilePrefix . 'js_'; }
if (!$sCurrentLanguage) { echo '<br /><b>Fatal error:</b> Cannot apply localization.'; exit; } require_once BX_DIRECTORY_PATH_ROOT . "langs/lang-{$sCurrentLanguage}.php"; } require_once BX_DIRECTORY_PATH_INC . 'db.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'params.inc.php'; if (!defined('BX_SKIP_INSTALL_CHECK')) { getCurrentLangName(true); if (isset($_GET['lang'])) { bx_import('BxDolPermalinks'); $oPermalinks = new BxDolPermalinks(); if ($oPermalinks->redirectIfNecessary(array('lang'))) { exit; } } } function getCurrentLangName($isSetCookie = true) { $sLang = ''; if (!$sLang && !empty($_GET['lang'])) { $sLang = tryToGetLang($_GET['lang'], $isSetCookie); } if (!$sLang && !empty($_POST['lang'])) { $sLang = tryToGetLang($_POST['lang'], $isSetCookie); } if (!$sLang && !empty($_COOKIE['lang'])) { $sLang = tryToGetLang($_COOKIE['lang']);