<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
checkAuth('24');	//判断登录和权限

$allow_act = array("surface", "sort0", "sort1", "sort2");
$act = in_array($act, $allow_act) ? $act : "surface";
$fitment = intval($fitment);

if(is_array($idarr) && !empty($idarr))
{
	$piccheck = new QaPicCheck($act);
	foreach($idarr as $id)
	{
		$oper = intval($operarr[$id]);

		if($oper == 1)	//不通过
		{
			$piccheck->nothaw($id);
		}
		else //通过
		{
			$piccheck->thaw($id);
		}
	}
}

sleep(1);
echo "<script>window.location.href='./pic_manage.php?act=".$act."';</script>";
exit;

//QA图片审核
class QaPicCheck
{
	private $systime = '';
	private $act = '';

	public function QaPicCheck($act)
	{
		$this->systime = time();
		$this->act = $act;
	}

	private function getInfoFromQaTable($id)
	{
		global $dbback;
		
		$return = array();

		$sql = "select admin from admin_pic_qa where id = '".$id."'";
		$return = $dbback->GetRow($sql);

		return $return;
	}
	
	private function delPicFromQaTable($id)
	{
		global $db;

		$sql = "delete from admin_pic_qa where id = '".$id."'";
		$db->Execute($sql);
	}

	public function thaw($id)
	{
		$info = $this->getInfoFromQaTable($id);
		$this->delPicFromQaTable($id);
		add2QaStat($this->act, 'pass', $info['admin']);
	}

	public function nothaw($id)
	{
		$info = $this->getInfoFromQaTable($id);
		$this->delPicFromQaTable($id);
		
		add2QaStat($this->act, 'no', $info['admin']);
	}
}
?>