public function check_authentification() { // begin authenticate part if (AUTH_TYPE == 1) { if (!$AUTHENTICATE) { header("WWW-Authenticate: Basic realm=\"ADMIN " . CONF_SITE_NAME . "\""); header("HTTP/1.0 401 Unauthorized"); $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "template_firstpage.html", "content" => "authentication_failed.html")); $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("BODY", array("content", "main")); $ft->showDebugInfo(ERROR_DEBUG); $ft->FastPrint(); exit; } } else { if (AUTH_TYPE == 2) { include_once INCLUDE_PATH . 'cls_session.php'; $sess = new MYSession(); if (!$sess->get(SESSION_ID)) { $sess->set('session_url_before', $_SERVER['REQUEST_URI']); header("Location: login.php"); exit; } } } // end authenticate part }
function ShowProduct($id_product) { $objResponse = new xajaxResponse(); $bError = false; $stringutil = new String(""); $tempname = "en_title"; $tempdescription = "en_detaileddescription"; $SQL = "SELECT {$tempname},{$tempdescription} FROM " . DB_PREFIX . "product WHERE id_product='" . $id_product . "'"; //$objResponse->addAlert($SQL); $retid = mysql_query($SQL); if (!$retid) { echo mysql_error(); } if ($row = mysql_fetch_array($retid)) { $name = $row[$tempname]; $description = $stringutil->cleanDescription2($row[$tempdescription]); } $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main" => "product_rightmenu.html")); $ft->assign("NAME", $name); //if (NONSEO==1) $ft->assign("URL_TYPE", "product.php?name=".$stringutil->CleanLink($name)."&id=".$id_product.""); //else $ft->assign("URL_TYPE", "product.php/".$stringutil->CleanLink($name)."/".$id_product."/"); $ft->assign("DESCRIPTION", $description); $ft->multiple_assign_define("LANG_"); $ft->parse("mainContent", "main"); $ft->showDebugInfo(ERROR_DEBUG); $c = $ft->fetch("mainContent"); //$objResponse->addAlert($c); $objResponse->addAssign("body_firstpage_background_right", "innerHTML", $c); return $objResponse; }
// segitseg, szovegek $ft->assign("VARIABLE_TEXT", $variable_text); if ($all_url_vars["msg"] == 1) { $ft->assign("SAVED_MSG", 1); } else { $ft->assign("SAVED_MSG", 0); } if (strpos($files_array[$template_name], ".bak") === false) { $ft->assign("BAK_FILE", 0); } else { $ft->assign("BAK_FILE", 1); } $ft->assign("TEMPLATE_NAMES", $buffer); $ft->assign("TEMPLATE_NAME", $files_array[$template_name]); $ft->assign("TEMPLATE_DESCRIPTION", $temp_source); $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->assign("SIDEBAR", $sb->getSideBar()); $ft->parse("BODY", array("content", "main")); $ft->showDebugInfo(ERROR_DEBUG); $ft->FastPrint(); } else { $template_name = $all_url_vars["t_name"]; $template_source = $_REQUEST["template_source"]; $template_source = str_replace("#_", "{", $template_source); $template_source = str_replace("_#", "}", $template_source); $template_source = str_replace("textarea#", "textarea", $template_source); $template_source = str_replace("BDYB", "BEGIN DYNAMIC BLOCK", $template_source); $template_source = str_replace("EDYB", "END DYNAMIC BLOCK", $template_source); $template_source = html_entity_decode($template_source); rename(INDEX_PATH . $template_name, INDEX_PATH . $template_name . ".bak");
/** * * @author - Elteto Zoltan * @desc - get the sidebar from table * @vers - 1.0 */ public function getSideBar() { $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "sidebar.html")); $template = $ft->get_template("sidebar.html"); $var_array = $ft->getPrefPatternVariables("IS_", $template); // only show if is available $SQL = "SELECT * FROM `" . DB_PREFIX . $this->table_name . "` WHERE availability=1 ORDER BY `position` ASC"; $retid = mysql_query($SQL); if (!$retid) { echo mysql_error(); } $i = 0; if ($row = mysql_fetch_array($retid)) { do { $module_id[$i] = $row["module_id"]; $module_name[$i] = $row["module_name"]; $availability[$i] = $row["availability"]; $filename[$i] = $row["filename"]; $extra_menu[$i] = $row["extra_menu"]; $restriction_name[$i] = $row["restriction_name"]; $i++; } while ($row = mysql_fetch_array($retid)); } $nrmodules = $i; if ($nrmodules == 0) { $ft->assign("SIDEBAR_EXIST", 0); } else { $ft->assign("SIDEBAR_EXIST", 1); $ft->setPattern(array("LANG_", "CONF_")); $ft->define_dynamic("sideex", "main"); for ($i = 0; $i < $nrmodules; $i++) { $ft->assign("MODULE_NAME", constant($module_name[$i])); $ft->assign("FILENAME", $filename[$i]); //restriction if (!empty($restriction_name[$i])) { $tmp = array($restriction_name[$i]); foreach ($var_array as $value) { $ft->assign("{$value}", in_array($value, $tmp) ? 0 : 1); } } else { foreach ($var_array as $value) { $ft->assign("{$value}", 1); } } // could be extra details what admin want to show. This is in extra_menu field. if (!empty($extra_menu[$i])) { $var_lang_array = $ft->getPrefPatternVariables("LANG_", $extra_menu[$i]); foreach ($var_lang_array as $language) { $extra_menu[$i] = str_replace("{" . $language . "}", constant($language), $extra_menu[$i]); } $ft->assign("ISEXTRA_MENU", 1); $ft->assign("EXTRA_MENU", $extra_menu[$i]); } else { $ft->assign("ISEXTRA_MENU", 0); } $ft->parse("SIDEEX", ".sideex"); } } $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("mainContent", "main"); return $ft->fetch("mainContent"); }