<?php
require("../class/connect.php");
include("../class/config.php");
include("../class/db_sql.php");
include("../class/q_functions.php");
include("../class/class.php");
include LoadLang("pub/fun.php");
include("../class/user.php");
$link=db_connect();
$empire=new mysqlquery();
$search='';
include('CheckUser.php');//验证用户
//模型
$mid=intval($_GET['mid']);
if(!$mid)
{
	printerror("ErrorUrl","",1);
}
$mr=$empire->fetch1("select tbname,qmname from {$dbtbpre}enewsmod where mid='$mid'");
if(!$mr['tbname'])
{
	printerror("ErrorUrl","",1);
}
$search.="&userid=$userid&mid=$mid";
//用户
$add="userid='$userid'";
//栏目
$classid=intval($_GET['classid']);
if($classid)
{
	if($class_r[$classid][islast])
	{
		$add.=" and classid='$classid'";
	}
	else
	{
		$add.=' and '.ReturnClass($class_r[$classid][sonclass]);
	}
	$search.="&classid=$classid";
}
$start=intval($_GET['start']);
$page=intval($_GET['page']);
$line=25;//每行显示
$page_line=16;
$offset=$start+$page*$line;
$query="select * from {$dbtbpre}ecms_".$mr['tbname']." where ".$add." and ismember=1 and checked=1";
$totalquery="select count(*) as total from {$dbtbpre}ecms_".$mr['tbname']." where ".$add." and ismember=1 and checked=1";
$totalnum=intval($_GET['totalnum']);
if(empty($totalnum))
{
	$num=$empire->gettotal($totalquery);//取得总条数
}
else
{
	$num=$totalnum;
}
$search.="&totalnum=$num";
$query.=" order by newstime desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
include('template/'.$spacestyle.'/list.temp.php');
db_close();
$empire=null;
?>