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

    if($op == 'reviewreport') {

        if(!is_numeric($reportid) || $reportid < 0) cpmsg('举报ID无效。');
        $review = $db->get_one("SELECT a.uid,a.username,a.reportcontent,a.disposal,a.reportremark,a.disposaltime,a.sort,b.*,c.classcode,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.reportid='$reportid'");
        if(!$review) cpmsg('点评信息不存在。');

        $pcd = substr($review['classcode'], 0, 2);
        $panelcfg = $_panel_config[$pcd]; 

        $review['sortname'] = get_item_review($pcd);
        $review['reportsortname'] = $report_sortname_arr[$review['sort']];

        $reviewid = $review['rid'];

    } else {

        if(!is_numeric($reviewid) || $reviewid < 0) cpmsg('未确定点评对象');
        
        $review = $db->get_one("SELECT a.*,b.classcode,b.shopname,b.subname,c.username FROM {$dbpre}reviews a LEFT JOIN {$dbpre}shops b ON(a.shopid=b.sid) LEFT JOIN {$dbpre}members c ON(a.uid=c.uid) WHERE rid='$reviewid'");
        if(!$review) cpmsg('点评信息不存在。');

        $pcd = substr($review['classcode'], 0, 2);
        $panelcfg = $_panel_config[$pcd]; 
        $review['sortname'] = get_item_review($pcd);

    }

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

} else {

    if(!is_numeric($reviewid) || $reviewid < 0) cpmsg('无效的点评ID。', 'stop');
    $file = 'reviewlist';
    if($op == 'reviewreport') {
        $file = 'reviewreports';
        if(!is_numeric($reportid) || $reportid < 0) cpmsg('无效的举报ID。', 'stop');
        $post = array();
        $post['reportremark'] = $reportremark;
        $post['disposaltime'] = $timestamp;

        checkupReportReview($reportid,$post);
        if(empty($report_action)) {
            cpmsg('举报信息更新完毕！',"admincp.php?action=$action&file=$file");
        } elseif($report_action == 'delete') {
            // 删除点评信息
            deleteReview(array($reviewid),'rid','',false);
            cpmsg('举报信息处理完毕！',"admincp.php?action=$action&file=$file");
        }
    } elseif($op == 'checkreview') {
        $file = 'checkreviews';
    }
    $post = array();
    for($i=1;$i<=8;$i++) {
        $sort = sprintf("sort%d", $i);
        $post[$sort] = intval($$sort);
    }
    $post['enjoy'] = intval($enjoy);
    $post['avgprice'] = $avgprice;
    $post['shoptags'] = $shoptags;
    $post['producttags'] = $producttags;
    $post['suitplacetags'] = $suitplacetags;
    $post['content'] = $content;
    if($action=='auditingreviews') {
        $post['status'] = 1;  
    }
    // 更新点评内容
    updateReview($post,$reviewid);

    cpmsg('点评内容更新完毕。',"admincp.php?action=$action&file=$file");

}
?>