<?php 


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




if(!defined('IN_SITETEAM')) { exit('Access Denied'); } define("CURSCRIPT", "product"); if (SITE_REWRITE) { if (preg_match("/^\/\?/i", $_SERVER['REQUEST_URI'])) { $page_url = "http://{$site_url}{$_SERVER['REQUEST_URI']}"; $page_url = url_rewrite($page_url, 'url'); header("HTTP/1.1 301 Moved Permanently"); header("Location:{$page_url}"); exit(); } } $category = $GETS[1]; $key = $GETS[2]; $cache_product_list_dir = SITE_ROOT . "/data/tpl/{$site_url}"; $cache_product_html = "{$cache_product_list_dir}/product/html/" . md5($category . $key) . ".html"; if (file_exists($cache_product_html) && time() - filemtime($cache_product_html) < CACHE_TIME && IN_CACHE) { include $cache_product_html; exit(); } foreach ($product_category as $k=>$v) { $sortid[$k] = array_key_exists("sortid", $v) ? $v['sortid'] : 0; } array_multisort($sortid, SORT_NUMERIC, SORT_DESC, $product_category); $product_info = read_array_file(SITE_ROOT . "/data/setting/{$site_url}/product/{$category}/{$key}.txt"); if (empty($product_info)) { header("HTTP/1.1 301 Moved Permanently"); $page_url = "http://{$site_url}/?{$site_product_list_url}.html"; $page_url = url_rewrite($page_url, 'url'); header("Location:{$page_url}"); } if (empty($product_info['seo_title'])) $product_info['seo_title'] = "{$product_info['name']}，{$site_title}"; foreach ($product_info as $k => $v) { if ($k == 'seo_keywords') continue; if ($k == 'seo_description') continue; if(empty($v) && array_key_exists($k, $setting)) $product_info[$k] = $setting[$k]; } extract($product_setting); extract($product_info); if (empty($seo_description)) { $seo_t_content = preg_replace("/[\s]+/", "", (strip_tags($content))); $seo_t_keywords = preg_split("/，|,|\./", preg_replace("/[\s]+/", "", $site_keywords), "-1"); $seo_description = str_sub($seo_t_content, 250, '…'); $seo_description = preg_replace("/&amp;|nbsp;/", "", $seo_description); $seo_description = preg_split("/，|。|：|！|？|,|\.|\:|\!|\?|-|_|\|/", $seo_description, "-1"); if (count($seo_description)) { foreach ($seo_description as $k => $v) { $keywords = array_pop($seo_t_keywords); if (!empty($keywords)) { $seo_description[$k] .= "，{$keywords}"; } } } $seo_description = implode("，", $seo_description); $seo_description = "{$site_title} - {$product_category[$category]['name']} - {$pname} ：{$seo_description}"; } $banner_ad = ''; $banner_flv = $first_bgsound = ""; if (!empty($recent_link)) { $recent_link=explode("\n", $recent_link); foreach($recent_link as $k=>$v){ $v = trim($v); if(empty($v)) { continue; } else { $recent_links[] = explode("|", $v); } } } else { $recent_links = array(); } $product_pic_num = 0; foreach($product_pic as $k => $v) { if(empty($v))continue; $product_pic_num++; } ubbcode($content); if (SITE_REWRITE) { $content = preg_replace('/src=(["|\']{1})attachments/is', 'src=$1' . SITE_PATH . '/attachments', $content); $content = preg_replace('/href=(["|\']{1})attachments/is', 'href=$1' . SITE_PATH . '/attachments', $content); } ob_start(); @eval(tpl_render($skinid, "product")); $html = ob_get_clean(); $html = url_rewrite($html); if (CACHE_TIME > 0 && IN_CACHE) { if (!file_exists("{$cache_product_list_dir}/product/html")) { if (!file_exists($cache_product_list_dir)) { mkdir($cache_product_list_dir); } if (!file_exists("{$cache_product_list_dir}/product")) { mkdir("{$cache_product_list_dir}/product"); } mkdir("{$cache_product_list_dir}/product/html"); } if ($fp = @fopen($cache_product_html, "w")) { if (@fwrite($fp, $html)) { @fclose($fp); echo $html; } else { exit(siteteam_sys_msg(3)); } } else { exit(siteteam_sys_msg(3)); } } else { echo $html; } ?>