<?php

if (!defined('IN_HANFOX')) exit('Access Denied');



$pagename = '货源详情';

$pageurl = '?mod=detail';

$tempfile = 'detail.html';

$table = $DB->table('huoyuan');



$huoyuan_id = intval($_GET['wid']);

$cache_id = $huoyuan_id;


	

if (!$smarty->isCached($tempfile, $cache_id)) {

	$where = "w.huoyuan_status=3 AND w.huoyuan_id=$huoyuan_id";

	$huoyuan = get_one_huoyuan($where);
   
	if (!$huoyuan) {

		unset($huoyuan);

		redirect('./?mod=index');

	}
		


	

	$DB->query("UPDATE $table SET huoyuan_views=huoyuan_views+1 WHERE huoyuan_id=".$huoyuan['huoyuan_id']." LIMIT 1");

	

	$cate = get_one_category($huoyuan['cate_id']);
	

	$user = get_one_user($huoyuan['user_id']);

	

	$smarty->assign('site_title', $huoyuan['huoyuan_name'].' - '.$cate['cate_name'].' - '.$options['site_name']);

	$smarty->assign('site_keywords', !empty($huoyuan['huoyuan_tags']) ? $huoyuan['huoyuan_tags'] : $options['site_keywords']);

	$smarty->assign('site_description', !empty($huoyuan['huoyuan_intro']) ? $huoyuan['huoyuan_intro'] : $options['site_description']);

	$smarty->assign('site_path', get_sitepath($cate['cate_mod'], $huoyuan['cate_id']).' &raquo; '.$pagename);
	
	$smarty->assign('site_cate', get_sitecate($cate['cate_mod'], $huoyuan['cate_id']));
	
	$smarty->assign('site_area', get_sitearea($area['area_mod'], $area['area_id']));

	$smarty->assign('site_rss', get_rssfeed($cate['cate_mod'], $huoyuan['cate_id']));

	

	$smarty->assign('cate_id', $cate['cate_id']);
    $smarty->assign('area_id', $area['area_id']);
	$smarty->assign('cate_name', $cate['cate_name']);
    $smarty->assign('area_name', $area['area_name']);
	$smarty->assign('cate_keywords', $cate['cate_keywords']);

	$smarty->assign('cate_description', $cate['cate_description']);
	
	
	
	$huoyuan['huoyuan_content'] = str_replace('[upload_dir]', $options['site_root'].$options['upload_dir'].'/', $huoyuan['huoyuan_content']);

	$huoyuan['huoyuan_furl'] = format_url($huoyuan['huoyuan_id']);

	$huoyuan['huoyuan_pic'] = get_webthumb($huoyuan['huoyuan_pic'],$huoyuan['huoyuan_id']);



	$huoyuan['huoyuan_ctime'] = date('Y-m-d', $huoyuan['huoyuan_ctime']);


	

	/** tags */

	$huoyuan_tags = get_format_tags($huoyuan['huoyuan_tags']);

	$smarty->assign('huoyuan_tags', $huoyuan_tags);

	

    $smarty->assign('huoyuan', $huoyuan);

	$smarty->assign('user', $user);

	$smarty->assign('related_huoyuan', get_huoyuan($huoyuan['cate_id'], 10, false, false, 'ctime'));

}


		

smarty_output($tempfile, $cache_id);


?>