<?php
$obj_tab_article=new cls_tab_article();
(!isset($get_id))?$get_id=0:$get_id=intval($get_id);
$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."article where article_id='".$get_id."'");
$this_article=array();
$this_channel=array();
$arr_app=array();
$this_html=array();
if($obj_rs = $obj_db->fetch_array($obj_result))
{
	$arr_uid=array();
	$obj_result2 = $obj_db->query("SELECT * FROM ".DB_PRE."article_channel where channel_id='".$obj_rs["article_channel_id"]."'");
	if($obj_rs2 = $obj_db->fetch_array($obj_result2)){
		$this_channel=$obj_rs2;
		$arr_app=$obj_tab_article->get_app($this_channel["channel_article_tpl"],$this_channel["channel_htmldir"]);
		//检测是否生成静态文件，是则改变文件名;
		if($this_channel["channel_savehtml"]==1){
			$str_html_dir="";
			if(!empty($this_channel["channel_htmldir_split"])) $str_html_dir=date($this_channel["channel_htmldir_split"],$obj_rs["article_addtime"])."/";
			$this_html["path"]=$arr_app["htmldir"]."/".$str_html_dir.$obj_rs["article_id"].".html";
			$this_html["url"]=WEB_URL.$arr_app["htmldir"]."/".$obj_rs["article_id"].".html";
		}
	}
	$obj_rs["article_addtime"]=format_date($obj_rs["article_addtime"],"Y-m-d");
	if($obj_rs["article_source"]=="") $obj_rs["article_source"]="互联网";
	$obj_rs["article_content"]=format_request($obj_rs["article_content"],true);
	$this_article=$obj_rs;
	//上一篇
	$this_pre="没有了";
	$obj_result2 = $obj_db->query("SELECT article_id,article_title FROM ".DB_PRE."article where article_id>'".$obj_rs["article_id"]."' and article_folder_id='".$this_article["article_folder_id"]."' order by article_id limit 0,1");
	if($obj_rs2 = $obj_db->fetch_array($obj_result2)){
		if($this_channel["channel_savehtml"]==1){
			$str_url=WEB_URL.$arr_app["htmldir"]."/".$obj_rs2["article_id"].".html";
		}else{
			$str_url=WEB_URL."/index.php?app=".$arr_app["app"]."&apppath=".$arr_app["path"]."&id=".$obj_rs2["article_id"];
		}
		$obj_rs2["url"]=$str_url;
		$this_pre="<a href='".$str_url."'>".$obj_rs2["article_title"]."</a>";
	}
	//下一篇
	$this_next="没有了";
	$obj_result2 = $obj_db->query("SELECT article_id,article_title FROM ".DB_PRE."article where article_id<'".$obj_rs["article_id"]."' and article_folder_id='".$this_article["article_folder_id"]."' order by article_id desc limit 0,1");
	if($obj_rs2 = $obj_db->fetch_array($obj_result2)){
		if($this_channel["channel_savehtml"]==1){
			$str_url=WEB_URL.$arr_app["htmldir"]."/".$obj_rs2["article_id"].".html";
		}else{
			$str_url=WEB_URL."/index.php?app=".$arr_app["app"]."&apppath=".$arr_app["path"]."&id=".$obj_rs2["article_id"];
		}
		$obj_rs2["url"]=$str_url;
		$this_next="<a href='".$str_url."'>".$obj_rs2["article_title"]."</a>";
	}
	$arr_hot=array();
	$arr_about=array();
	//热门
	$obj_result2 = $obj_db->query("SELECT article_id,article_title FROM ".DB_PRE."article where article_channel_id='".$this_article["article_channel_id"]."' order by article_hits desc limit 0,10");
	while($obj_rs2 = $obj_db->fetch_array($obj_result2)){
		if($this_channel["channel_savehtml"]==1){
			$str_url=WEB_URL.$arr_app["htmldir"]."/".$obj_rs2["article_id"].".html";
		}else{
			$str_url=WEB_URL."/index.php?app=".$arr_app["app"]."&apppath=".$arr_app["path"]."&id=".$obj_rs2["article_id"];
		}
		$obj_rs2["url"]=$str_url;
		$arr_hot[]=$obj_rs2;
	}
	//相关
	$obj_result2 = $obj_db->query("SELECT article_id,article_title FROM ".DB_PRE."article where article_folder_id='".$this_article["article_folder_id"]."' order by article_id desc limit 0,10");
	while($obj_rs2 = $obj_db->fetch_array($obj_result2)){
		if($this_channel["channel_savehtml"]==1){
			$str_url=WEB_URL.$arr_app["htmldir"]."/".$obj_rs2["article_id"].".html";
		}else{
			$str_url=WEB_URL."/index.php?app=".$arr_app["app"]."&apppath=".$arr_app["path"]."&id=".$obj_rs2["article_id"];
		}
		$obj_rs2["url"]=$str_url;
		$arr_about[]=$obj_rs2;
	}
}else{
	exit("您要找的文章不存在！");
}
?>