<?php

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



$pagename = '微信详情';

$pageurl = '?mod=wx';

$tempfile = 'wx.html';

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



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

$cache_id = $wx_id;


	

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

	$where = "w.wx_status=3 AND w.wx_id=$wx_id";

	$wx = get_one_weixin($where);
   
	if (!$wx) {

		unset($wx);

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

	}
		


	

	$DB->query("UPDATE $table SET wx_views=wx_views+1 WHERE wx_id=".$wx['wx_id']." LIMIT 1");

	

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

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

	

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

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

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

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

	$smarty->assign('site_rss', get_rssfeed($cate['cate_mod'], $wx['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']);
	
	
	
	$wx['wx_content'] = str_replace('[upload_dir]', $options['site_root'].$options['upload_dir'].'/', $wx['wx_content']);

	$wx['wx_furl'] = format_url($wx['wx_id']);

	$wx['wx_pic'] = get_webthumb($wx['wx_pic'],$wx['wx_id']);



	$wx['wx_ctime'] = date('Y-m-d', $wx['wx_ctime']);


	

	/** tags */

	$wx_tags = get_format_tags($wx['wx_tags']);

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

	

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

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

	$smarty->assign('related_wx', get_wx($wx['cate_id'], 10, false, false, 'ctime'));

}


		

smarty_output($tempfile, $cache_id);


?>