<?php
include_once("../inc/conn.php");
include_once("../inc/function.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
<TITLE>社区-<?=$web_name;?></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="<?=$web_description;?>" name="cescription">
<META content="<?=$web_keywords;?>" name="keywords">
<META content="MSHTML 6.00.3790.4426" name=GENERATOR>
<link href="../style/default.css" rel="stylesheet" type="text/css" />
<body>
<?php include_once("../top.php");
$query=$db->query("Select moderators from {$web_dbtop}bbs_section where id=".intval($_GET["forumsid"]));
   if($rs=$db->fetch_array($query)){
   		$moderators=$rs["moderators"];
   }
 ?>
<script language="javascript">
qiehuan(8);
document.getElementById('bbs_<?=$_GET["forumsid"];?>').className="current";
</script>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto">
<tr>
     <td width="387" height="20" style="margin:0px;padding:0px;"><img src="images/icon_homepage.gif"> <a href="../index.php"><?=$web_name?></a> - <a href="index.php">论坛</a></td>
     <td rowspan="2" align="right">
	 <? if(intval($_COOKIE["usersid"]) && $_GET["act"]!="search"){?>
	 <table border="0" cellspacing="0" cellpadding="0">
       <tr align="right">
         <td width="75"><a href="?act=mytz&forumsid=<?=$_GET["forumsid"]?>"><img src="images/mytz.gif" width="70" height="28"></a></td>
         <td width="75"><a href="?act=jh&forumsid=<?=$_GET["forumsid"]?>"><img src="images/jh.gif" width="70" height="28"></a></td>
         <td width="75"><a href='post.php?forumsid=<?=$_GET["forumsid"]?>'><img src="images/new_topic.gif" width="70" height="28" border="0"></a></td>
       </tr>
     </table>
	 <? }?>
	 </td>
  </tr>
   <tr>
     <td height="20" style="color: #999999;">版主：<? $moderators=explode(",",$moderators);
							foreach ($moderators as $usersbz){
								if($usersbz){
									if($usersbz==intval($_COOKIE["usersid"])){
										$bzshow=1;
									}
	  								echo showcontent("users","name",$usersbz)."&nbsp;&nbsp;";
								}
	  						}
							?></td>
   </tr>
</table>
<form action="" method="post" name="form">
 <table width="960" border="0" align="center" cellpadding="4" cellspacing="0" style="border: 1px solid #CAD9EA;margin:0 auto">
   <tr>
     <td width="40" height="28" align="center" background="images/menu_bg.gif">&nbsp;</td>
     <td background="images/menu_bg.gif">标题</td>
     <td width="150" background="images/menu_bg.gif">作者</td>
     <td width="100" align="center" background="images/menu_bg.gif">回复/查看</td>
     <td width="100" align="right" background="images/menu_bg.gif" style="padding-right:15px">最后发表</td>
   </tr>
   <?
   $i=0;
   if(empty($_GET['page'])){
	   $query=$db->query("Select * from {$web_dbtop}bbs_posts where if(top=1,section=".intval($_GET["forumsid"])." and top!=0,top!=0) Order by top desc,id desc");
	   while($rs=$db->fetch_array($query)){
	   $i++;
	   ?>
		<tr>
		 <td height="34" align="center" style="border-top:1px #CAD9EA solid;"><img src="images/<?=($rs["top"]==1?"topic_sticky.gif":"topic_sticky_2.gif")?>" width="24" height="24"></td>
		  <td class="font14" style="border-top:1px #CAD9EA solid;"><? if($bzshow==1){?><input name="id[]" type="checkbox" value="<?=$rs["id"]?>"><? }?><A href="read.php?forumsid=<?=$rs["section"]?>&threadsid=<?=$rs["id"]?>" <? if($rs["style"]!="") echo "style=\"".$rs["style"]."\"";?>><?=$rs["title"]?></a>  <? if($rs["digest"]==1){?><img src="images/icon_f_best.gif"><? }?></td>
		  <td style="border-top:1px #CAD9EA solid;"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="20%"><table width="22"  border="0" cellspacing="0" cellpadding="1" style="border:1px #cccccc solid;">
                  <tr>
                    <td><IMG onerror="this.src='../images/head/1_0.jpg'" src="../<?=showcontent("users","head",$rs["uid"])?>" width="22" height="22"></td>
                  </tr>
              </table></td>
              <td><A href="../user.php?id=<?=$rs["uid"]?>"><?=showcontent("users","name",$rs["uid"])?></A></td>
            </tr>
          </table></td>
		  <td align="center" style="border-top:1px #CAD9EA solid;color: #999999;"><?=f_reply_num($rs["id"])?>/<?=$rs["dj"]?></td>
		 <td align="right" style="border-top:1px #CAD9EA solid; padding-right:15px"><?=f_final_id($rs["id"])?></td>
	   </tr>
	   <?
	   }
   }
   ?>
   <tr>
     <td height="30" colspan="5" align="center" style="border-top:1px #CAD9EA solid;">版块主题</td>
   </tr>
   <?
		$intpage = 20;
		if (isset($_GET['page'])) {
			$rsnum = (intval($_GET['page']) -1)*$intpage;
		}
		else {
			$rsnum = 0;
		}
		if($_GET["act"]=="mytz"){
			$sql="Select * from {$web_dbtop}bbs_posts where top=0 and uid=".intval($_COOKIE["usersid"])." Order by replytime desc";
		}else if($_GET["act"]=="jh"){
			$sql="Select * from {$web_dbtop}bbs_posts where top=0 and digest=1 Order by replytime desc";
		}else if($_GET["act"]=="search"){
			$sql="Select * from {$web_dbtop}bbs_posts where top=0 and title like '%".str_check(trim($_GET['kword']))."%' Order by replytime desc";
		}else{
			$sql="Select * from {$web_dbtop}bbs_posts where top=0 and section=".intval($_GET["forumsid"])." Order by replytime desc";
		}
		$query=$db->query($sql);
		if($db->fetch_array($query)) 
		$intnum=$db->num_rows($query);
		$query=$db->query($sql." limit $rsnum,$intpage");
		while($rs=$db->fetch_array($query)){
   ?>
   <tr>
     <td height="34" align="center" style="border-top:1px #CAD9EA solid;"><img src="<?=($rs["dj"]>10?"images/topic_hot.gif":"images/topic_new.gif")?>" width="24" height="24"></td>
      <td class="font14" style="border-top:1px #CAD9EA solid;"><? if($bzshow==1){?><input name="id[]" type="checkbox" value="<?=$rs["id"]?>"><? }?><A href="read.php?forumsid=<?=$rs["section"]?>&threadsid=<?=$rs["id"]?>" <? if($rs["style"]!="") echo "style=\"".$rs["style"]."\"";?>><?=$rs["title"]?></a> <? if($rs["digest"]==1){?><img src="images/icon_f_best.gif"><? }?></td>
	  <td style="border-top:1px #CAD9EA solid;">
	    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="20%">
              <table width="22"  border="0" cellspacing="0" cellpadding="1" style="border:1px #cccccc solid;">
                <tr>
                  <td><IMG onerror="this.src='../images/head/1_0.jpg'" src="../<?=showcontent("users","head",$rs["uid"])?>" width="22" height="22"></td>
                </tr>
              </table></td>
            <td><A href="../user.php?id=<?=$rs["uid"]?>"><?=showcontent("users","name",$rs["uid"])?></A></td>
          </tr>
        </table></td>
	  <td align="center" style="border-top:1px #CAD9EA solid;color: #999999;"><?=f_reply_num($rs["id"])?>/<?=$rs["dj"]?></td>
     <td align="right" style="border-top:1px #CAD9EA solid; padding-right:15px"><?=f_final_id($rs["id"])?></td>
   </tr>
   <?
   }
   ?>
</table>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="8"></td>
  </tr>
</table>

<? if($bzshow==1){?>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto">
  <tr>
    <td><input name="置顶" type="button" value="置顶" onClick="document.form.action='tcl.php?forumsid=<?=$_GET["forumsid"]?>&action=zd';{if(chkCheckBoxChs('id[]')==false){alert('请至少选择一个记录！');return;}};{this.document.form.submit();return true;}"> <input name="高亮" type="button" value="高亮" onClick="document.form.action='tcl.php?forumsid=<?=$_GET["forumsid"]?>&action=gl';{if(chkCheckBoxChs('id[]')==false){alert('请至少选择一个记录！');return;}};{this.document.form.submit();return true;}"> <input name="精华" type="button" value="精华" onClick="document.form.action='tcl.php?forumsid=<?=$_GET["forumsid"]?>&action=jh';{if(chkCheckBoxChs('id[]')==false){alert('请至少选择一个记录！');return;}};{this.document.form.submit();return true;}"> <input name="删除" type="button" value="删除" onClick="document.form.action='tcl.php?forumsid=<?=$_GET["forumsid"]?>&action=del';{if(chkCheckBoxChs('id[]')==false){alert('请至少选择一个记录！');return;}};{this.document.form.submit();return true;}"> <input name="移动" type="button" value="移动" onClick="document.form.action='tcl.php?forumsid=<?=$_GET["forumsid"]?>&action=yd';{if(chkCheckBoxChs('id[]')==false){alert('请至少选择一个记录！');return;}};{this.document.form.submit();return true;}"></td>
  </tr>
</table>
<?
}
?>
</form>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto">
  <tr>
    <td width="570"><div class="pagenavi"><?php
		  include_once("../inc/page_class.php");
		  $page=new page(array('total'=>$intnum,'perpage'=>$intpage));
		  echo $page->show(6,"page","curr");?></div></td>
    <td align="right">
	 <? if(intval($_COOKIE["usersid"]) && $_GET["act"]!="search"){?>
	 <table border="0" cellspacing="0" cellpadding="0">
       <tr align="right">
         <td width="75"><a href="?act=mytz&forumsid=<?=$_GET["forumsid"]?>"><img src="images/mytz.gif" width="70" height="28"></a></td>
         <td width="75"><a href="?act=jh&forumsid=<?=$_GET["forumsid"]?>"><img src="images/jh.gif" width="70" height="28"></a></td>
         <td width="75"><a href='post.php?forumsid=<?=$_GET["forumsid"]?>'><img src="images/new_topic.gif" width="70" height="28" border="0"></a></td>
       </tr>
     </table>
	 <? }?>
	</td>
  </tr>
</table>
<script language="JavaScript">
function chkCheckBoxChs(objNam){
var obj = document.getElementsByName(objNam);
var objLen= obj.length;
var objYN;
var i;
objYN=false;
	for (i = 0;i< objLen;i++){
		if (obj [i].checked==true) {
			objYN= true;
		break;
		}
	}
return objYN;
}
</script>
 <DIV class=blank10></DIV>
<?php include_once("../footer.php");?>