<?php
if(!defined('IN_TM'))exit('Access Denied');
if($id){
	$id = intval($id);
	$new = $db->get_one("SELECT * FROM ".DB_PRE."news WHERE `id` = '{$id}'");
	$head['title'] = $new[title].'-'.$TM['meta_title'];
	$head['keywords'] = $TM['meta_keywords'];
	$head['description'] = $TM['meta_description'];
	$title = $new[title];
	$body = $new[body];
	$time = date("YÄê-mÔÂ-dÈÕ hÊ±:i·Ö", $new[time]);
	$zz = $new[zz];
	$ly= $new[ly];
	$hist= $new[hist];
	$db->query("UPDATE ".DB_PRE."news SET hist = hist+1 WHERE id ={$id};");
	$db->close();
	$tplid=1;
	include view('news');
}elseif($fid){
	$fid = intval($fid);
	$page = max(intval($page), 1);
	$page_size = 15; 
	$r = $db->get_one("SELECT count(*) as num FROM ".DB_PRE."news WHERE `ssfl` =$fid");
	$mpurl =$PHP_SELF.'?action=news&fid='.$fid.'&';
	$dispage =  page($r['num'],$page_size,$page,$mpurl);
	$newslist = get('news',"WHERE `ssfl` =$fid",'id DESC', $page, $page_size);
	$a = 'Y-m-d H:i';
	$tplid=2;
	$db->close();
	include view('news');
}else{
	$page = max(intval($page), 1);
	$page_size = 15; 
	$r = $db->get_one("SELECT count(*) as num FROM ".DB_PRE."news");
	$mpurl =$PHP_SELF.'?file=news&';
	$dispage =  page($r['num'],$page_size,$page,$mpurl);
	$newslist = get('news','','id DESC', $page, $page_size);
	$a = 'Y-m-d H:i';
	$tplid = 3;
	include view('news');
	$db->close();
	exit;
}
?>