织梦cms自动审核并发布文章方法(二)

织梦cms自动审核并发布文章方法(二) DEDE自动审核发布文章也很容易实现了.

<?php//自动生成HTML版if(isset($_GET['pub'])){require_once (dirname(__FILE__) . “/include/common.inc.php”);require_once DEDEINC.”/arc.partview.class.php”;//发布审核稿件require_once(DEDEINC.”/arc.archives.class.php”);for ($i=1; $i<=1; $i++) {$row = $dsql->GetOne(“select * from `ddmx_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__).’/index.html’);include(dirname(__FILE__).’/index.html’);exit();}else{header(‘HTTP/1.1 301 Moved Permanently’);header(‘Location:index.html’);}?>

上面的代码主要就是更新arcrank的值. 没有发布的文章arcrank=-1. 而发布的文章arcrank=0. 所以自审核的文章就是把arcrank为-1的文章找出来, 把文章的arcrank属性变为0.

找出文件:

$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);

相关表的更新:

$dsql->ExecuteNoneQuery($iquery2);$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”);

经常上面的修改, 再重新生成页面. 就能自动审核”未审核稿件”. 全部都自动化了. 当然还可以设置栏目, 限定自动审核的范围,这就看具体的需求了.

支付宝扫码打赏 微信扫码打赏

如果本文对你有帮助,欢迎打赏本站

喜欢 ()or分享
    匿名评论
  • 评论
人参与,条评论