Sivustoa päivitetään

'; include("admin/config.php"); include(CLASS_DIR."/sm_query.php"); include(CLASS_DIR."/sm_components.php"); include(CLASS_DIR."/sm_navigation.php"); include(CLASS_DIR."/sm_debug.php"); include(CLASS_DIR."/sm_site.php"); include(CLASS_DIR."/sm_languages.php"); include(CLASS_DIR."/sm_system.php"); $url = $_SERVER[REQUEST_URI]; $servername = $_SERVER[SERVER_NAME]; if ($servername == "www.elker.fi") $site = 1; if ($servername == "elker.fi") $site = 1; define("SITE_ID", $site); if ($url=="/") $url = DEFAULT_URL; $q = parse_url($url); $query = $q[query]; $url = $q[path]; $navi = new Navigation(); $navi->getNaviInfo($url); //=== get basic data to be used by custom components $GLOBALS[navi] = $navi; $GLOBALS[id] = $navi->id; $GLOBALS[parent] = $navi->parent; $GLOBALS[naviname] = $navi->naviname; $GLOBALS[navigation] = $navi->navigation; $GLOBALS[level] = $navi->level; $GLOBALS[naviLink] = ""; $GLOBALS[dirMode] = "admin/"; $GLOBALS[breadCrumbs] = $navi->breadCrumbs(); $GLOBALS[query] = $query; $components = new Components(true); $components->naviId = $id; //=== require template html from database $html = Template::getTemplate($navi->template_id); $html = str_replace('="images', '="/images', $html); $html = str_replace("'images", "'/images", $html); $html = str_replace('href="style', 'href="/style', $html); //=== replace all language tags [lang_] to get localization $preg1 = '/\[lang_.*?\]/'; preg_match_all($preg1, $html, $out, PREG_SET_ORDER); $languages = new Languages(); foreach ($out as $val) { $tag = $val[0]; $localText = $languages->getLocal($navi->naviLang, $tag); $html = str_replace($tag, $localText, $html); } //=== replace all system tags [system_] $preg1 = '/\[system_.*?\]/'; preg_match_all($preg1, $html, $out, PREG_SET_ORDER); $system = new SystemVars(); foreach ($out as $val) { $tag = $val[0]; $localText = $system->getValue($tag); $html = str_replace($tag, $localText, $html); } //=== get components, replace all [sm_] -tags $preg1 = '/\[sm_.*?\]/'; preg_match_all($preg1, $html, $out, PREG_SET_ORDER); foreach ($out as $val) { $tag = $val[0]; if ( strpos($tag, "sm_container") ){ $codex = $components->getContainerComponents($tag); } else if ( strpos($tag, "sm_edit") ){ $codex = $components->getEditableComponents($tag); } else if ( strpos($tag, "sm_content") ){ $content = new Content(); $codex = $content->getBasicContent($GLOBALS[id], false); } else { $codex = $components->getBasicComponents($tag); } $code = stripslashes($codex); $html = str_replace($tag, $code, $html); } //=== print out the final page print eval("?>".$html."