Example #1
0
function DelArticle()
{
    global $zbp;
    $id = (int) GetVars('id', 'GET');
    $article = new Post();
    $article->LoadInfoByID($id);
    if ($article->ID > 0) {
        if (!$zbp->CheckRights('ArticleAll') && $article->AuthorID != $zbp->user->ID) {
            $zbp->ShowError(6);
        }
        $pre_author = $article->AuthorID;
        $pre_tag = $article->Tag;
        $pre_category = $article->CateID;
        $article->Del();
        DelArticle_Comments($article->ID);
        CountTagArrayString($pre_tag);
        CountMemberArray(array($pre_author));
        CountCategoryArray(array($pre_category));
        CountNormalArticleNums();
        $zbp->AddBuildModule('previous');
        $zbp->AddBuildModule('calendar');
        $zbp->AddBuildModule('comments');
        $zbp->AddBuildModule('archives');
        $zbp->AddBuildModule('tags');
        $zbp->AddBuildModule('authors');
        foreach ($GLOBALS['Filter_Plugin_DelArticle_Succeed'] as $fpname => &$fpsignal) {
            $fpname($article);
        }
    } else {
    }
    return true;
}
Example #2
0
/**
 * 删除文章
 * @return bool
 */
function DelArticle()
{
    global $zbp;
    $id = (int) GetVars('id', 'GET');
    $article = new Post();
    $article->LoadInfoByID($id);
    if ($article->ID > 0) {
        if (!$zbp->CheckRights('ArticleAll') && $article->AuthorID != $zbp->user->ID) {
            $zbp->ShowError(6, __FILE__, __LINE__);
        }
        $pre_author = $article->AuthorID;
        $pre_tag = $article->Tag;
        $pre_category = $article->CateID;
        $pre_istop = $article->IsTop;
        $pre_status = $article->Status;
        $article->Del();
        DelArticle_Comments($article->ID);
        CountTagArrayString($pre_tag, -1, $article->ID);
        CountMemberArray(array($pre_author), array(-1, 0, 0, 0));
        CountCategoryArray(array($pre_category), -1);
        if ($pre_istop == 0 && $pre_status == 0) {
            CountNormalArticleNums(-1);
        }
        if ($article->IsTop == true) {
            CountTopArticle(null, $article->ID);
        }
        $zbp->AddBuildModule('previous');
        $zbp->AddBuildModule('calendar');
        $zbp->AddBuildModule('comments');
        $zbp->AddBuildModule('archives');
        $zbp->AddBuildModule('tags');
        $zbp->AddBuildModule('authors');
        foreach ($GLOBALS['Filter_Plugin_DelArticle_Succeed'] as $fpname => &$fpsignal) {
            $fpname($article);
        }
        return true;
    }
}