示例#1
0
 check_articleperm($catid);
 $aids = $_POST['aids'];
 $optype = $_POST['optype'];
 if (empty($optype) || $optype == 'push') {
     showmessage('article_action_invalid');
 }
 $aids = array_map('intval', $aids);
 $aids = array_filter($aids);
 if (empty($aids)) {
     showmessage('article_not_choose');
 }
 if (submitcheck('batchsubmit')) {
     if ($optype == 'trash' || $optype == 'delete') {
         require_once libfile('function/delete');
         $istrash = $optype == 'trash' ? 1 : 0;
         $article = deletearticle($aids, $istrash);
         showmessage('article_delete_success', dreferer("portal.php?mod=portalcp&ac=category&catid={$article[0][catid]}"));
     } elseif ($optype == 'move') {
         if ($catid) {
             $categoryUpdate = array();
             foreach (C::t('portal_article_title')->fetch_all($aids) as $s_article) {
                 $categoryUpdate[$s_article['catid']] = $categoryUpdate[$s_article['catid']] ? --$categoryUpdate[$s_article['catid']] : -1;
                 $categoryUpdate[$catid] = $categoryUpdate[$catid] ? ++$categoryUpdate[$catid] : 1;
             }
             foreach ($categoryUpdate as $scatid => $scatnum) {
                 if ($scatnum) {
                     C::t('portal_category')->increase($scatid, array('articles' => $scatnum));
                 }
             }
             C::t('portal_article_title')->update($aids, array('catid' => $catid));
             showmessage('article_move_success', dreferer("portal.php?mod=portalcp&ac=category&catid={$catid}"));
示例#2
0
 $articles = $catids = array();
 $aids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array();
 if ($aids) {
     $query = C::t('portal_article_title')->fetch_all($aids);
     foreach ($query as $value) {
         $articles[$value['aid']] = array('aid' => $value['aid'], 'catid' => $value['catid']);
         $catids[] = intval($value['catid']);
     }
 }
 if (empty($articles)) {
     cpmsg('article_choose_at_least_one_article', 'action=article&catid=' . $catid . '&perpage=' . $perpage . '&page=' . $page, 'error');
 }
 $aids = array_keys($articles);
 if ($_POST['optype'] == 'trash') {
     require_once libfile('function/delete');
     deletearticle($aids, true);
     cpmsg('article_trash_succeed', 'action=article&catid=' . $catid . '&perpage=' . $perpage . '&page=' . $page, 'succeed');
 } elseif ($_POST['optype'] == 'move') {
     $tocatid = intval($_POST['tocatid']);
     $catids[] = $tocatid;
     $catids = array_merge($catids);
     C::t('portal_article_title')->update($aids, array('catid' => $tocatid));
     foreach ($catids as $catid) {
         $catid = intval($catid);
         $cnt = C::t('portal_article_title')->fetch_count_for_cat($catid);
         C::t('portal_category')->update($catid, array('articles' => dintval($cnt)));
     }
     cpmsg('article_move_succeed', 'action=article&catid=' . $catid . '&perpage=' . $perpage . '&page=' . $page, 'succeed');
 } else {
     cpmsg('article_choose_at_least_one_operation', 'action=article&catid=' . $catid . '&perpage=' . $perpage . '&page=' . $page, 'error');
 }
示例#3
0
    }
} elseif ($op == 'batch') {
    check_articleperm($catid);
    $aids = $_POST['aids'];
    $optype = $_POST['optype'];
    if (empty($optype) || $optype == 'push') {
        showmessage('article_action_invalid');
    }
    if (empty($aids)) {
        showmessage('article_not_choose');
    }
    if (submitcheck('batchsubmit')) {
        if ($optype == 'trash' || $optype == 'delete') {
            require_once libfile('function/delete');
            $istrash = $optype == 'trash' ? 1 : 0;
            $article = deletearticle($_POST['aids'], $istrash);
            showmessage('article_delete_success', dreferer("portal.php?mod=portalcp&ac=category&catid={$article[0][catid]}"));
        }
    }
} elseif ($op == 'verify') {
    if ($aid) {
        check_articleperm($article['catid'], $aid, $article);
    } else {
        showmessage('article_not_exist', dreferer());
    }
} elseif ($op == 'pushplus') {
    if ($aid) {
        check_articleperm($article['catid'], $aid, $article);
    } else {
        showmessage('no_article_specified_for_pushplus', dreferer());
    }
} else {
    $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
    $validates = $deletes = $ignores = 0;
    if (is_array($moderate)) {
        foreach ($moderate as $aid => $act) {
            $moderation[$act][] = $aid;
        }
    }
    if ($validate_aids = dimplode($moderation['validate'])) {
        DB::update('portal_article_title', array('status' => '0'), "aid IN ({$validate_aids})");
        $validates = DB::affected_rows();
        updatemoderate('aid', $moderation['validate'], 2);
    }
    if (!empty($moderation['delete'])) {
        require_once libfile('function/delete');
        $articles = deletearticle($moderation['delete']);
        $deletes = count($articles);
        updatemoderate('aid', $moderation['delete'], 2);
    }
    if ($ignore_aids = dimplode($moderation['ignore'])) {
        DB::update('portal_article_title', array('status' => '2'), "aid IN ({$ignore_aids})");
        $ignores = DB::affected_rows();
        updatemoderate('aid', $moderation['ignore'], 1);
    }
    if ($_G['gp_fast']) {
        echo callback_js($_G['gp_aid']);
        exit;
    } else {
        cpmsg('moderate_articles_succeed', "action=moderate&operation=articles&page={$page}&filter={$filter}&dateline={$_G['gp_dateline']}&username={$_G['gp_username']}&keyword={$_G['gp_keyword']}&idtype={$_G['gp_idtype']}&tpp={$_G['gp_tpp']}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
    }
}
                     cpmsg('portalcategory_move_category_failed', 'action=portalcategory', 'error');
                 }
             }
         }
     }
     if ($delids) {
         deleteportalcategory($delids);
         if ($_POST['article_op'] == 'delete') {
             require_once libfile('function/delete');
             $aidarr = array();
             $query = C::t('portal_article_title')->fetch_all_for_cat($delids);
             foreach ($query as $value) {
                 $aidarr[] = $value['aid'];
             }
             if ($aidarr) {
                 deletearticle($aidarr, '0');
             }
         } else {
             C::t('portal_article_title')->update_for_cat($delids, array('catid' => $_POST['tocatid']));
             $num = C::t('portal_article_title')->fetch_count_for_cat($_POST['tocatid']);
             C::t('portal_category')->update($_POST['tocatid'], array('articles' => dintval($num)));
         }
     }
     if ($portalcategory[$_GET['catid']]['foldername']) {
         delportalcategoryfolder($_GET['catid']);
     }
     updatecache(array('portalcategory', 'diytemplatename'));
     loadcache('portalcategory', true);
     remakecategoryfile($updatecategoryfile);
     cpmsg('portalcategory_delete_succeed', 'action=portalcategory', 'succeed');
 }