<?
include "config.inc.php";

switch($_GET[ctype]){
case "music":
break;
case "bbs":
###bbs feeds####
	$bbs_db = $PlusDB->prefix("bbs");
	$cid = $_GET[cid];
	$order  = $_GET[order];
	$limit = $_GET[limit]?$_GET[limit]:10;
	##判断排序方式
	switch($order){
	case "hit_desc":$org = " and order by hits desc";break;
	case "hit_asc":$org= " and order by hits asc";break;
	case "date_desc":$org = "order by lastrly desc";break;
	case "date_asc":default:$org = "order by lastrly asc";
	}
	$sql="select id,title,uname,ctime,lastrly,hits,icon,cid  from $bbs_db  where pid=0 and cid='$cid' $org ";
	$rt=$PlusDB->selectLimit($sql,$limit,0);
	//开始显示表格
	$ret = "<table width=100% border=0  cellpadding=0 cellspacing=1 bgcolor=#5a7594 >";
	while($row=$rt->fetchRow()){
	$id = $row[id];//帖子id
	$title = $row[title];//帖子标题
	$uname = $row[uname];//发贴人
	$ctime = $row[ctime];//主题建立的时间
	$lastrly = $row[lastrly];//最后回复时间
	$hits = $row[hits];//人气
	$icon = $row[icon];//主题的icon
	$ret.="    <TR bgcolor=#FFFFFF> 
      <TD><IMG 
                              src=\"".PLUS_URL."/modules/bbs/images/icon".$icon.".gif\" 
                              border=0></TD>
      <TD bgcolor=#E5E5E5><A href=\"index.php?cid=".$cid."&action=viewThread&postid=".$id."\" target=_blank><IMG 
                              src=\"".PLUS_URL."/modules/bbs/images/newwin.gif\" title=\"新窗口打开\" 
                              border=0></a></TD>
      <TD width=\"40%\">&nbsp;&nbsp;&nbsp;<A href=\"index.php?cid=".$cid."&action=viewThread&postid=".$id."\">".$title."</A></TD>
      <TD bgcolor=#E5E5E5>".$uname."</TD>
      <TD bgcolor=#E5E5E5>".$hits."</TD>
      <TD width=\"15%\">".$lastrly."</TD>
    </TR>";
	}
	$ret.="</table>";
break;
}
	if($ret>""){
	$ret=str_replace("\r\n","",addslashes($ret));
	echo "document.write(\"$ret\");";
	}
?>