dedecms 自动审核会员发表的最新文章的修改方法
<p><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>分析了一下, DEDE的文章有没有审核发布主要是arcrank这个参数的值决定的. 所以要把DEDE自动审核发布文章也很容易实现了. </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
<?php <br>
//自动生成HTML版 <br>
if(isset($_GET['pub'])) <br>
{ <br>
require_once (dirname(__FILE__) . “/include/common.inc.php”); <br>
require_once DEDEINC.”/arc.partview.class.php”; <br>
//发布审核稿件 <br>
require_once(DEDEINC.”/arc.archives.class.php”); <br>
for ($i=1; $i<=1; $i++) { <br>
$row = $dsql->GetOne(“select * from `dede_arctiny` where arcrank = -1 order by id limit 1″); <br>
$id = $row['id']; <br>
$iquery = “update `dede_arctiny` set arcrank = 0 where id=’$id’”; <br>
$dsql->ExecuteNoneQuery($iquery); <br>
$iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”; <br>
$dsql->ExecuteNoneQuery($iquery2); <br>
$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”); <br>
$ac = new Archives($id); <br>
$rurl = $ac->MakeHtml(); <br>
} <br>
//更新首页 <br>
$GLOBALS['_arclistEnv'] = ‘index’; <br>
$row = $dsql->GetOne(“Select * From `dede_homepageset`”); <br>
$row['templet'] = MfTemplet($row['templet']); <br>
$pv = new PartView(); <br>
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . “/” . $row['templet']); <br>
$pv->SaveToHtml(dirname(__FILE__).’/index.html’); <br>
include(dirname(__FILE__).’/index.html’); <br>
exit(); <br>
} <br>
else <br>
{ <br>
header(‘HTTP/1.1 301 Moved Permanently’); <br>
header(‘Location:index.html’); <br>
} <br>
?> </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>上面的代码主要就是更新arcrank的值. 没有发布的文章arcrank=-1. 而发布的文章arcrank=0. 所以自审核的文章就是把arcrank为-1的文章找出来, 把文章的arcrank属性变为0. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>找出文件: $row = $dsql->GetOne(“select * from `dede_arctiny` where arcrank = -1 order by id limit 1″); </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>改变属性: $iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”; </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>$dsql->ExecuteNoneQuery($iquery2); </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>相关表的更新: Dede教程 $dsql->ExecuteNoneQuery($iquery2); </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”); </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>经常上面的修改, 再重新生成页面. 就能自动审核”未审核稿件”. 全部都自动化了. 当然还可以设置栏目, 限定自动审核的范围,这就看具体的需求了.</span></p>
頁:
[1]