<?
include_once("../inc/conn.php");
include_once("../inc/function.php");
login_check();
$bzshow=0;
$query=$db->query("Select moderators from {$web_dbtop}bbs_section where id=".intval($_GET["forumsid"]));
   if($rs=$db->fetch_array($query)){
	$moderators=explode(",",$rs["moderators"]);
	foreach ($moderators as $usersbz){
		if($usersbz){
			if($usersbz==intval($_COOKIE["usersid"])){
				$bzshow=1;
			}
		}
	}
}
if($bzshow!=1){
	echo "<script language=javascript>alert('请问您想干什么,这里不是您要来的地方!');history.go(-1);</script>";
	exit;
}				
?>
<!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");
switch($_GET["action"]){
case "jh":
	jh();
	break;
case "gl":
	gl();
	break;
case "gledit":
	gledit();
	break;
case "del":
	del();
	break;
case "delread":
	delread();
	break;
case "zd":
	zd();
	break;
case "zdedit":
	zdedit();
	break;
case "yd":
	yd();
	break;
case "ydedit":
	ydedit();
	break;
}
function del(){
	global $db,$web_dbtop;
	if(isset($_POST["id"]))
	$id=implode(",",$_POST["id"]);
	else
	$id=$_GET['id'];
	$db->query("delete from {$web_dbtop}bbs_posts where id in ($id)");
	$db->query("delete from {$web_dbtop}bbs_reply where pid in ($id)");
	echo "<script language=javascript>alert('删除贴子操作成功!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}

function delread(){
	global $db,$web_dbtop;
	$id=$_GET['id'];
	$db->query("delete from {$web_dbtop}bbs_reply where id in ($id)");
	echo "<script language=javascript>alert('删除回复操作成功!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}

function jh(){
	global $db,$web_dbtop;
	$id=str_check(implode(",",$_POST["id"]));
	$query=$db->query("select id,digest from {$web_dbtop}bbs_posts where id in ($id)");
	while($rs=$db->fetch_array($query)){
		if($rs["digest"]==1){
			$db->query("update {$web_dbtop}bbs_posts set digest=0 where id=".$rs["id"]);
		}else{
			$db->query("update {$web_dbtop}bbs_posts set digest=1 where id=".$rs["id"]);
		}
	}
	echo "<script language=javascript>alert('精华操作成功!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}

function zdedit(){
	global $db,$web_dbtop;
	$db->query("update {$web_dbtop}bbs_posts set top=".intval($_POST["zdjb"])." where id in (".str_check($_POST["id"]).")");
	echo "<script language=javascript>alert('置顶操作成功!');location.href='".$_POST["url"]."';</script>";
}

function ydedit(){
	global $db,$web_dbtop;
	$db->query("update {$web_dbtop}bbs_posts set section=".intval($_POST["ydid"])." where id in (".str_check($_POST["id"]).")");
	echo "<script language=javascript>alert('移动帖子操作成功!');location.href='".$_POST["url"]."';</script>";
}

function gledit(){
	global $db,$web_dbtop;
	$sql="update {$web_dbtop}bbs_posts set style=";
	if($_POST["ztcolor"]){
		$edit.="color:".$_POST["ztcolor"].";";
	}
	if($_POST["bold"]){
		$edit.="font-weight: bold;";
	}
	if($_POST["italic"]){
		$edit.="font-style: italic;";
	}
	$query=$db->query($sql."'".$edit."' where id in (".str_check($_POST["id"]).")");
	echo "<script language=javascript>alert('高亮操作成功!');location.href='".$_POST["url"]."';</script>";
}
function gl(){
	global $db,$web_dbtop,$web_name;
?>
<table width="960" border="0" align="center" cellpadding="4" cellspacing="0" style="border: 1px solid #CAD9EA;">
<form action="?action=gledit&forumsid=<?=$_GET["forumsid"]?>" method="post">
<input name="id" type="hidden" value="<?=implode(",",$_POST["id"]);?>">
<input name="url" type="hidden" value="<?=$_SERVER["HTTP_REFERER"];?>">
  <tr>
    <td height="28" colspan="2" align="center" background="images/menu_bg.gif"><strong>帖子操作</strong></td>
  </tr>
  <tr>
    <td width="138" height="28" align="center" style="border-top:1px #CAD9EA solid;">高亮颜色：</td>
    <td height="12" style="border-top:1px #CAD9EA solid;"><select name="ztcolor">
      <option style="background-color: #000000;" value="">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #ee1b2e;" value="#ee1b2e">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #ee5023;" value="#ee5023">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #996600;" value="#996600">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #3c9d40;" value="#3c9d40">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #2897c5;" value="#2897c5">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #2b65b7;" value="#2b65b7">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #8f2a90;" value="#8f2a90">&nbsp;&nbsp;&nbsp;&nbsp;</option>
	  <option style="background-color: #ec1282;" value="#ec1282">&nbsp;&nbsp;&nbsp;&nbsp;</option>
    </select></td>
  </tr>
  <tr>
    <td height="28" align="center" style="border-top:1px #CAD9EA solid;">高亮样式：</td>
    <td height="12" style="border-top:1px #CAD9EA solid;"><input name="bold" type="checkbox" value="font-weight: bold;">
      <strong>加粗</strong>      <input name="italic" type="checkbox" value="font-style: italic;"> 
      <em>斜体</em></td>
  </tr>
  <tr>
    <td height="28" colspan="2" align="center" style="border-top:1px #CAD9EA solid;">
      <input name="imageField" type="image" src="images/doudoubbs_05.gif" width="63" height="23" border="0"></td>
  </tr>
  </form>
</table>
<?php
}
function zd(){
	global $db,$web_dbtop,$web_name;
?>
<table width="960" border="0" align="center" cellpadding="4" cellspacing="0" style="border: 1px solid #CAD9EA;">
  <form action="?action=zdedit&forumsid=<?=$_GET["forumsid"]?>" method="post">
    <input name="id" type="hidden" value="<?=implode(",",$_POST["id"]);?>">
    <input name="url" type="hidden" value="<?=$_SERVER["HTTP_REFERER"];?>">
    <tr>
      <td height="28" colspan="2" align="center" background="images/menu_bg.gif"><strong>帖子操作</strong></td>
    </tr>
    <tr>
      <td width="138" height="28" align="center" style="border-top:1px #CAD9EA solid;">置顶级别：</td>
      <td height="12" style="border-top:1px #CAD9EA solid;"><select name="zdjb">
          <option value="0">取消置顶</option>
		  <option value="1">本版置顶</option>
          <option value="2">全局置顶</option>
      </select></td>
    </tr>
    <tr>
      <td height="28" colspan="2" align="center" style="border-top:1px #CAD9EA solid;"><input name="imageField" type="image" src="images/doudoubbs_05.gif" width="63" height="23" border="0"></td>
    </tr>
  </form>
</table>
<?php
}
function yd(){
	global $db,$web_dbtop,$web_name;
?>
<table width="960" border="0" align="center" cellpadding="4" cellspacing="0" style="border: 1px solid #CAD9EA;">
  <form action="?action=ydedit&forumsid=<?=$_GET["forumsid"]?>" method="post">
    <input name="id" type="hidden" value="<?=implode(",",$_POST["id"]);?>">
    <input name="url" type="hidden" value="<?=$_SERVER["HTTP_REFERER"];?>">
    <tr>
      <td height="28" colspan="2" align="center" background="images/menu_bg.gif"><strong>帖子操作</strong></td>
    </tr>
    <tr>
      <td width="138" height="28" align="center" style="border-top:1px #CAD9EA solid;">移动版块：</td>
      <td height="12" style="border-top:1px #CAD9EA solid;"><select name="ydid">
          <?
		  $query=$db->query("Select * from {$web_dbtop}bbs_section Order by sort asc");
		  while($rs=$db->fetch_array($query)){
		  	echo"<option value=\"".$rs["id"]."\">".$rs["name"]."</option>";
		  }
		  ?>
      </select></td>
    </tr>
    <tr>
      <td height="28" colspan="2" align="center" style="border-top:1px #CAD9EA solid;"><input name="imageField" type="image" src="images/doudoubbs_05.gif" width="63" height="23" border="0"></td>
    </tr>
  </form>
</table>
<?php
}
?>
<script language="javascript">
qiehuan(8);
document.getElementById('bbs_<?=$_GET["forumsid"];?>').className="current";
</script>
<DIV class=blank10></DIV>
<? include_once("../footer.php");?>