<?
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("../admin/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"];
}

$p = new ft_page;
if ($searchcontent!=""){
$sql="select * from {$tablepre}ftblog where ".$searchkind." like '%".$searchcontent."%' order by writedate desc";
}
else{
$sql="select * from {$tablepre}ftblog order by writedate 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/main01.css" rel="stylesheet" type="text/css">
<script src="../js/publicfun.js" type="text/javascript"></script>
</head>
<body>
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <form METHOD=POST ACTION="userblog.php" >
    <tr valign="middle"> 
      <td height="25" colspan="6" align="left" bgcolor="#FFFFFF" class="f12"> 
        <div class="opt"> 
          <div align="right">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="30">
        <?
	  $p->output(0);
	  ?>
				</td>
                <td width="40%"><div align="right">
            <INPUT TYPE="text" NAME="searchcontent" size=20>
            <select name="searchkind" style="width:50px">
              <option value="blogtitle">标题</option>
              <option value="blogcontent">内容</option>
            </select>
            <INPUT TYPE="submit" value="搜索" name="">
				</div></td>
              </tr>
            </table>
          </div>
        </div></td>
    </tr>
  </form>
  <tr> 
    <td height="1" colspan="5" background="../blogimages/dotbg.gif"><spacer height="1" type="block"></td>
  </tr>
  <tr class="f12" bgcolor="#F8F8F8"> 
    <td width="70%" height="25"> <div align="left"><strong>&nbsp;&nbsp;标题</strong></div></td>
    <td width="7%"><div align="center">编辑</div></td>
    <td width="8%"><div align="center">置顶</div></td>
    <td width="8%"><div align="center">推荐</div></td>
  </tr>
  <tr> 
    <td height="1" colspan="5" background="../blogimages/dotbg.gif"><spacer height="1" type="block"></td>
  </tr>
  <form name="selectform" method=post action="pldel.php">
    <input type="hidden" name="op" value="选择转正">
    <input type="hidden" name="returnURL" value="userblog.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 class="f12"> 
      <td height="25" bgcolor="#FFFFFF"><div class="opt">&nbsp; 
          <input name="checkbox1[]" type="checkbox" value="<?=$myrow["id"]?>">
          <a href="../myblog.php?id=<?=$myrow["id"]?>&userid=<?=$myrow["userid"]?>&blogtypeid=<?=$myrow["blogtypeid"]?>" target="_blank"> 
          <?=$myrow["writedate"]?>
          </a>&nbsp; <a href="../myblog.php?id=<?=$myrow["id"]?>&userid=<?=$myrow["userid"]?>&blogtypeid=<?=$myrow["blogtypeid"]?>" target="_blank"> 
          <?=$myrow["blogtitle"]?>
          </a></div></td>
      <td height="25" bgcolor="#FFFFFF" align="center"><div class="opt"> 
          <? if (false===strrpos($_SESSION["admin_qs"],"2")){
	   echo "编辑";
	 }else{
	 echo "<a href=../admin_blog_edit.php?id=".$myrow["id"].">编辑</a>";
	 }
	?>
        </div></td>
      <td height="25" bgcolor="#FFFFFF" align="center"><div class="opt"> 
          <? if ($myrow["blogtop"]==1){?>
          <font color=red>已置顶</font> 
          <? }else{?>
          未置顶 
          <? }?>
        </div></td>
      <td height="25" bgcolor="#FFFFFF" align="center"><div class="opt"> 
          <? if ($myrow["blogtj"]==1){?>
          <font color=red>已推荐</font> 
          <? }else{?>
          未推荐 
          <? }?>
        </div></td>
    </tr>
    <tr> 
      <td height="1" colspan="5" background="../blogimages/dotbg.gif"><spacer height="1" type="block"></td>
    </tr>
    <?
}
?>
    <tr bgcolor="#F8F8F8"> 
      <td colspan="5" height="35"> <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<? }?>> 
        <input name="button" type="button" onclick="select_pl_submit('取消置顶')" value="将所选取消置顶" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>> 
      </td>
    </tr>
  </form>
  <tr> 
    <td height="1" colspan="5" background="../blogimages/dotbg.gif"><spacer height="1" type="block"></td>
  </tr>
  <tr> 
    <td colspan="5" height="35"> 
      <?
     $p->output(0);
     mysql_free_result($rs);
     mysql_free_result($rsx);
     $db->close(); 
    ?>
    </td>
  </tr>
  <? }else{?>
  <tr bgcolor="#F2F9F9"> 
    <td height="25" colspan=5 align="center" class="f12"> 记录为空!</td>
  </tr>
  <? }?>
</table>
</body>
</html>