1、在e/class/hinfofun.php 增加函数:
//更新当前整点时间信息
function gengxin_all($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add.="id='$id[$i]' or ";
}
$todaytime=date("Y-m-d H:00:00");//获取当前整点时间
$time=to_time("$todaytime");//对当前整点时间进行转换
$add=substr($add,0,strlen($add)-4);
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
$sql=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($r=$empire->fetch($sql))
{
//投稿增加积分
if($r[ismember]&&$r[userid]&&!$r[haveaddfen])
{
$cr=$empire->fetch1("select classid,addinfofen from {$dbtbpre}enewsclass where classid='$r[classid]'");
if($cr[addinfofen])
{
AddInfoFen($cr[addinfofen],$r[userid]);
if($cr[addinfofen]<0)
{
BakDown($r[classid],$r[id],0,$r[userid],$r[username],$r[title],abs($cr[addinfofen]),3);
}
}
$usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set haveaddfen=1 where id=$r[id]");
}
//返回自定义字段
$ret_r=ReturnAddF($r,$class_r[$r[classid]][modid],$userid,$username,2,1,0);
//刷新信息
GetHtml($r,$ret_r);
}
//刷新列表
//ReListHtml($classid,1);
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新当前整点时间信息-by chinap
//更新当前半点时间信息
function gengxin_all_h($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add.="id='$id[$i]' or ";
}
$todaytime=date("Y-m-d H:30:00");//获取当前半点时间
$time=to_time("$todaytime");//对当前半点时间进行转换
$add=substr($add,0,strlen($add)-4);
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
$sql=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($r=$empire->fetch($sql))
{
//投稿增加积分
if($r[ismember]&&$r[userid]&&!$r[haveaddfen])
{
$cr=$empire->fetch1("select classid,addinfofen from {$dbtbpre}enewsclass where classid='$r[classid]'");
if($cr[addinfofen])
{
AddInfoFen($cr[addinfofen],$r[userid]);
if($cr[addinfofen]<0)
{
BakDown($r[classid],$r[id],0,$r[userid],$r[username],$r[title],abs($cr[addinfofen]),3);
}
}
$usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set haveaddfen=1 where id=$r[id]");
}
//返回自定义字段
$ret_r=ReturnAddF($r,$class_r[$r[classid]][modid],$userid,$username,2,1,0);
//刷新信息
GetHtml($r,$ret_r);
}
//刷新列表
//ReListHtml($classid,1);
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新当前半点时间信息-by chinap
//更新半点时间信息 add
function gengxin_hh($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add="id='$id[$i]'";
$sqlt=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($sql_r=$empire->fetch($sqlt))
{
$oldtime=$sql_r[newstime];
$sqltime=date("Y-m-d H:30:00",$oldtime);//获取半点时间
$time=to_time("$sqltime");//对半点进行转换
}
//echo $sqltime."<br>";
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
}
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新半点时间信息-by chinap
//更新明天时间信息 add
function gengxin_mt($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add="id='$id[$i]'";
$sqlt=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($sql_r=$empire->fetch($sqlt))
{
$oldtime=$sql_r[newstime];
$jt=date("Y-m-d",time());//jt
$ot = date("Y-m-d",$oldtime);
$ok_jt = to_time("$jt");
$ok_ot = to_time("$ot");
$ok_time = $ok_jt - $ok_ot;//数据库时间跟现在时间相比的时间差
$sqltime_t = $oldtime + $ok_time;//数据库时间加相差时间,变为今天时间
$time = $sqltime_t+86400*1;//加一天,设为明天
}
//echo date("Y-m-d H:i:s",$time)."<br />";
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
}
//exit;
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新明天时间信息-by chinap
//更新后天时间信息 add
function gengxin_ht($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add="id='$id[$i]'";
$sqlt=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($sql_r=$empire->fetch($sqlt))
{
$oldtime=$sql_r[newstime];
$jt=date("Y-m-d",time());//jt
$ot = date("Y-m-d",$oldtime);
$ok_jt = to_time("$jt");
$ok_ot = to_time("$ot");
$ok_time = $ok_jt - $ok_ot;//数据库时间跟现在时间相比的时间差
$sqltime_t = $oldtime + $ok_time;//数据库时间加相差时间,变为今天时间
$time = $sqltime_t+86400*2;//加二天,设为后天
}
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
}
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新后天时间信息-by chinap
//更新今天时间信息 add
function gengxin_jt($classid,$id,$userid,$username){
global $empire,$class_r,$dbtbpre;
if(empty($classid))
{printerror("ErrorUrl","history.go(-1)");}
//验证权限
$doselfinfo=CheckLevel($userid,$username,$classid,"news");
//编辑权限
if(!$doselfinfo['doeditinfo'])
{
printerror("NotEditInfoLevel","history.go(-1)");
}
$count=count($id);
if(empty($count))
{printerror("Notgengxinid","history.go(-1)");}
for($i=0;$i<$count;$i++)
{
$add="id='$id[$i]'";
$sqlt=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
while($sql_r=$empire->fetch($sqlt))
{
$oldtime=$sql_r[newstime];
$jt=date("Y-m-d",time());//jt
$ot = date("Y-m-d",$oldtime);
$ok_jt = to_time("$jt");
$ok_ot = to_time("$ot");
$ok_time = $ok_jt - $ok_ot;//数据库时间跟现在时间相比的时间差
$sqltime_t = $oldtime + $ok_time;//数据库时间加相差时间,变为今天时间
$time = $sqltime_t;//设为今天
}
$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set newstime='$time'".$update." where ".$add);
}
if($sql)
{
//操作日志
insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
printerror("gengxinSuccess",$_SERVER['HTTP_REFERER']);
}
else
{printerror("DbError","history.go(-1)");}
}
//更新今天时间信息-by chinap
2、在e/admin/ecmsinfo.php 中增加条件判断:
//当前整点时间-by chinap add
elseif($enews=="gengxin_all")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_all($classid,$id,$logininid,$loginin);
}
//当前整点时间-by chinap end
//当前半点时间-by chinap add
elseif($enews=="gengxin_all_h")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_all_h($classid,$id,$logininid,$loginin);
}
//当前半点时间-by chinap end
//整点时间-by chinap add
elseif($enews=="gengxin_h")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_h($classid,$id,$logininid,$loginin);
}
//整点时间-by chinap end
//半点时间-by chinap add
elseif($enews=="gengxin_hh")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_hh($classid,$id,$logininid,$loginin);
}
//半点时间-by chinap end
//今天时间-by chinap add
elseif($enews=="gengxin_jt")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_jt($classid,$id,$logininid,$loginin);
}
//今天时间-by chinap end
//明天时间-by chinap add
elseif($enews=="gengxin_mt")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_mt($classid,$id,$logininid,$loginin);
}
//明天时间-by chinap end
//后天时间-by chinap add
elseif($enews=="gengxin_ht")
{
$bclassid=$_POST['bclassid'];
$classid=$_POST['classid'];
$id=$_POST['id'];
gengxin_ht($classid,$id,$logininid,$loginin);
}
//后天时间-by chinap end
3、在e/data/html/list/listinfo.php 中增加按钮代码
<!--add-->
<input type="submit" name="Submit88jt" value="设为今天" onClick="document.listform.enews.value='gengxin_jt';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit88mt" value="设为明天" onClick="document.listform.enews.value='gengxin_mt';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit88ht" value="设为后天" onClick="document.listform.enews.value='gengxin_ht';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit8h8" value="设为当前整点时间" onClick="document.listform.enews.value='gengxin_all';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit88h8" value="设为当前半点时间" onClick="document.listform.enews.value='gengxin_all_h';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit8h8h" value="设为整点时间" onClick="document.listform.enews.value='gengxin_h';document.listform.action='ecmsinfo.php';">
<input type="submit" name="Submit8h8h8" value="设为半点时间" onClick="document.listform.enews.value='gengxin_hh';document.listform.action='ecmsinfo.php';">
<!--add end-->