分析了一下, DEDE的文章有沒有審核發(fā)布主要是arcrank這個(gè)參數(shù)的值決定的. 所以要把DEDE自動(dòng)審核發(fā)布文章也很容易實(shí)現(xiàn)了.
代碼如下:
<?php
//自動(dòng)生成HTML版
if(isset($_GET['pub']))
{
require_once (dirname(__FILE__) . “/include/common.inc.php”);
require_once DEDEINC.”/arc.partview.class.php”;
//發(fā)布審核稿件
require_once(DEDEINC.”/arc.archives.class.php”);
for ($i=1; $i<=1; $i++) {
$row = $dsql->GetOne(“select * from `dede_arctiny` where arcrank = -1 order by id limit 1″);
$id = $row['id'];
$iquery = “update `dede_arctiny` set arcrank = 0 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery);
$iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery2);
$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”);
$ac = new Archives($id);
$rurl = $ac->MakeHtml();
}
//更新首頁
$GLOBALS['_arclistEnv'] = ‘index’;
$row = $dsql->GetOne(“Select * From `dede_homepageset`”);
$row['templet'] = MfTemplet($row['templet']);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . “/” . $row['templet']);
$pv->SaveToHtml(dirname(__FILE__).’/l’);
include(dirname(__FILE__).’/l’);
exit();
}
else
{
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:l’);
}
?>
上面的代碼主要就是更新arcrank的值. 沒有發(fā)布的文章arcrank=-1. 而發(fā)布的文章arcrank=0. 所以自審核的文章就是把a(bǔ)rcrank為-1的文章找出來, 把文章的arcrank屬性變?yōu)?.
找出文件: $row = $dsql->GetOne(“select * from `dede_arctiny` where arcrank = -1 order by id limit 1″);
改變屬性: $iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery2);
相關(guān)表的更新: Dede教程 $dsql->ExecuteNoneQuery($iquery2);
$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”);
經(jīng)常上面的修改, 再重新生成頁面. 就能自動(dòng)審核”未審核稿件”. 全部都自動(dòng)化了. 當(dāng)然還可以設(shè)置欄目, 限定自動(dòng)審核的范圍,這就看具體的需求了.
更多信息請查看IT技術(shù)專欄