<?php
/**
* 
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id  $
*/
if(!$dosubmit) {

    $total = $db->get_one("SELECT COUNT(*) as c FROM {$dbpre}pictures WHERE status=2");
    if($total['c'] > 0) {
        $offset = 20;
        $limit = get_limit($page, $offset);
        $query = $db->query("SELECT a.pid,a.uid,a.title,a.filename,a.folder,a.addtime,a.shopid,b.shopname,b.subname,c.username FROM {$dbpre}pictures a LEFT JOIN {$dbpre}shops b ON(a.shopid=b.sid) LEFT JOIN {$dbpre}members c ON(a.uid=c.uid) WHERE a.status=2 ORDER BY a.addtime DESC LIMIT $limit");
        while($picture = $db->fetch_array($query)) {
            $picsort = array('1'=>'环境','2'=>'产品','3'=>'其他');
            $picture['addtime'] = date('Y-m-d H:i:s', $picture['addtime']);
            $picture['sortname'] = array_key_exists($picture['sortname'],$picsort) ? $picsort[$picture['sortname']] : $picsort[3];
            $picture['s_picture'] = $_config['siteurl'].'uploads/pictures/'.$picture['folder'].'/s_'.$picture['filename'];
            $picture['picture'] = $_config['siteurl'].'uploads/pictures/'.$picture['folder'].'/'.$picture['filename'];
            $pictures[] = $picture;
        }
        unset($picture);
        $db->free_result($query);
        $multipage = multi($total['c'], $offset, $page, "admincp.php?action=$action&file=$file");
    }
    include cptpl('checkpictures', MOD_ROOT.'./admin/templates/');

} else {

    if($pictureid && is_array($pictureid)) {
        if($operation != 0 && $operation != 1) cpmsg('未选择操作方式，请返回修改。');
        if(!function_exists('checkupPicture')) {
            require_once(MOD_ROOT.'./include/fun_picture.php');
        }
        if($operation == 0) {
            deletePicture($pictureid,'pid',-1,$operation['subpoint'],true);
        } elseif($operation == 1) {
            checkupPicture($pictureid);
        }
        cpmsg('图片' . ($operation ? '审核' : '删除') . '完毕。');
    }
    cpmsg('未选择进行操作的内容，请返回选择。');

}
?>