<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




if(!defined('IN_SITETEAM')) { exit('Access Denied'); } require_once "include/data_safe.php"; if (!empty($_POST['dosubmit'])) { $category = empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']; $key = $_COOKIE['key']; if (empty($key)) { go_url("admin.php?action=product&operation=list&category={$category}", "缺少category参数！"); } if (empty($_POST['data']['name']) || empty($_POST['data']['keywords']) || empty($_POST['data']['content'])) { go_url("post.php?action=product", "必填项不能为空"); } if (!empty($_FILES['ptitle']['name'])) { if (!in_array($_FILES['ptitle']['type'], array("image/pjpeg", "image/gif", "image/jpeg", "image/png", "image/jpg", "image/jp2"))) { go_url("post.php?action=product", "你所上传的图片格式不正确！请按说明上传"); } } if (!empty($category)) { $category_dir = $user_product_dir . "/{$category}"; if (!file_exists($category_dir))mkdir($category_dir); } $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; $year_dir = date("Y", $key); $month_dir = date("md", $key); $attach_year_dir = "{$user_product_upload_dir}/" . date("Y", $key); $attach_month_dir = "{$attach_year_dir}/" . date("md", $key); if(!file_exists($attach_year_dir)) mkdir($attach_year_dir); if(!file_exists($attach_month_dir)) mkdir($attach_month_dir); $default_structure_file = SITE_ROOT . "/data/default.product.structure.txt"; $default_structure = read_array_file($default_structure_file); $diy_structure_file = $user_data_dir . "/product.structure.txt"; if (file_exists($diy_structure_file)) { $diy_structure = read_array_file($diy_structure_file); $forum_structure = array_merge($default_structure, $diy_structure); } else { $forum_structure = $default_structure; } $savedata = $_POST['data']; $data = array(); foreach ($forum_structure as $k => $v) { if ($k != 'content') { $data[$k] = empty($savedata[$k]) ? '' : strip_tags($savedata[$k]); } } $savedata['content'] = stripslashes($savedata['content']); $data['content'] = $savedata['content']; $data['key'] = $key; $data['pass'] = 4; $data['status'] = 1; if (!empty($_FILES['ptitle']['name'])) { $fileinfo = pathinfo($_FILES['ptitle']['name']); $filename = "{$user_product_upload_dir}/{$year_dir}/{$month_dir}/{$key}.{$fileinfo['extension']}"; if (file_exists($filename)) unlink($filename); if (move_uploaded_file($_FILES['ptitle']['tmp_name'],$filename)) { img_resize($filename, 118, 70); $data['ptitle'] = str_replace(SITE_ROOT . '/', '', $filename); } } for($i = 1; $i <= 8 ; $i++) { $data['product_pic']["pic_{$i}"] = ''; } save_array_file($data, $product_info_file); update_product_index($category); update_product_all_index();; $temp = SITE_PATH . "/?{$site_product_list_url}.html"; $html = url_rewrite($temp, 'url'); go_url($html, "你所发布的信息，我们正在审核中，如有需要，请联系我们！"); } else { ob_start(); setcookie("key", time()); ob_end_flush(); ob_start(); eval(tpl_render($skinid, "post_product")); $html = ob_get_clean(); echo url_rewrite($html); } ?>