<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[13]!=1)
  jump("jump.php?id=25&jump=main.php");
if($_GET['type']=="repost")
{
  $phpcolor->table="repost";
  $phpcolor->where="id = '".$_GET['id']."'";
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "yes")
  {
    $phpcolor->field="state='1'";
    $phpcolor->upgrade();
    jump("jump.php?id=24&jump=postaudit.php");
  }
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "no")
  {
    $phpcolor->delete();
    jump("jump.php?id=24&jump=postaudit.php");
  }
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "show")
  {
    $phpcolor->field="id,content,author,ip,published,belong";
    $post = $phpcolor->exist(1);
    $tpl -> assign("post", $post);
    $tpl -> display("audit_repost_show.htm");
  }
  else
  {
    if(!isset($_GET['page']))
      $_GET['page']=0;
    $phpcolor->field="*";
    $phpcolor->where="state = '3'";
    $count = $phpcolor->exist(2);
    $phpcolor->field="id,content,author,belong";
    $phpcolor->where="state = '3' limit ".($_GET['page']*20).",20";
    $post=$phpcolor->assignment();
    for($count=0;$count<count($post);$count++)
    {
	  $post[$count]['content']=$phpcolor->mysubstr($post[$count]['content'],0,100); 
      $post[$count]['authorip']=is_ip($post[$count]['author']);
    }
    $page=pages($count,20,$_GET['page'],'postaudit','','','0');
    $tpl -> assign("post", $post);
    $tpl -> assign("page", $page);
    $tpl -> display("audit_repost.htm");
  }
}
else
{
  $phpcolor->table="topic";
  $phpcolor->where="id = '".$_GET['id']."'";
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "yes")
  {
    $phpcolor->field="state='1'";
    $phpcolor->upgrade();
    jump("jump.php?id=24&jump=postaudit.php");
  }
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "no")
  {
    $phpcolor->delete();
    jump("jump.php?id=24&jump=postaudit.php");
  }
  if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "show")
  {
    $phpcolor->field="id,theme,content,author,ip,published,belong";
    $post = $phpcolor->exist(1);
    $phpcolor->table="bar";
    $phpcolor->field="barname";
    $phpcolor->where="id = '".$post['belong']."'";
    $rs=$phpcolor->exist(1);
    $post['belongn']=$rs['barname'];
    $tpl -> assign("post", $post);
    $tpl -> display("audit_topic_show.htm");
  }
  else
  {
    if(!isset($_GET['page']))
      $_GET['page']=0;
    $phpcolor->field="*";
    $phpcolor->where="state = '3'";
    $count = $phpcolor->exist(2);
    $phpcolor->field="id,theme,author,belong";
    $phpcolor->where="state = '3' limit ".($_GET['page']*20).",20";
    $post=$phpcolor->assignment();
    $page=pages($count,20,$_GET['page'],'postaudit','','','0');
    $phpcolor->table="bar";
    for($count=0;$count<count($post);$count++)
    {
      $phpcolor->field="barname";
      $phpcolor->where="id = '".$post[$count]['belong']."'";
      $rs=$phpcolor->exist(1);
	  $post[$count]['belongn']=$rs['barname'];
      $post[$count]['authorip']=is_ip($post[$count]['author']);
    }
    $tpl -> assign("post", $post);
    $tpl -> assign("page", $page);
    $tpl -> display("audit_topic.htm");
  }
}
?>