query("insert into {$dbtbpre}enewstask(taskname,userid,isopen,filename,lastdo,doweek,doday,dohour,dominute) values('$add[taskname]',$userid,$isopen,'$add[filename]',0,'$add[doweek]','$add[doday]','$add[dohour]','$add[dominute]');"); if($sql) { $id=$empire->lastid(); //操作日志 insert_dolog("id=$id&taskname=$add[taskname]&filename=$add[filename]"); printerror('AddTaskSuccess','AddTask.php?enews=AddTask'.hReturnEcmsHashStrHref2(0)); } else { printerror('DbError',""); } } //修改计划任务 function EditTask($add,$userid,$username){ global $empire,$dbtbpre; $id=(int)$add['id']; if(!$id||empty($add['taskname'])||empty($add['filename'])) { printerror('EmptyTaskname',''); } //验证权限 CheckLevel($userid,$username,$classid,"task"); if(strstr($add['filename'],'/')||strstr($add['filename'],"\\")) { printerror('ErrorTaskFilename',''); } $userid=(int)$add['userid']; $isopen=(int)$add['isopen']; $add['dominute']=ReturnTogMins($add['min']); $add['taskname']=hRepPostStr($add['taskname'],1); $add['filename']=hRepPostStr($add['filename'],1); $add['doweek']=hRepPostStr($add['doweek'],1); $add['doday']=hRepPostStr($add['doday'],1); $add['dohour']=hRepPostStr($add['dohour'],1); $add['dominute']=hRepPostStr($add['dominute'],1); $sql=$empire->query("update {$dbtbpre}enewstask set taskname='$add[taskname]',userid=$userid,isopen=$isopen,filename='$add[filename]',doweek='$add[doweek]',doday='$add[doday]',dohour='$add[dohour]',dominute='$add[dominute]' where id=$id"); if($sql) { //操作日志 insert_dolog("id=$id&taskname=$add[taskname]&filename=$add[filename]"); printerror('EditTaskSuccess','ListTask.php'.hReturnEcmsHashStrHref2(1)); } else { printerror('DbError',""); } } //删除计划任务 function DelTask($add,$userid,$username){ global $empire,$dbtbpre; $id=(int)$add['id']; if(!$id) { printerror('EmptyDelTaskId',''); } //验证权限 CheckLevel($userid,$username,$classid,"task"); $r=$empire->fetch1("select taskname,filename from {$dbtbpre}enewstask where id=$id"); $sql=$empire->query("delete from {$dbtbpre}enewstask where id=$id"); if($sql) { //操作日志 insert_dolog("id=$id&taskname=$r[taskname]&filename=$r[filename]"); printerror('DelTaskSuccess','ListTask.php'.hReturnEcmsHashStrHref2(1)); } else { printerror('DbError',""); } } $enews=$_POST['enews']; if(empty($enews)) {$enews=$_GET['enews'];} if($enews) { hCheckEcmsRHash(); } if($enews=="AddTask") { AddTask($_POST,$logininid,$loginin); } elseif($enews=="EditTask") { EditTask($_POST,$logininid,$loginin); } elseif($enews=="DelTask") { DelTask($_GET,$logininid,$loginin); } else {} $search=$ecms_hashur['ehref']; $page=(int)$_GET['page']; $page=RepPIntvar($page); $start=0; $line=20;//每页显示条数 $page_line=20;//每页显示链接数 $offset=$page*$line;//总偏移量 $query="select id,taskname,isopen,lastdo,doweek,doday,dohour,dominute from {$dbtbpre}enewstask"; $totalquery="select count(*) as total from {$dbtbpre}enewstask"; $num=$empire->gettotal($totalquery);//取得总条数 $query=$query." order by id desc limit $offset,$line"; $sql=$empire->query($query); $returnpage=page2($num,$line,$page_line,$start,$page,$search); ?> 管理计划任务
位置:'>管理计划任务
  

fetch($sql)) { $r['doweek']=','.$r['doweek'].','!=',*,'&&$r['doweek']==0?7:$r['doweek']; $lastdo=$r['lastdo']?date("Y-m-d H:i",$r['lastdo']):'---'; if(strlen($r['dominute'])>26) { $r['dominute']=substr($r['dominute'],0,23).'...'; } ?>
ID
任务名称
分钟
小时
星期
最后执行时间
状态
操作
[执行] [修改] [删除]