<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[28]!=1)
{
  Header("Location: jump.php?id=25&jump=main.php");
  exit();
}
$phpcolor->table=$core_mysql_prefix."filter";
$phpcolor->where="id='".$_GET['id']."'";
if(isset($_GET['action']) and $_GET['action'] == "del" and isset($_GET['id']))
{
  $phpcolor->delete();
  Header("Location: jump.php?id=24&jump=filter.php");
}
elseif(isset($_GET['action']) and $_GET['action'] == "adddo")
{
  $phpcolor->field="content, type";
  $phpcolor->where="'".$_POST['content']."', '".$_POST['type']."'";
  $phpcolor->write();
  Header("Location: jump.php?id=24&jump=filter.php");
}
elseif(isset($_GET['action']) and $_GET['action'] == "editdo" and isset($_GET['id']))
{
  if($_POST['content']=="")
    Header("Location: jump.php?id=2&jump=filter.php?action=edit=and=id=".$_GET['id']);
  else
  {
    $phpcolor->field="content='".$_POST['content']."',type='".$_POST['type']."'";
    $phpcolor->upgrade();
    Header("Location: jump.php?id=24&jump=filter.php");
  }
}
elseif(isset($_GET['action']) and $_GET['action'] == "add")
  $tpl -> display("filter_add.htm");
elseif(isset($_GET['action']) and $_GET['action'] == "edit" and isset($_GET['id']))
{
  $phpcolor->field="*";
  $filter=$phpcolor->exist(1);
  $tpl -> assign("filter", $filter);
  $tpl -> display("filter_edit.htm");
}
else
{
  if(!isset($_GET['page']))
    $_GET['page']=0;
  $phpcolor->field="*";
  $phpcolor->where="1=1";
  $count = $phpcolor->exist(2);
  $phpcolor->where="1=1 limit ".($_GET['page']*20).",20";
  $filter=$phpcolor->assignment();
  $page=pages($count,20,$_GET['page'],'filter','','','0');
  for($count=0;$count<count($filter);$count++)
  {
    if($filter[$count]['type']==1)
      $filter[$count]['type']="禁止发布";
	elseif($filter[$count]['type']==3)
      $filter[$count]['type']="审核发布";
    else
      $filter[$count]['type']="屏蔽显示";
  }
  $tpl -> assign("filter", $filter);
  $tpl -> assign("page", $page);
  $tpl -> display("filter.htm");
}
?>