<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[9]!=1)
{
  Header("Location: jump.php?id=25&jump=main.php");
  exit();
}
$phpcolor->table=$core_mysql_prefix."barmaudit";
$phpcolor->field="*";
$phpcolor->where="id = '".$_GET['id']."'";
if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "yes")
{
  $barmaudit = $phpcolor->exist(1);
  $phpcolor->delete();
  $phpcolor->table=$core_mysql_prefix."bar";
  $phpcolor->field="domain='".$barmaudit['domain']."',introduction='".$barmaudit['introduction']."',picture='".$barmaudit['picture']."',keyword='".$barmaudit['keyword']."',description='".$barmaudit['description']."',usernc='".$barmaudit['usernc']."',baruserp='".$barmaudit['baruserp']."',apply='".$barmaudit['apply']."',visitor='".$barmaudit['visitor']."',verify='".$barmaudit['verify']."'";
  $phpcolor->where="id = '".$barmaudit['bid']."'";
  $phpcolor->upgrade();
  Header("Location: jump.php?id=24&jump=barmaudit.php");
}
elseif(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "no")
{
  $phpcolor->delete();
  Header("Location: jump.php?id=24&jump=barmaudit.php");
}
elseif(isset($_GET['action']) and $_GET['action'] == "show")
{
  $phpcolor->where="id = '".$_GET['id']."'";
  $barmaudit = $phpcolor->exist(1);
  $phpcolor->table=$core_mysql_prefix."bar";
  $phpcolor->field="barname,picture,domain,usernc,keyword,description,introduction,visitor,verify,baruserp,apply";
  $phpcolor->where="id = '".$barmaudit['bid']."'";
  $rs=$phpcolor->exist(1);
  if($rs['visitor']=="9")
    $rs['visitor']="默认";
  elseif($rs['visitor']=="1")
    $rs['visitor']="允许";
  else
    $rs['visitor']="不允许";
  if($rs['verify']=="9")
    $rs['verify']="默认";
  elseif($rs['verify']=="2")
    $rs['verify']="全部开启";
  elseif($rs['verify']=="1")
    $rs['verify']="游客开启";
  elseif($rs['verify']=="3")
    $rs['verify']="非会员开启";
  else
    $rs['verify']="不开启";
  if($rs['baruserp']=="0")
    $rs['baruserp']="对所有人开放";
  elseif($rs['baruserp']=="3")
    $rs['baruserp']="允许所以人回贴";
  elseif($rs['baruserp']=="2")
    $rs['baruserp']="仅允许本吧会员发贴";
  else
    $rs['baruserp']="仅对本吧会员开放";
  if($rs['apply']=="0")
    $rs['apply']="不需要";
  else
    $rs['apply']="需要";
  if($barmaudit['visitor']=="9")
    $barmaudit['visitor']="默认";
  elseif($barmaudit['visitor']=="1")
    $barmaudit['visitor']="允许";
  else
    $barmaudit['visitor']="不允许";
  if($barmaudit['verify']=="9")
    $barmaudit['verify']="默认";
  elseif($barmaudit['verify']=="2")
    $barmaudit['verify']="全部开启";
  elseif($barmaudit['verify']=="1")
    $barmaudit['verify']="游客开启";
  elseif($barmaudit['verify']=="3")
    $barmaudit['verify']="非会员开启";
  else
    $barmaudit['verify']="不开启";
  if($barmaudit['baruserp']=="0")
    $barmaudit['baruserp']="对所有人开放";
  elseif($barmaudit['baruserp']=="3")
    $barmaudit['baruserp']="允许所以人回贴";
  elseif($barmaudit['baruserp']=="2")
    $barmaudit['baruserp']="仅允许本吧会员发贴";
  else
    $barmaudit['baruserp']="仅对本吧会员开放";
  if($barmaudit['apply']=="0")
    $barmaudit['apply']="不需要";
  else
    $barmaudit['apply']="需要";
  $tpl -> assign("barmaudit", $barmaudit);
  $tpl -> assign("rs", $rs);
  $tpl -> display("barmaudit_show.htm");
}
else
{
  if(!isset($_GET['page']))
    $_GET['page']=0;
  $phpcolor->where="1=1";
  $count = $phpcolor->exist(2);
  $phpcolor->where="1=1 limit ".($_GET['page']*20).",20";
  $barmaudit=$phpcolor->assignment();
  $phpcolor->table=$core_mysql_prefix."bar";
  for($count=0;$count<count($barmaudit);$count++)
  {
    $phpcolor->field="barname";
    $phpcolor->where="id = '".$barmaudit[$count]['bid']."'";
	$rs=$phpcolor->exist(1);
    $barmaudit[$count]['barname']=$rs['barname'];
	if($barmaudit[$count]['visitor']=="9")
	  $barmaudit[$count]['visitor']="默认";
	elseif($barmaudit[$count]['visitor']=="1")
	  $barmaudit[$count]['visitor']="允许";
	else
	  $barmaudit[$count]['visitor']="不允许";
	if($barmaudit[$count]['verify']=="9")
	  $barmaudit[$count]['verify']="默认";
	elseif($barmaudit[$count]['verify']=="2")
	  $barmaudit[$count]['verify']="全部开启";
	elseif($barmaudit[$count]['verify']=="1")
	  $barmaudit[$count]['verify']="游客开启";
	elseif($barmaudit[$count]['verify']=="3")
	  $barmaudit[$count]['verify']="非会员开启";
	else
	  $barmaudit[$count]['verify']="不开启";
	if($barmaudit[$count]['baruserp']=="0")
	  $barmaudit[$count]['baruserp']="对所有人开放";
	elseif($barmaudit[$count]['baruserp']=="3")
	  $barmaudit[$count]['baruserp']="允许所以人回贴";
	elseif($barmaudit[$count]['baruserp']=="2")
	  $barmaudit[$count]['baruserp']="仅允许本吧会员发贴";
	else
	  $barmaudit[$count]['baruserp']="仅对本吧会员开放";
  }
  $page=pages($count,20,$_GET['page'],'barmaudit','','','0');
  $tpl -> assign("barmaudit", $barmaudit);
  $tpl -> assign("page", $page);
  $tpl -> display("barmaudit.htm");
}
?>