<?
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../pageclass.php");
include_once("../conn.php");
include_once("check_master.php");

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=adminmakecache('../cache/ftbbsmb.html',$query,$expire);
$pagesize=$ftbbsmb[5];

$searchcontent=trim($_POST["searchcontent"]);
$searchkind=$_POST["searchkind"];
if ($searchcontent==""){
$searchcontent=$_GET["searchcontent"];
$searchkind=$_GET["searchkind"];
}
$searchmethod=$_POST["searchmethod"];
$BoardID_1=$_GET["BoardID_1"];
$BoardID_2=$_GET["BoardID_2"];
$return_url=$_SERVER["HTTP_REFERER"];
if ($BoardID_1!="" && $BoardID_2!=""){
   $f1="BoardID_1='".$BoardID_1."' and BoardID_2='".$BoardID_2."' and ";
   $f2=" where BoardID_1='".$BoardID_1."' and BoardID_2='".$BoardID_2."'";
}
else{
$f1="";
$f2="";
}
$p = new ft_page;
if ($searchcontent!=""){
$sql="select * from {$tablepre}bbstitle where ".$f1.$searchkind." like '%".$searchcontent."%' order by redate desc,id desc";
}
else{
$sql="select * from {$tablepre}bbstitle ".$f2." order by redate desc,id desc";
}
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);

$p->pvar="page"; 
$p->setvar(array("searchcontent" => $searchcontent, "searchkind" => $searchkind));
$p->set($pagesize,$numrows,$psize); 
$rsx=mysql_query($sql." limit ".$p->limit());
?>
<html>
<head>
<title>飞天论坛</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<link href="../css/main01.css" rel="stylesheet" type="text/css">
<script src="../js/publicfun.js" type="text/javascript"></script>
</head>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <FORM METHOD=POST ACTION="title_manage.php" >
  <TR>
      <TD width="60%" height="25" align=left> 
        <?
	  $p->output(0);
	  ?>
      </TD> 
      <TD width="40%" align="right" class="f12"><a href="title_manage.php?searchkind=flag&searchcontent=2">活动贴</a> 
        <a href="title_manage.php?searchkind=flag&searchcontent=1">投票贴</a> 
        <INPUT TYPE="text" NAME="searchcontent" size=20>
		<select name="searchkind" style="width:50px">
          <option value="ID">ID号</option>
          <option value="name">用户名</option>
          <option value="title">标 &nbsp;题</option>
		  <option value="menu">内 &nbsp;容</option>
          <option value="ip">IP地址</option>
        </select>
        <INPUT TYPE="submit" value="搜索" name="">
      </TD>
  </TR>
</FORM> 
</TABLE>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#cccccc" class="f12">
  <tr bgcolor="#f3f3f3"> 
            
    <td width="5%" height="20" align="center"><strong>选择</strong></td>
            
    <td width="5%" height="20" align="center"><strong>ID号</strong></td>
            
    <td width="10%" align="center"><strong>主论坛</strong></td>
            
    <td width="10%" align="center"><strong>分论坛</strong></td>
            
    <td width="15%" align="center"><strong>用户名</strong></td>
            
    <td width="30%" align="center"><strong>标题</strong></td>
            
    <td width="15%" align="center"><strong>IP</strong></td>
            <td width="24" align="center"><strong>点击数</strong></td>
            <td width="24" align="center"><strong>回复数</strong></td>
            
    <td width="15%" align="center"><strong>日期</strong></td>
			
    <td width="30" align="center"><strong>论坛头条</strong></td>
            
    <td width="30" align="center"><strong>论坛公告</strong></td>
            
    <td width="30" align="center"><strong>推荐话题</strong></td>
            <td width="41" align="center"><strong>首页显示</strong></td>
            
    <td width="30" align="center"><strong>精彩话题</strong></td>
            <td width="41" align="center"><strong>本版置顶</strong></td>
            <td width="41" align="center"><strong>总置顶</strong></td>
            
    <td width="24" align="center"><strong>标志</strong></td>
            <td width="24" align="center"><strong>删除</strong></td>
          </tr>
          <form name="selectform" method=post action="pldel.php">
            <input type="hidden" name="op" value="选择转正">
            <input type="hidden" name="returnURL" value="title_manage.php?<?=phpself?>">
 <script language="JavaScript">
  function select_pl_submit(optype){
	var f=document.forms["selectform"]
	f.op.value=optype
	f.submit()
  }
 </script>
