DEDE审核文章并同步更新文章的发布日期
2009-3-16 12:36 by suenquan 本站原创
这个功能个人感觉非常的好,为什么呢?
DEDE默认对于审核的文章,在审核的同时,对于发布时间是不做修改的.
这样就会遇到一个问题,会员在3月1日发布了文章,我假设今天才审核通过,那么该篇文章的发布日期即为3月1日,那么在首页最近更新,就看不见这篇文章了.
我们只要在审核文章时同步更新文章的发布日期,那么即便是3月1日提交的文章,现在审核后有,在首页也会马上显示为最近更新.
非常的方便实用.
以下为具体修改方法.其中DEDE5.1版的修改方法为DEDE的版主发布,DEDE5.3版修改方法为DEDE网友发布,而DEDE4.0版本是我自己按照前者的方法自己修改的.
(4.0版和5.1版,我自己测试发布成功,5.3版未测试)
4.0版
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在115行开始:
修改为:
5.1版本
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在120行开始:
修改为:
5.3版本
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在200行开始:
修改为:

DEDE默认对于审核的文章,在审核的同时,对于发布时间是不做修改的.
这样就会遇到一个问题,会员在3月1日发布了文章,我假设今天才审核通过,那么该篇文章的发布日期即为3月1日,那么在首页最近更新,就看不见这篇文章了.
我们只要在审核文章时同步更新文章的发布日期,那么即便是3月1日提交的文章,现在审核后有,在首页也会马上显示为最近更新.
非常的方便实用.
以下为具体修改方法.其中DEDE5.1版的修改方法为DEDE的版主发布,DEDE5.3版修改方法为DEDE网友发布,而DEDE4.0版本是我自己按照前者的方法自己修改的.
(4.0版和5.1版,我自己测试发布成功,5.3版未测试)
4.0版
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在115行开始:
引用
/*--------------------------
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(dirname(__FILE__)."/inc/inc_archives_functions.php");
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$dsql = new DedeSql(false);
$dsql->SetQuery("Update #@__archives set arcrank='0',adminID='".$cuserLogin->getUserID()."' where ID='$aid' And arcrank<'0'");
$dsql->ExecuteNoneQuery();
$pageurl = MakeArt($aid,true);
$dsql->Close();
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(dirname(__FILE__)."/inc/inc_archives_functions.php");
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$dsql = new DedeSql(false);
$dsql->SetQuery("Update #@__archives set arcrank='0',adminID='".$cuserLogin->getUserID()."' where ID='$aid' And arcrank<'0'");
$dsql->ExecuteNoneQuery();
$pageurl = MakeArt($aid,true);
$dsql->Close();
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
修改为:
引用
/*--------------------------
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(dirname(__FILE__)."/inc/inc_archives_functions.php");
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$dsql = new DedeSql(false);
$newdate = time();
$dsql->SetQuery("Update #@__archives set pubdate='$newdate',senddate='$newdate',arcrank='0',adminID='".$cuserLogin->getUserID()."' where ID='$aid' And arcrank<'0'");
$dsql->ExecuteNoneQuery();
$pageurl = MakeArt($aid,true);
$dsql->Close();
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(dirname(__FILE__)."/inc/inc_archives_functions.php");
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$dsql = new DedeSql(false);
$newdate = time();
$dsql->SetQuery("Update #@__archives set pubdate='$newdate',senddate='$newdate',arcrank='0',adminID='".$cuserLogin->getUserID()."' where ID='$aid' And arcrank<'0'");
$dsql->ExecuteNoneQuery();
$pageurl = MakeArt($aid,true);
$dsql->Close();
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
5.1版本
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在120行开始:
引用
/*--------------------------
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
$dsql = new DedeSql(false);
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$tables = GetChannelTable($dsql,$aid,'arc');
$dsql->ExecuteNoneQuery(" Update `{$tables['maintable']}` set arcrank='0' where ID='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set arcrank='0' where aid='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `{$tables['maintable']}`; ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__full_search`; ");
$pageurl = MakeArt($aid,true);
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set url='$pageurl' where aid='$aid'");
}
ClearAllLink();
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
//审核文档
function checkArchives();
---------------------------*/
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
$dsql = new DedeSql(false);
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$tables = GetChannelTable($dsql,$aid,'arc');
$dsql->ExecuteNoneQuery(" Update `{$tables['maintable']}` set arcrank='0' where ID='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set arcrank='0' where aid='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `{$tables['maintable']}`; ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__full_search`; ");
$pageurl = MakeArt($aid,true);
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set url='$pageurl' where aid='$aid'");
}
ClearAllLink();
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
修改为:
引用
else if($dopost=="checkArchives")
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
$dsql = new DedeSql(false);
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$tables = GetChannelTable($dsql,$aid,'arc');
$newdate = time();
$dsql->ExecuteNoneQuery(" Update `{$tables['maintable']}` set pubdate='$newdate',senddate='$newdate',arcrank='0' where ID='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set uptime='$newdate',pubdate='$newdate',arcrank='0' where aid='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `{$tables['maintable']}`; ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__full_search`; ");
$pageurl = MakeArt($aid,true);
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set url='$pageurl' where aid='$aid'");
}
ClearAllLink();
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
{
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
$dsql = new DedeSql(false);
if( $aid!="" && !ereg("(".$aid."`|`".$aid.")",$qstr) ) $qstr .= "`".$aid;
if($qstr==""){
ShowMsg("参数无效!",$ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`",$qstr);
foreach($qstrs as $aid)
{
$aid = ereg_replace("[^0-9]","",$aid);
if($aid=="") continue;
$tables = GetChannelTable($dsql,$aid,'arc');
$newdate = time();
$dsql->ExecuteNoneQuery(" Update `{$tables['maintable']}` set pubdate='$newdate',senddate='$newdate',arcrank='0' where ID='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set uptime='$newdate',pubdate='$newdate',arcrank='0' where aid='$aid' And arcrank<'0' ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `{$tables['maintable']}`; ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__full_search`; ");
$pageurl = MakeArt($aid,true);
$dsql->ExecuteNoneQuery(" Update `#@__full_search` set url='$pageurl' where aid='$aid'");
}
ClearAllLink();
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
exit();
}
5.3版本
打开DEDE后台所在目录(默认为dede)的archives_do.php文件,大概在200行开始:
引用
$maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
$dsql->ExecuteNoneQuery("Update `#@__arctiny` set arcrank='0' where id='$aid' ");
if($row['issystem']==-1)
{
$dsql->ExecuteNoneQuery("Update `".trim($row['addtable'])."` set arcrank='0' where aid='$aid' ");
}
else
{
$dsql->ExecuteNoneQuery("Update `$maintable` set arcrank='0' where id='$aid' ");
}
$pageurl = MakeArt($aid,false);
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
$dsql->ExecuteNoneQuery("Update `#@__arctiny` set arcrank='0' where id='$aid' ");
if($row['issystem']==-1)
{
$dsql->ExecuteNoneQuery("Update `".trim($row['addtable'])."` set arcrank='0' where aid='$aid' ");
}
else
{
$dsql->ExecuteNoneQuery("Update `$maintable` set arcrank='0' where id='$aid' ");
}
$pageurl = MakeArt($aid,false);
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
修改为:
引用
$maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
$newdate = time();
$dsql->ExecuteNoneQuery("Update `#@__arctiny` set pubdate='$newdate',senddate='$newdate',arcrank='0' where id='$aid' ");
if($row['issystem']==-1)
{
$dsql->ExecuteNoneQuery("Update `".trim($row['addtable'])."` set pubdate='$newdate',senddate='$newdate',arcrank='0' where aid='$aid' ");
}
else
{
$dsql->ExecuteNoneQuery("Update `$maintable` set pubdate='$newdate',senddate='$newdate',arcrank='0' where id='$aid' ");
}
$pageurl = MakeArt($aid,false);
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
$newdate = time();
$dsql->ExecuteNoneQuery("Update `#@__arctiny` set pubdate='$newdate',senddate='$newdate',arcrank='0' where id='$aid' ");
if($row['issystem']==-1)
{
$dsql->ExecuteNoneQuery("Update `".trim($row['addtable'])."` set pubdate='$newdate',senddate='$newdate',arcrank='0' where aid='$aid' ");
}
else
{
$dsql->ExecuteNoneQuery("Update `$maintable` set pubdate='$newdate',senddate='$newdate',arcrank='0' where id='$aid' ");
}
$pageurl = MakeArt($aid,false);
}
ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
Posted in dede | Tags: dede审核文章更新时间
COMMENT[2]












——DEDE 5.3 用户!