예제 #1
0
/**
 * 评论批量处理(删除、通过审核、加入审核)
 */
function BatchComment()
{
    global $zbp;
    if (isset($_POST['all_del'])) {
        $type = 'all_del';
    }
    if (isset($_POST['all_pass'])) {
        $type = 'all_pass';
    }
    if (isset($_POST['all_audit'])) {
        $type = 'all_audit';
    }
    $array = array();
    $array = $_POST['id'];
    $array = array_unique($array);
    if ($type == 'all_del') {
        $arrdel = array();
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $arrdel[] = $cmt->ID;
            DelComment_Children_NoDel($cmt->ID, $arrdel);
        }
        foreach ($arrdel as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->Del();
            if ($cmt->IsChecking == false) {
                CountPostArray(array($cmt->LogID), -1);
            }
            if ($cmt->IsChecking == false) {
                CountCommentNums(-1, 0);
            } else {
                CountCommentNums(-1, -1);
            }
        }
    }
    if ($type == 'all_pass') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = false;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), +1);
            CountCommentNums(0, -1);
        }
    }
    if ($type == 'all_audit') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = true;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), -1);
            CountCommentNums(0, +1);
        }
    }
    $zbp->AddBuildModule('comments');
}
예제 #2
0
function BatchComment()
{
    global $zbp;
    if (isset($_POST['all_del'])) {
        $type = 'all_del';
    }
    if (isset($_POST['all_pass'])) {
        $type = 'all_pass';
    }
    if (isset($_POST['all_audit'])) {
        $type = 'all_audit';
    }
    $array = array();
    $array = $_POST['id'];
    if ($type == 'all_del') {
        $arrpost = array();
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $arrpost[] = $cmt->LogID;
        }
        $arrpost = array_unique($arrpost);
        foreach ($arrpost as $i => $id) {
            $comments = $zbp->GetCommentList('*', array(array('=', 'comm_LogID', $id)), null, null, null);
        }
        $arrdel = array();
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $arrdel[] = $cmt->ID;
            DelComment_Children_NoDel($cmt->ID, $arrdel);
        }
        foreach ($arrdel as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            $cmt->Del();
        }
    }
    if ($type == 'all_pass') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = false;
            $cmt->Save();
        }
    }
    if ($type == 'all_audit') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = true;
            $cmt->Save();
        }
    }
}