<?
if ($numrows!=0){
  while ($myrow = mysql_fetch_array($rsx)) {
?>
            <tr height=20 bgcolor="#FFFFFF" colspan=23 class="f12"> 
              <td align="center">
               <input name="checkbox1[]" type="checkbox" value="<?=$myrow["ID"]?>">
              </td>
              <td ><A HREF="../ftbbs.php?id=<?=$myrow["ID"]?>" target="_blank"><?=$myrow["ID"]?></A></td>
              <td align="center"> 
    <?
	$str="select BBS_Cate_ID,BBS_Cate_Name from {$tablepre}bbs_cate Where BBS_Cate_ID='".$myrow["BoardID_1"]."'";
    $rs1=mysql_query($str);
    $myrow1 = mysql_fetch_array($rs1);
    $numrows1 = mysql_num_rows($rs1);
	if ($numrows1!=""){
    echo $myrow1["BBS_Cate_Name"]; 
    }
	mysql_free_result($rs1);
    ?>
              </td>
              <td align="center"> 
<?
if ($myrow["BoardID_2"]!=""){
	$str2="select BBS_Cate_ID,BBS_Cate_Name from {$tablepre}bbs_cate Where BBS_Cate_ID='".$myrow["BoardID_2"]."'";
    $rs2=mysql_query($str2);
    $myrow2 = mysql_fetch_array($rs2);
    $numrows2 = mysql_num_rows($rs2);
	if ($numrows2!=""){
?>
    <a href="title_manage.php?BoardID_1=<?=$myrow["BoardID_1"]?>&BoardID_2=<?=$myrow["BoardID_2"]?>"><?=$myrow2["BBS_Cate_Name"]?></A> 
<?
   }
   mysql_free_result($rs2);
}
else{
	echo "&nbsp;";
}
?>
              </td>
              <td align="center"><?=$myrow["user_id"]?></td>
              <td align="left"><A HREF="reply_manage.php?searchkind=pid&searchcontent=<?=$myrow["ID"]?>"><?=$myrow["title"]?></A></td>
              <td align="center"><?=$myrow["ip"]?></td>
              <td align="center"><?=$myrow["hit"]?></td>
              <td align="center"><?=$myrow["rep"]?></td>
              <td align="center"><?=$myrow["dateh"]?></td>
              <td align="center"> 
                <? if ($myrow["boardsign"]==2){?>
                <a href="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=4"><FONT COLOR="red">是</FONT></A> 
                <? }else{?>
                <a href="jportj.php?id=<?=$myrow["ID"]?>&mode=2&kind=4">否</A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["boardsign"]==1){?> 
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=4"><FONT COLOR="red">是</FONT></A> 
                <? }else{?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=1&kind=4">否</A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["sign"]==0){?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=1&kind=1"><FONT COLOR="green">否</FONT></A> 
                <? }else{?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=1"><FONT COLOR="red">是</FONT></A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["showinhomepage"]==0){?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=1&kind=3"><FONT COLOR="green">否</FONT></A> 
                <? }else{?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=3"><FONT COLOR="red">是</FONT></A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["huati"]==0){?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=1&kind=2"><FONT COLOR="green">否</FONT></A> 
                <? }else{?>
                <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=2"><FONT COLOR="red">是</FONT></A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["bbstop"]==1){?> 
                <A HREF="masterbbstop.php?id=<?=$myrow["ID"]?>&bbstop=0"><FONT COLOR="red">是</FONT></A> 
                <? }else{?>
                <A HREF="masterbbstop.php?id=<?=$myrow["ID"]?>&bbstop=1">否</A> 
                <? }?>
              </td>
              <td align="center">
			    <? if ($myrow["bbstop1"]==1){?> 
                <a href="masterbbstop.php?id=<?=$myrow["ID"]?>&bbstop1=0"><FONT COLOR="red">是</FONT></A> 
                <? }else{?>
                <A HREF="masterbbstop.php?id=<?=$myrow["ID"]?>&bbstop1=1">否</A> 
                <? }?>
              </td>
              <td><div align="center">
			      <? if ($myrow["deleted"]==0){?>
                  <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=1&kind=5"><FONT COLOR="green">显示</FONT></A> 
                  <? }else{?>
                  <A HREF="jportj.php?id=<?=$myrow["ID"]?>&mode=0&kind=5"><FONT COLOR="red">隐藏</FONT></A> 
                  <? }?>
                </div></td>
              <td > <p align="center"><a href="info_delete.php?id=<?=$myrow["ID"]?>&ptuser=<?=$myrow["name"]?>&flag=<?=$myrow["flag"]?>&filepath=<?=$myrow["htmfilename"]?>" onclick="return confirm('确实要删除吗？');">删除</a></td>
            </tr>
<?
}
?>
            <tr bgcolor="#FFFFFF"> 
              <td height="25" colspan="23"> 
			    <input type="checkbox" name="chkall" onclick="checkall(this.form)"> 
                <input name="button" type="button" onclick="select_pl_submit('选择删除')" value="将所选删除" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>> 
                <input name="button" type="button" onclick="select_pl_submit('首页显示')" value="将所选首页显示" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
				<input name="button" type="button" onclick="select_pl_submit('精彩话题')" value="将所选设为精彩话题" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
				<input name="button" type="button" onclick="select_pl_submit('推荐话题')" value="将所选设为推荐话题" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>

			  </td>
            </tr>
            <tr bgcolor="#FFFFFF"> 
              <td height="25" colspan="23">
			    <input name="button" type="button" onclick="select_pl_submit('取消首页显示')" value="将所选取消首页显示" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
                <input name="button" type="button" onclick="select_pl_submit('取消精彩话题')" value="将所选取消精彩话题" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
				<input name="button" type="button" onclick="select_pl_submit('取消推荐话题')" value="将所选取消推荐话题" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
			    <input name="button" type="button" onclick="select_pl_submit('选择显示')" value="将所选显示" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
                <input name="button" type="button" onclick="select_pl_submit('选择隐藏')" value="将所选隐藏" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>> 
              </td>
            </tr>
          </form>
          <tr bgcolor="#FFFFFF"> 
            <td align=left colspan=23 height=30> 
              <?
     $p->output(0);
     mysql_free_result($rs);
     mysql_free_result($rsx);
     $db->close(); 
    ?>
            </td>
          </tr>
<? }else{?>
  <tr bgcolor="#F2F9F9"> 
    <td height="25" colspan=23 align=center class="f12"> 记录为空!</td>
  </tr>
<? }?>
</table>
</body>
</html>