DEDE未审文章批量更新时间

May 26, 2010 | tags | views
Comments 0

自己用DEDE很长时间了,建了几个站,但可能是我不懂得经营网站或是其它原因,我的这几个网站活的时间都不长,虽然模板都做得很不错,但没有流量,加上也没有时间去管理,要这样的网站也没有什么用,所以我很快就把它撒了。但我又对网络情有独钟,一有时间我就玩一下程序什么的,有时冲动干脆就会用DEDE架设自己想做的网站,对DEDECMS可以说我玩得比较上手,昨晚又做了一个。我喜欢用DEDE的采集功能,但我采集回来我一般都处理一下才发出来,而且我采集的也不多,除非是我觉得这些文章都很好,我才把它们全都采回来,但不会一次全都发表出去,所以我的等待审核的文章里偶尔会有一些未审核的文章,昨晚上去想把它们整理一下审核发表出去,但发现审核更改文章时发表时间不发生改变,要改的话还得手工去改,如下图所示:


 

手动去改很麻烦,所以依葫芦画瓢了个批量修改更新时间的程序。
系统模板主要修改页有四个content_i_list.htm,content_list.htm,content_s_list.htm,content_sg_list.htm,都增加了下面的程序:

function updatetime(aid){
        var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=updatetime&qstr="+qstr;
}

<a href="javascript:updatetime(0)" class="coolbg"> 更新时间 </a>

然后找到archives_do.php,增加updatetime函数即可。

/*-----------------------------
function updatetime(){ }

else if($dopost=='updatetime')
{
       
   $pubdate = GetMkTime(GetDateTimeMk(time()));
 $senddate = time();
 $sortrank = AddDay($pubdate,$sortup);

  if( !empty($aid) && empty($qstr) )
 {
  $qstr = $aid;
 }
 if($qstr=='')
 {
  ShowMsg("参数无效!",$ENV_GOBACK_URL);
  exit();
 }
 
  $qstrs = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));
$i = 0;
 foreach($qstrs as $aid)
 {
  
  $hghsql="Update `#@__archives` set `pubdate`='$pubdate',`senddate`='$senddate',`sortrank`='$sortrank' where id =$aid ";
                //echo $senddate."<br>".$hghsql;exit();
  if(!$dsql->ExecuteNoneQuery($hghsql)){
         $gerr = $dsql->GetError();
  ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCms官方。".str_replace('"','',$gerr),"javascript:;");
  exit();
                    }else{$i++;}
         
 ShowMsg("HGH^_^!成功更新指定文件...",$ENV_GOBACK_URL);
        exit();}

}
------------------------------*/
/*-----------------------------
function updatetime(){ }
------------------------------*/
else if($dopost=='updatetime')
{
       
   $pubdate = GetMkTime(GetDateTimeMk(time()));
 $senddate = time();
 $sortrank = AddDay($pubdate,$sortup);

  if( !empty($aid) && empty($qstr) )
 {
  $qstr = $aid;
 }
 if($qstr=='')
 {
  ShowMsg("参数无效!",$ENV_GOBACK_URL);
  exit();
 }
 
  $qstrs = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));  
  $hghsql="Update `#@__archives` set `pubdate`='$pubdate',`senddate`='$senddate',`sortrank`='$sortrank' where id in ($qstrs) ";
                //echo $senddate."<br>".$hghsql;exit();
  if(!$dsql->ExecuteNoneQuery($hghsql)){
         $gerr = $dsql->GetError();
  ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCms官方。".str_replace('"','',$gerr),"javascript:;");
  exit();
                    }else{ShowMsg("HGH^_^!成功更新指定文件...",$ENV_GOBACK_URL);exit();}
         
 

}



 

 update dede_archives set arcrank=-1;
update dede_arctiny set arcrank=-1;
update dede_taglist set arcrank=-1;
 

批量不审核
update dede_archives set arcrank=-1;
update dede_arctiny set arcrank=-1;
update dede_taglist set arcrank=-1;
 


    相关文章:



发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。