function GetStorefrontTemplate($CatID) { $db = new clsDBNetConnect(); $query = "select * from categories where cat_id='" . $CatID . "'"; $db->query($query); $db->next_record(); if ($db->f("sub_cat_id") == 1) { $query = "select template from templates_storefront where cat_id=" . $CatID . " and active=1 and admin_override=1 ORDER BY cat_id DESC LIMIT 1"; $db->query($query); if ($db->next_record()) { $file = "temp_templates/" . gen_rand(8) . ".html"; $fp = fopen($file, "w"); fwrite($fp, $db->f("template"), strlen($db->f("template"))); fclose($fp); } else { $file = "templates/ViewCat.html"; } } else { $file = "templates/ViewCat.html"; } return $file; }
function PreviewTemplate($page) { $randname = gen_rand(8); $file = "../temp_templates/" . $randname . ".html"; $fp = fopen($file, "w"); fwrite($fp, stripslashes($_POST["page_temp"]), strlen(stripslashes($_POST["page_temp"]))); fclose($fp); return $randname; }