if (strpos($productfilename, "http://") !== 0) { exit("指定的文件名已经存在"); } } $producttemplets = str_replace("{style}/", "", $producttemplets); $nowdate = date("Y-m-d H:i:s"); if (empty($productadddate)) { $productadddate = $nowdate; } $sql = "INSERT INTO yiqi_product (pid ,name ,cid ,thumb,seotitle ,seokeywords ,seodescription,content ,adddate ,lasteditdate,filename ,templets,status)" . "VALUES (NULL, '{$productname}', '{$productcategory}', '{$productthumb}','{$productseotitle}', '{$productkeywords}', '{$productdescription}', '{$productcontent}', '{$productadddate}', '{$nowdate}','{$productfilename}', '{$producttemplets}', 'ok')"; $result = $yiqi_db->query(CheckSql($sql)); if ($result == 1) { $pid = $yiqi_db->insert_id; $genehtml = getset("urlrewrite")->value; if ($genehtml == "html") { $product = $productdata->GetProduct($pid); $product->content = mixkeyword($product->content); $tempinfo->assign("product", $product); if (!$tempinfo->template_exists($product->templets)) { exit("没有找到文章模板,请与管理员联系!"); } $source = $tempinfo->fetch($product->templets); $urlparam = array('name' => $productfilename, 'type' => 'product', 'generatehtml' => 1); $fileurl = formaturl($urlparam); $cachedata->WriteFileCache(YIQIROOT . "/" . $fileurl, $source, true); } //添加附加属性 $idarr = $_POST["chk"]; if (count($idarr) > 0) { foreach ($idarr as $id) { $varname = $_POST["extname"];
public function getProduct($id) { $this->mProducts = Product::GetProduct($id); echo json_encode($this->mProducts); }
<?php require_once 'admin.inc.php'; require_once '../include/product.class.php'; require_once '../include/category.class.php'; $pid = $_GET['pid']; $pid = isset($pid) && is_numeric($pid) ? $pid : 0; $posttype = 'product'; $productdata = new Product(); $product = $productdata->GetProduct($pid, true); if ($product == null) { header("location:product.php"); exit; } $postmeta = $metadata->GetMetaList($posttype, $pid); $pmcount = count($postmeta); $metavalue = array(); if ($pmcount > 0) { foreach ($postmeta as $metainfo) { $metavalue[] = $metainfo->metaname; } } $action = $_POST['action']; if ($action == 'save') { $productname = $_POST['productname']; $productcategory = $_POST['productcategory']; $productseotitle = $_POST["productseotitle"]; $productkeywords = $_POST['productkeywords']; $productdescription = $_POST['productdescription']; $productcontent = $_POST['productcontent']; $producttemplets = $_POST['producttemplets'];