function DoWfInfo($add, $userid, $username) { global $empire, $dbtbpre, $class_r, $emod_r, $lur; $id = (int) $add[id]; $classid = (int) $add[classid]; $doing = (int) $add['doing']; if (!$id || !$classid || !$doing) { printerror('EmptyDoWfInfo', ''); } $wfinfor = $empire->fetch1("select id,checknum,wfid,tid,groupid,userclass,username,checktno from {$dbtbpre}enewswfinfo where id='{$id}' and classid='{$classid}' limit 1"); if (!$wfinfor[id]) { printerror('ErrorUrl', ''); } if ($wfinfor[checktno] == '100' || $wfinfor[checktno] == '101' || $wfinfor[checktno] == '102') { printerror('DoWfInfoOver', ''); } $wfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where tid='{$wfinfor['tid']}'"); if (!(strstr(',' . $wfitemr[groupid] . ',', ',' . $lur[groupid] . ',') || strstr(',' . $wfitemr[userclass] . ',', ',' . $lur[classid] . ',') || strstr(',' . $wfitemr[username] . ',', ',' . $lur[username] . ','))) { printerror("NotDoCheckUserLevel", "history.go(-1)"); } if (!(strstr(',' . $wfinfor[groupid] . ',', ',' . $lur[groupid] . ',') || strstr(',' . $wfinfor[userclass] . ',', ',' . $lur[classid] . ',') || strstr(',' . $wfinfor[username] . ',', ',' . $lur[username] . ','))) { printerror("HaveDoWfInfo", "history.go(-1)"); } $pubid = ReturnInfoPubid($classid, $id); //附加链接参数 $addecmscheck = empty($_POST['ecmscheck']) ? '&ecmscheck=1' : ''; $checktext = ehtmlspecialchars($add[checktext]); if ($doing == 1) { if ($wfitemr[lztype] == 0) { if ($wfitemr['tno'] == '100') { $empire->query("update {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_index set checked=1 where id='{$id}'"); $ar = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_check where id='{$id}'"); //未审核表转换 MoveCheckInfoData($class_r[$classid][tbname], 0, $ar['stb'], "id='{$id}'"); //更新栏目信息数 AddClassInfos($classid, '', '+1'); $empire->query("update {$dbtbpre}enewswfinfo set tstatus='',checktno='100' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); //生成 GetHtml($ar['classid'], $ar['id'], $ar, 1); ListHtml($classid, $fr, 0); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tno>{$wfitemr['tno']} order by tno limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='0' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $newwfitemr[wfid], $newwfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } else { $newgroupid = str_replace(',' . $lur[groupid] . ',', ',', $wfinfor[groupid]); $newuserclass = str_replace(',' . $lur[classid] . ',', ',', $wfinfor[userclass]); $newusername = str_replace(',' . $lur[username] . ',', ',', $wfinfor[username]); //下一个节点 if (($newgroupid == '' || $newgroupid == ',') && ($newuserclass == '' || $newuserclass == ',') && ($newusername == '' || $newusername == ',')) { if ($wfitemr['tno'] == '100') { $empire->query("update {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_index set checked=1 where id='{$id}'"); $ar = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_check where id='{$id}'"); //未审核表转换 MoveCheckInfoData($class_r[$classid][tbname], 0, $ar['stb'], "id='{$id}'"); //更新栏目信息数 AddClassInfos($classid, '', '+1'); $empire->query("update {$dbtbpre}enewswfinfo set tstatus='',checktno='100' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); //生成 GetHtml($ar['classid'], $ar['id'], $ar, 1); ListHtml($classid, $fr, 0); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tno>{$wfitemr['tno']} order by tno limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='0' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $newwfitemr[wfid], $newwfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } else { $empire->query("update {$dbtbpre}enewswfinfo set groupid='{$newgroupid}',userclass='{$newuserclass}',username='******' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } $mess = 'DoWfInfoCkSuccess'; } elseif ($doing == 2) { if (empty($checktext)) { printerror('EmptyChecktext', 'history.go(-1)'); } if ($wfitemr[tbdo] == 0) { $empire->query("update {$dbtbpre}enewswfinfo set tid=0,tstatus='',checktno='101' where id='{$id}' and classid='{$classid}' limit 1"); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tid='{$wfitemr['tbdo']}' limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='101' where id='{$id}' and classid='{$classid}' limit 1"); } //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 2); $mess = 'DoWfInfoTbSuccess'; } else { if (empty($checktext)) { printerror('EmptyChecktext', 'history.go(-1)'); } $empire->query("update {$dbtbpre}enewswfinfo set tid=0,tstatus='',checktno='102' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 3); if ($wfitemr[tddo]) { $index_r = $empire->fetch1("select checked from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_index where id='{$id}' limit 1"); //返回表 $infotb = ReturnInfoMainTbname($class_r[$classid][tbname], $index_r['checked']); $r = $empire->fetch1("select * from " . $infotb . " where id='{$id}' limit 1"); $mid = $class_r[$classid][modid]; $tbname = $class_r[$classid][tbname]; $pf = $emod_r[$mid]['pagef']; $stf = $emod_r[$mid]['savetxtf']; //返回表信息 $infotbr = ReturnInfoTbname($class_r[$classid][tbname], $index_r['checked'], $r['stb']); //分页字段 if ($pf) { if (strstr($emod_r[$mid]['tbdataf'], ',' . $pf . ',')) { $finfor = $empire->fetch1("select " . $pf . " from " . $infotbr['datatbname'] . " where id='{$id}' limit 1"); $r[$pf] = $finfor[$pf]; } } //存文本 if ($stf) { $newstextfile = $r[$stf]; $r[$stf] = GetTxtFieldText($r[$stf]); DelTxtFieldText($newstextfile); //删除文件 } DelNewsFile($r[filename], $r[newspath], $classid, $r[$pf], $r[groupid]); //删除信息文件 $empire->query("delete from {$dbtbpre}ecms_" . $tbname . "_index where id='{$id}'"); $sql = $empire->query("delete from " . $infotbr['tbname'] . " where id='{$id}'"); $fsql = $empire->query("delete from " . $infotbr['datatbname'] . " where id='{$id}'"); //更新栏目信息数 AddClassInfos($r[classid], '-1', '-1', $index_r['checked']); //删除其它表记录与附件 DelSingleInfoOtherData($r['classid'], $id, $r, 0, 0); } $mess = 'DoWfInfoTdSuccess'; $isclose = 1; } //操作日志 insert_dolog("classid={$classid}&id={$id}", $pubid); printerror($mess, "workflow/DoWfInfo.php?classid={$classid}&id={$id}&isclose={$isclose}" . hReturnEcmsHashStrHref2(0)); }
function InfoUpdateToWorkflow($id, $classid, $wfid, $userid, $username) { global $empire, $dbtbpre, $class_r; $wfinfor = $empire->fetch1("select checknum,wfid,tid,checktno from {$dbtbpre}enewswfinfo where id='{$id}' and classid='{$classid}' limit 1"); if ($wfinfor[checktno] != '101') { return ''; } if ($wfinfor[tid]) { $ywfitemr = $empire->fetch1("select tno from {$dbtbpre}enewsworkflowitem where tid='{$wfinfor['tid']}'"); $wfitemr = $empire->fetch1("select tid,tno,groupid,userclass,username,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfinfor['wfid']}' and tno>{$ywfitemr['tno']} order by tno limit 1"); } else { $wfitemr = $empire->fetch1("select tid,tno,groupid,userclass,username,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfinfor['wfid']}' order by tno limit 1"); } //状态更新 $empire->query("update {$dbtbpre}enewswfinfo set tid='{$wfitemr['tid']}',groupid='{$wfitemr['groupid']}',userclass='{$wfitemr['userclass']}',username='******'username']}',checknum=checknum+1,tstatus='{$wfitemr['tstatus']}',checktno='0' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfinfor[wfid], 0, $username, '', $wfinfor[checknum], 0); }
function DoWfInfo($add, $userid, $username) { global $empire, $dbtbpre, $class_r, $emod_r, $lur; $id = (int) $add[id]; $classid = (int) $add[classid]; $doing = (int) $add['doing']; if (!$id || !$classid || !$doing) { printerror('EmptyDoWfInfo', ''); } $wfinfor = $empire->fetch1("select id,checknum,wfid,tid,groupid,userclass,username,checktno from {$dbtbpre}enewswfinfo where id='{$id}' and classid='{$classid}' limit 1"); if (!$wfinfor[id]) { printerror('ErrorUrl', ''); } if ($wfinfor[checktno] == '100' || $wfinfor[checktno] == '101' || $wfinfor[checktno] == '102') { printerror('DoWfInfoOver', ''); } $wfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where tid='{$wfinfor['tid']}'"); if (!(strstr(',' . $wfitemr[groupid] . ',', ',' . $lur[groupid] . ',') || strstr(',' . $wfitemr[userclass] . ',', ',' . $lur[classid] . ',') || strstr(',' . $wfitemr[username] . ',', ',' . $lur[username] . ','))) { printerror("NotDoCheckUserLevel", "history.go(-1)"); } if (!(strstr(',' . $wfinfor[groupid] . ',', ',' . $lur[groupid] . ',') || strstr(',' . $wfinfor[userclass] . ',', ',' . $lur[classid] . ',') || strstr(',' . $wfinfor[username] . ',', ',' . $lur[username] . ','))) { printerror("HaveDoWfInfo", "history.go(-1)"); } $checktext = htmlspecialchars($add[checktext]); if ($doing == 1) { if ($wfitemr[lztype] == 0) { if ($wfitemr['tno'] == '100') { $empire->query("update {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " set checked=1 where id='{$id}'"); $empire->query("update {$dbtbpre}enewswfinfo set tstatus='',checktno='100' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); //生成 $ar = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where id='{$id}'"); GetHtml($ar, ''); ListHtml($classid, $fr, 0); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tno>{$wfitemr['tno']} order by tno limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='0' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $newwfitemr[wfid], $newwfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } else { $newgroupid = str_replace(',' . $lur[groupid] . ',', ',', $wfinfor[groupid]); $newuserclass = str_replace(',' . $lur[classid] . ',', ',', $wfinfor[userclass]); $newusername = str_replace(',' . $lur[username] . ',', ',', $wfinfor[username]); //下一个节点 if (($newgroupid == '' || $newgroupid == ',') && ($newuserclass == '' || $newuserclass == ',') && ($newusername == '' || $newusername == ',')) { if ($wfitemr['tno'] == '100') { $empire->query("update {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " set checked=1 where id='{$id}'"); $empire->query("update {$dbtbpre}enewswfinfo set tstatus='',checktno='100' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); //生成 $ar = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where id='{$id}'"); GetHtml($ar, ''); ListHtml($classid, $fr, 0); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tno>{$wfitemr['tno']} order by tno limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='0' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $newwfitemr[wfid], $newwfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } else { $empire->query("update {$dbtbpre}enewswfinfo set groupid='{$newgroupid}',userclass='{$newuserclass}',username='******' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 1); } } $mess = 'DoWfInfoCkSuccess'; } elseif ($doing == 2) { if (empty($checktext)) { printerror('EmptyChecktext', 'history.go(-1)'); } if ($wfitemr[tbdo] == 0) { $empire->query("update {$dbtbpre}enewswfinfo set tid=0,tstatus='',checktno='101' where id='{$id}' and classid='{$classid}' limit 1"); } else { $newwfitemr = $empire->fetch1("select tid,wfid,tno,groupid,userclass,username,lztype,tbdo,tddo,tstatus from {$dbtbpre}enewsworkflowitem where wfid='{$wfitemr['wfid']}' and tid='{$wfitemr['tbdo']}' limit 1"); $empire->query("update {$dbtbpre}enewswfinfo set tid='{$newwfitemr['tid']}',groupid='{$newwfitemr['groupid']}',userclass='{$newwfitemr['userclass']}',username='******'username']}',tstatus='{$newwfitemr['tstatus']}',checktno='101' where id='{$id}' and classid='{$classid}' limit 1"); } //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 2); $mess = 'DoWfInfoTbSuccess'; } else { if (empty($checktext)) { printerror('EmptyChecktext', 'history.go(-1)'); } $empire->query("update {$dbtbpre}enewswfinfo set tid=0,tstatus='',checktno='102' where id='{$id}' and classid='{$classid}' limit 1"); //日志 InsertWfLog($classid, $id, $wfitemr[wfid], $wfitemr[tid], $username, $checktext, $wfinfor[checknum], 3); if ($wfitemr[tddo]) { $r = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where id='{$id}'"); $mid = $class_r[$classid][modid]; $tbname = $class_r[$classid][tbname]; $pf = $emod_r[$mid]['pagef']; $stf = $emod_r[$mid]['savetxtf']; //分页字段 if ($pf) { if (strstr($emod_r[$mid]['tbdataf'], ',' . $pf . ',')) { $finfor = $empire->fetch1("select " . $pf . " from {$dbtbpre}ecms_" . $tbname . "_data_" . $r[stb] . " where id='{$id}'"); $r[$pf] = $finfor[$pf]; } } //存文本 if ($stf) { $newstextfile = $r[$stf]; $r[$stf] = GetTxtFieldText($r[$stf]); DelTxtFieldText($newstextfile); //删除文件 } DelNewsFile($r[filename], $r[newspath], $classid, $r[$pf], $r[groupid]); //删除信息文件 $sql = $empire->query("delete from {$dbtbpre}ecms_" . $tbname . " where id='{$id}'"); $fsql = $empire->query("delete from {$dbtbpre}ecms_" . $tbname . "_data_" . $r[stb] . " where id='{$id}'"); //删除其它表记录 $delsql = $empire->query("delete from {$dbtbpre}enewswfinfo where id='{$id}' and classid='{$r['classid']}'"); $delsql = $empire->query("delete from {$dbtbpre}enewswfinfolog where id='{$id}' and classid='{$r['classid']}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsinfovote where id='{$id}' and classid='{$r['classid']}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsdiggips where id='{$id}' and classid='{$r['classid']}'"); DelNewsTheFile($id, $classid); //删除附件 } $mess = 'DoWfInfoTdSuccess'; $isclose = 1; } //操作日志 insert_dolog("classid={$classid}&id={$id}"); printerror($mess, "workflow/DoWfInfo.php?classid={$classid}&id={$id}&isclose={$isclose}"); }