網站如果是采集的,一次性審核發布大量采集信息不利于網站seo,使用這款帝國CMS自動審核發布腳本就可以輕松解決這個問題。比帝國自帶的計劃任務功能好,不用開啟后臺才運行,腳本放到服務器上后加入服務器的計劃任務便可以每天定時審核發布信息。
帝國CMS自動審核腳本
<?php //使用密碼控制 if(empty($_GET['pwd']) || $_GET['pwd'] != '腳本運行密碼,請自行修改'){ die('Fuck you! -www.zztuku.com!'); } 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的請自行尋找計劃任務方法。寶塔面板直接添加計劃任務就行。