<?php
require("../class/connect.php");
include("../class/db_sql.php");
include("../class/config.php");
include("../class/class.php");
include("../class/functions.php");
include LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=getcvar('loginuserid');
$loginin=getcvar('loginusername');
$loginrnd=getcvar('loginrnd');
$loginlevel=getcvar('loginlevel');
is_login($logininid,$loginin,$loginrnd);
$classid=(int)$_GET['classid'];
$bclassid=(int)$_GET['bclassid'];
$id=$_GET['id'];
if(empty($id))
{$id=$_POST['id'];}
$id=(int)$id;
$checked=(int)$_GET['checked'];
//验证权限
CheckLevel($logininid,$loginin,$classid,"pl");
$keyboard=$_GET['keyboard'];
$keyboard=addslashes(stripSlashes($keyboard));
$start=(int)$_GET['start'];
$page=(int)$_GET['page'];
$line=15;//每行显示
$page_line=15;
$offset=$start+$page*$line;
$search="&bclassid=$bclassid&classid=$classid&id=$id&checked=$checked&keyboard=$keyboard";
$a="";
if($checked)
{
	$a=" where checked=1";
}
//单个
if($id)
{
	$a=" where id='$id' and classid='$classid'";
}
if($keyboard)
{
	if(empty($a))
	{
		$a=" where (saytext like '%".$keyboard."%' or username like '%".$keyboard."%')";
	}
	else
	{
		$a.=" and (saytext like '%".$keyboard."%' or username like '%".$keyboard."%')";
	}
}
$totalquery="select count(*) as total from {$dbtbpre}enewspl".$a;
$num=$empire->gettotal($totalquery);//取得总条数
$query="select plid,username,saytime,saytext,sayip,id,classid,checked from {$dbtbpre}enewspl".$a;
$query.=" order by plid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
//位置
$url="<a href=ListAllPl.php>管理评论</a>&nbsp;&nbsp;(<a href=PlWord.php>管理评论过滤字符</a>)";
//风格
$loginadminstyleid=(int)getcvar('loginadminstyleid');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理评论</title>
<link href="adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<script>
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }
</script>
</head>

<body>
<table width="98%%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td>位置： 
      <?=$url?>
    </td>
  </tr>
</table>

<form name="form2" method="get" action="ListAllPl.php">
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr> 
      <td>请输入信息ID： 
        <input name="id" type="text" id="id" value="<?=$id?>" size="6">
        +栏目ID： 
        <input name="classid" type="text" id="id3" value="<?=$classid?>" size="6">
        关键字： 
        <input name="keyboard" type="text" id="keyboard" value="<?=$keyboard?>"> 
        <input type="submit" name="Submit2" value="搜索评论">
        （信息ID为空即搜索所有评论） </td>
    </tr>
  </table>
</form>
<form name="form1" method="post" action="enews.php" onsubmit="return confirm('确认要操作?');">
<input type=hidden name=bclassid value=<?=$bclassid?>>
<input type=hidden name=classid value=<?=$classid?>>
<input type=hidden name=id value=<?=$id?>>
  <table width="98%%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td width="16%" height="25"><div align="center">网名</div></td>
      <td width="49%" height="25"><div align="center">评论内容(点击内容，进入信息评论页)</div></td>
      <td width="14%" height="25"><div align="center">发表时间</div></td>
      <td width="13%" height="25"><div align="center">IP</div></td>
      <td width="8%" height="25"><div align="center">删除</div></td>
    </tr>
    <?
	while($r=$empire->fetch($sql))
	{
	if(!empty($r[checked]))
		{$checked=" title='未审核' style=background-color:4791C5";}
		else
		{$checked="";}
	?>
    <tr bgcolor="#FFFFFF" id=pl<?=$r[plid]?>> 
      <td height="25" valign="top"><div align="center">
          <?=$r[username]?>
        </div></td>
      <td height="25" valign="top"><a href="../pl?classid=<?=$r[classid]?>&id=<?=$r[id]?>" target=_blank>
        <?=$r[saytext]?>
        </a></td>
      <td height="25" valign="top"><div align="center">
          <?=$r[saytime]?>
        </div></td>
      <td height="25" valign="top"><div align="center">
          <?=$r[sayip]?>
        </div></td>
      <td height="25" valign="top"><div align="center"> 
          <input name="plid[]" type="checkbox" id="plid" value="<?=$r[plid]?>" onclick="if(this.checked){pl<?=$r[plid]?>.style.backgroundColor='#DBEAF5';}else{pl<?=$r[plid]?>.style.backgroundColor='#ffffff';}"<?=$checked?>>
        </div></td>
    </tr>
    <?
	}
	db_close();
	$empire=null;
	?>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="5">&nbsp;&nbsp;
        <?=$returnpage?>
        &nbsp;&nbsp; <input type="submit" name="Submit" value="审核评论" onClick="document.form1.enews.value='CheckPl_all';">&nbsp;&nbsp;<input type="submit" name="Submit" value="删除" onClick="document.form1.enews.value='DelPl_all';"> <input name="enews" type="hidden" id="enews" value="DelPl_all">
        &nbsp;
        <input type=checkbox name=chkall value=on onclick=CheckAll(this.form)>
        选中全部</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25" colspan="5">备注：多选框为蓝色代表未审核评论</td>
    </tr>
  </table>
</form>
</body>
</html>
