帝国CMS自动审核发布脚本

网站如果是采集的,一次性审核发布大量采集信息不利于网站seo,使用这款帝国CMS自动审核发布脚本就可以轻松解决这个问题。比帝国自带的计划任务功能好,不用开启后台才运行,脚本放到服务器上后加入服务器的计划任务便可以每天定时审核发布信息。

帝国CMS自动审核脚本

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

<?php

//使用密码控制

if(empty($_GET['pwd']) || $_GET['pwd'] != '脚本运行密码,请自行修改'){

        die('Fuck you! -www.lwtz.cn!');

}

define ( 'EmpireCMSAdmin''1' );

require ("../class/connect.php");

require ("../class/db_sql.php");

require ("../class/functions.php");

require ("../class/t_functions.php");

require ("../data/dbcache/class.php");

require ("../data/dbcache/MemberLevel.php");

$link = db_connect ();

$empire new mysqlquery ();

$enews $_POST ['enews'];

if (empty $enews )) {

        $enews $_GET ['enews'];

}

//参数

$news_table "news";        //新闻表

$news_num = 1;                        //每次审核条数

/**

*使用时间控制审核的栏目,下面的代码因为栏目太多,每天分三个时段更新

*实验证明这个效果是不好的,收录只有早上的那次

*

$hours = date ( 'H' );

switch($hours){

         //频道和列表

         case '8': $where = "bclassid = 0 or classid between 33 and 86";

         break;

         case '13': $where = "bclassid = 0 or classid between 87 and 139";

         break;

         case '22': $where = "bclassid = 0 or classid between 140 and 192";

         break;

         default: $where = "classid='10000'";

}

*/

$where '1';  //审核新闻模型全部栏目

$class_list $empire->query ( "SELECT classid,islast from {$dbtbpre}enewsclass where $where" );

$class array ();

$pclass array ();

while $r $empire->fetch ( $class_list ) ) {

        if ($r ['islast'] == '0') {

                array_push $pclass$r ['classid'] ); // 非终极栏目不可以发不信息,所以不参与信息审核

        else {

                array_push $class$r ['classid'] );

        }

}

foreach $class as $key => $val ) {

        ecmscheck ( $val$news_table$news_num ); // 审核

}

// 刷新非终极栏目

foreach $pclass as $key => $value ) {

        echo '上级栏目'.$value.'已经更新<hr/>';

        ReListHtml ( $value, 1 );

}

ReIndex(); //刷新首页

/**

*

* @param  $classid

* @param  $table

* @param  $num

*/

function ecmscheck($classid$table$num) {

        global $empire$class_r$dbtbpre;

        $time = time ();

        // 每周一审核的设置为推荐

        $isgood '0';

        $day strftime "%A" );

        

        if ($day == 'Monday') {

                $isgood '1';

        }

        

        $res $empire->query ( "select id from {$dbtbpre}ecms_" $table "_check where classid =" $classid " ORDER BY `truetime` ASC LIMIT {$num}" );

        while $r $empire->fetch ( $res ) ) {

                $data [] = $r ['id'];

        }

        

        CheckNews_auto ( $classid$data );

}

/**

* 审核信息

* @param  $classid

* @param  $id

*/

function CheckNews_auto($classid$id) {

        global $empire$class_r$dbtbpre$emod_r$adddatar;

        $classid = ( int ) $classid;

        $count count $id );

        $time = time();

        

        //每周一审核的设置为推荐

        $isgood strftime('%A') == 'Monday'?1:0;

        

        for($i = 0; $i $count$i ++) {

                $infoid = ( int ) $id [$i];

                 $infor $empire->fetch1 ( "select * from {$dbtbpre}ecms_" $class_r [$classid] [tbname] . "_check where id='$infoid' limit 1" );

                 //$picurl = empty($infor['titlepic'])?'/images/smallpic/'.rand(1,300).'.jpg':$infor['titlepic']; //为了网站能好看点设置一个1-300的随机图片

                 $res $empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]."_check set truetime='$time',newstime='$time',lastdotime='$time',isgood='$isgood' where id='$infoid' limit 1");

                 $sql $empire->query ( "update {$dbtbpre}ecms_" $class_r [$classid] [tbname] . "_index set checked=1,truetime='$time',newstime='$time',lastdotime='$time' where id='$infoid'" );

                 // 未审核表转换

                 MoveCheckInfoData ( $class_r [$classid] [tbname], 0, $infor ['stb'], "id='$infoid'" );

                 // 更新栏目信息数

                 AddClassInfos ( $infor ['classid'], '''+1' );

                 // 刷新信息

                 GetHtml ( $infor ['classid'], $infor ['id'], $infor, 0 );

                 echo '信息 '.$infor ['id'].' 内容页已经更新<hr/>';

                 // 刷新列表

                 ReListHtml ( $infor ['classid'], 1 );

                 echo '终极栏目 '.$infor ['classid'].' 已经更新<hr/>';

        }

}

//刷新首页

function ReIndex(){

        $indextemp=GetIndextemp();//取得模板

        NewsBq($classid,$indextemp,1,0);

        echo '首页已经刷新';

}

脚本需要根据自己的情况适当修改调整。因为我用的Linux服务器,所以运行crontab就可以了,Windows的请自行寻找计划任务方法。宝塔面板直接添加计划任务就行。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

执刀人的工具库

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值