<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
*/
(!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied');
if(!$dosubmit) {

    $report_arr = array(1=>'抄袭点评',2=>'重复点评',3=>'恶意点评',4=>'非法点评',5=>'不属于点评',6=>'其他');

    $disposal = $disposal != 1 ? 2 : 1;
    $row = $db->get_one("SELECT COUNT(*) count FROM {$dbpre}reports WHERE disposal='$disposal'");
    $total = $row['count'];
    if($total > 0) {
        $offset = 20;
        $limit = get_limit($page, $offset);
        $query = $db->query("SELECT a.*,c.shopname,c.subname FROM {$dbpre}reports a LEFT JOIN {$dbpre}reviews b ON(a.reviewid=b.rid) LEFT JOIN {$dbpre}shops c ON(b.shopid=c.sid) WHERE a.disposal='$disposal' ORDER BY a.posttime DESC LIMIT $limit");
        while($report = $db->fetch_array($query)) {
            $report['shopname'] .= $report['subname'] ? "({$report['subname']})" : '';
            $report['reportcontent'] = trimmed_title(html_special_chars(str_replace("\r\n", ".", $report['reportcontent'])), 25);
            $report['posttime'] = date('Y-m-d H:i:s', $report['posttime']);
            $reports[] = $report;
        }
    }

    include cptpl('reviewreports', MOD_ROOT.'./admin/templates/');

} else {

    if($reportids) {
        foreach($reportids as $id) {
            $db->query("DELETE FROM {$dbpre}reports WHERE reportid='$id'");
        }
        cpmsg('删除完毕。',"admincp.php?action=$action&file=$file");
    } else {
        cpmsg('未选择删除项，请返回。',"admincp.php?action=$action&file=$file");
    }

}
?>