Exemplo n.º 1
0
// get services set up
$gContent = new BitArticle();
$gContent->invokeServices('content_list_function', $_REQUEST);
// nuke articles if requested
if (!empty($_REQUEST['action'])) {
    if ($_REQUEST['action'] == 'remove' && !empty($_REQUEST['remove_article_id'])) {
        $tmpArt = new BitArticle($_REQUEST['remove_article_id']);
        $tmpArt->load();
        // depending on what the status of the article is, we need to check different permissions
        if ($tmpArt->mInfo['status_id'] == ARTICLE_STATUS_PENDING) {
            $gBitSystem->verifyPermission('p_articles_remove_submission');
        } else {
            $gBitSystem->verifyPermission('p_articles_remove');
        }
        if (isset($_REQUEST["confirm"])) {
            if ($tmpArt->expunge()) {
                bit_redirect(ARTICLES_PKG_URL . 'list.php?status_id=' . (!empty($_REQUEST['status_id']) ? $_REQUEST['status_id'] : ''));
            } else {
                $feedback['error'] = $tmpArt->mErrors;
            }
        }
        $gBitSystem->setBrowserTitle(tra('Confirm removal of') . ' ' . $tmpArt->mInfo['title']);
        $formHash['remove'] = TRUE;
        $formHash['action'] = 'remove';
        $formHash['status_id'] = !empty($_REQUEST['status_id']) ? $_REQUEST['status_id'] : '';
        $formHash['remove_article_id'] = $_REQUEST['remove_article_id'];
        $msgHash = array('label' => tra('Remove Article'), 'confirm_item' => $tmpArt->mInfo['title'], 'warning' => tra('Remove the above article.'), 'error' => tra('This cannot be undone!'));
        $gBitSystem->confirmDialog($formHash, $msgHash);
    }
}
$article = new BitArticle();