header('Content-Type: text/html; charset=gb2312');
require "../inc/global.php";
require "../inc/function.php";
if ($_REQUEST["pageID"]=="") { $pageID=20;} else{ $pageID=$_REQUEST["pageID"]; }
$page=empty($_REQUEST["page"])? 0 : $_REQUEST["page"];
$start= $page * 16;
$where = "kind = 5";
$db=new db();
// echo "
start=".$start." end=".$end."
";
$sql="select id,title,date,kick from cy_info where kind = 5 order by id desc LIMIT ".$start." , 16";
$query = $db->query($sql);
$i=0;
while($forum = $db->fetch_array($query)) {
$news[$i]['id'] = $forum['id'];
$news[$i]['title'] = $forum['title'];
$news[$i]['date'] = date("Y-m-d",strtotime($forum['date']));
$news[$i]['kick'] = $forum['kick'];
$i++;
}
$id = empty($_REQUEST['id'])? $news[0]['id'] : $_REQUEST['id'];
$sql="select title,kick,text from cy_info where kind = 5 and id =".$id;
$query = $db->query($sql);
$forum = $db->fetch_array($query);
$newstitle = $forum['title'];$body =html_entity_decode($forum['text'],ENT_QUOTES);$kick = $forum['kick'] + 1;
$body = str_replace("","[img]",$body);
$body = str_replace("/web_7_1","..",$body);
$body = str_replace("http://www.changye.com.cn","",$body);
$body = explode("[img]",$body);
$bodystr="";
for ($i=0; $i< count($body); $i++) {
if (news_img($body[$i])!=null) {
$bodystr = $bodystr."". news_img($body[$i]);
} else { $bodystr = $bodystr."". $body[$i] ;}
}
//echo $id;
$sql="update cy_info set kick='$kick' where id=$id";
$db->query($sql);
$pages = $db->row_count("cy_info",$where);
$pagestr = view_pages($pages,$page);
//echo $pagestr;
$viewdata = array("pageID" => $pageID ,
"siteinfo" => $siteinfo,
"sitename" => $sitename,
"news" => $news,
"pagestr" => $pagestr,
"page" => $page,
"newstitle" => $newstitle,
"body" => $bodystr,
"menu" => showmenu($pageID)
);
$tplname= CModel($_SERVER["SCRIPT_NAME"]);
callview($viewdata,$tplname);
?>