function ReSp($add, $userid, $username, $ecms = 0) { global $empire, $dbtbpre; //操作权限 if ($ecms == 0) { CheckLevel($userid, $username, $classid, "sp"); } $spid = $add['spid']; $count = count($spid); if (!$count) { printerror("EmptyReSpid", "history.go(-1)"); } for ($i = 0; $i < $count; $i++) { $spid[$i] = (int) $spid[$i]; if (empty($spid[$i])) { continue; } DoSpReFile($r, $spid[$i]); } //操作日志 insert_dolog(""); printerror("ReSpSuccess", $_SERVER['HTTP_REFERER']); }
function EditSp($add, $userid, $username) { global $empire, $dbtbpre; $add['varname'] = RepPostVar($add['varname']); $spid = (int) $add[spid]; if (!$spid || !$add[spname] || !$add[varname]) { printerror("EmptySp", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "sp"); $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssp where varname='{$add['varname']}' and spid<>{$spid} limit 1"); if ($num) { printerror("HaveSp", "history.go(-1)"); } $add[sptype] = (int) $add[sptype]; $add[cid] = (int) $add[cid]; $add[classid] = (int) $add[classid]; $add[tempid] = (int) $add[tempid]; $add[maxnum] = (int) $add[maxnum]; $sptime = time(); $groupid = ReturnSpGroup($add[groupid]); $userclass = ReturnSpGroup($add[userclass]); $username = '******' . $add[username] . ','; $add[isclose] = (int) $add[isclose]; $add[cladd] = (int) $add[cladd]; $add['refile'] = (int) $add['refile']; $add['spfile'] = DoRepFileXg($add['spfile']); $add['oldspfile'] = DoRepFileXg($add['oldspfile']); $add['spfileline'] = (int) $add['spfileline']; $add['spfilesub'] = (int) $add['spfilesub']; $add['filepass'] = (int) $add['filepass']; $sql = $empire->query("update {$dbtbpre}enewssp set spname='{$add['spname']}',varname='{$add['varname']}',sppic='{$add['sppic']}',spsay='{$add['spsay']}',sptype='{$add['sptype']}',cid='{$add['cid']}',classid='{$add['classid']}',tempid='{$add['tempid']}',maxnum='{$add['maxnum']}',groupid='{$groupid}',userclass='{$userclass}',username='******',isclose='{$add['isclose']}',cladd='{$add['cladd']}',refile='{$add['refile']}',spfile='{$add['spfile']}',spfileline='{$add['spfileline']}',spfilesub='{$add['spfilesub']}' where spid='{$spid}'"); //更新附件 UpdateTheFileEditOther(7, $spid, 'other'); //生成碎片文件 if ($add['refile']) { //旧文件 if ($add['spfile'] != $add['oldspfile']) { DelSpReFile($add['oldspfile']); } DoSpReFile($add, 0); } if ($sql) { //操作日志 insert_dolog("spid=" . $spid . "<br>spname=" . $add[spname]); printerror("EditSpSuccess", "ListSp.php?cid={$add['fcid']}&fclassid={$add['fclassid']}&fsptype={$add['fsptype']}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }