function EditZtType($add, $userid, $username) { global $empire, $dbtbpre; $add = DoPostZtTypeVar($add); $ztid = (int) $add['ztid']; $cid = (int) $add['cid']; if (!$ztid || !$cid || !$add[cname]) { printerror("EmptyZtType", "history.go(-1)"); } //验证权限 //CheckLevel($userid,$username,$classid,"zt"); $r = $empire->fetch1("select ztid,cname from {$dbtbpre}enewszttype where cid='{$cid}' and ztid='{$ztid}' limit 1"); if (!$r['ztid']) { printerror('ErrorUrl', ''); } $sql = $empire->query("update {$dbtbpre}enewszttype set cname='{$add['cname']}',myorder='{$add['myorder']}',islist='{$add['islist']}',listtempid='{$add['listtempid']}',maxnum='{$add['maxnum']}',tnum='{$add['tnum']}',reorder='{$add['reorder']}',ttype='{$add['ttype']}' where cid='{$cid}'"); $empire->query("update {$dbtbpre}enewszttypeadd set classtext='" . eaddslashes2($add[classtext]) . "' where cid='{$cid}'"); //生成页面 ListHtmlIndex($cid, '', 1); if ($sql) { //操作日志 insert_dolog("ztid=" . $ztid . "<br>cid=" . $cid . "<br>cname=" . $add[cname]); printerror("EditZtTypeSuccess", "ZtType.php?ztid={$ztid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditClasstemp($add,$userid,$username){ global $empire,$dbtbpre,$public_r; $tempid=(int)$add['tempid']; if(!$tempid||!$add[tempname]||!$add[temptext]) { printerror("EmptyClasstempname","history.go(-1)"); } //验证权限 CheckLevel($userid,$username,$classid,"template"); $classid=(int)$add['classid']; $gid=(int)$add['gid']; $add[tempname]=hRepPostStr($add[tempname],1); $add[temptext]=RepPhpAspJspcode($add[temptext]); $sql=$empire->query("update ".GetDoTemptb("enewsclasstemp",$gid)." set tempname='$add[tempname]',temptext='".eaddslashes2($add[temptext])."',classid=$classid where tempid=$tempid"); //备份模板 AddEBakTemp('classtemp',$gid,$tempid,$add[tempname],$add[temptext],0,0,'',0,0,'',0,$classid,0,$userid,$username); if($gid==$public_r['deftempid']||(!$public_r['deftempid']&&($gid==1||$gid==0))) { //删除动态模板缓存文件 DelOneTempTmpfile('classtemp'.$tempid); } if($sql) { //操作日志 insert_dolog("tempid=$tempid&tempname=$add[tempname]&gid=$gid"); printerror("EditClasstempSuccess","ListClasstemp.php?classid=$add[cid]&gid=$gid".hReturnEcmsHashStrHref2(0)); } else { printerror("DbError","history.go(-1)"); } }
function EditIndexpage($add,$userid,$username){ global $empire,$dbtbpre,$public_r; $tempid=(int)$add[tempid]; if(!$tempid||!$add[tempname]||!$add[temptext]) { printerror("EmptyIndexpageName","history.go(-1)"); } //验证权限 CheckLevel($userid,$username,$classid,"template"); $gid=(int)$add['gid']; $add[tempname]=hRepPostStr($add[tempname],1); $add[temptext]=RepPhpAspJspcode($add[temptext]); $sql=$empire->query("update {$dbtbpre}enewsindexpage set tempname='".$add[tempname]."',temptext='".eaddslashes2($add[temptext])."' where tempid='$tempid'"); //备份模板 AddEBakTemp('indexpage',1,$tempid,$add[tempname],$add[temptext],0,0,'',0,0,'',0,0,0,$userid,$username); //刷新首页 if($tempid==$public_r['indexpageid']) { NewsBq($classid,eaddslashes($add[temptext]),1,0); //删除动态模板缓存文件 DelOneTempTmpfile('indexpage'); } if($sql) { //操作日志 insert_dolog("tempid=$tempid&tempname=$add[tempname]"); printerror("EditIndexpageSuccess","ListIndexpage.php?gid=$gid".hReturnEcmsHashStrHref2(0)); } else { printerror("DbError","history.go(-1)"); } }
function EditJstemp($add, $userid, $username) { global $empire, $dbtbpre; $tempid = (int) $add['tempid']; if (!$tempid || !$add[tempname] || !$add[temptext]) { printerror("EmptyJstempname", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "template"); $add[tempname] = hRepPostStr($add[tempname], 1); $modid = (int) $add['modid']; $classid = (int) $add['classid']; $subnews = (int) $add['subnews']; $subtitle = (int) $add['subtitle']; $add[temptext] = str_replace("\r\n", "", $add[temptext]); $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewsjstemp", $gid) . " set tempname='{$add['tempname']}',temptext='" . eaddslashes2($add[temptext]) . "',classid={$classid},showdate='{$add['showdate']}',modid='{$modid}',subnews='{$subnews}',subtitle='{$subtitle}' where tempid={$tempid}"); //备份模板 AddEBakTemp('jstemp', $gid, $tempid, $add[tempname], $add[temptext], $subnews, 0, '', 0, $modid, $add[showdate], $subtitle, $classid, 0, $userid, $username); if ($sql) { //操作日志 insert_dolog("tempid={$tempid}&tempname={$add['tempname']}&gid={$gid}"); printerror("EditJstempSuccess", "ListJstemp.php?classid={$add['cid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditPrintTemp($add, $userid, $username) { global $empire, $dbtbpre, $public_r; $tempid = (int) $add[tempid]; if (!$tempid || !$add[tempname] || !$add[temptext]) { printerror("EmptyPrintTemp", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "template"); $add[tempname] = hRepPostStr($add[tempname], 1); $add[temptext] = RepPhpAspJspcode($add[temptext]); $add[modid] = (int) $add[modid]; $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewsprinttemp", $gid) . " set tempname='" . $add[tempname] . "',temptext='" . eaddslashes2($add[temptext]) . "',showdate='{$add['showdate']}',modid='{$add['modid']}' where tempid='{$tempid}'"); //备份模板 AddEBakTemp('printtemp', $gid, $tempid, $add[tempname], $add[temptext], 0, 0, '', 0, $add[modid], $add[showdate], 0, 0, 0, $userid, $username); //更新页面 if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) { GetPrintPage($tempid); } if ($sql) { //操作日志 insert_dolog("tempid={$tempid}&tempname={$add['tempname']}&gid={$gid}"); printerror("EditPrintTempSuccess", "ListPrinttemp.php?gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditMSearchtemp($add, $userid, $username) { global $empire, $dbtbpre; $add[tempid] = (int) $add[tempid]; if (!$add[tempname] || !$add[temptext] || !$add[listvar] || !$add[modid] || !$add[tempid]) { printerror("EmptySearchTempname", "history.go(-1)"); } //操作权限 CheckLevel($userid, $username, $classid, "template"); $classid = (int) $add['classid']; $add[tempname] = hRepPostStr($add[tempname], 1); $add[temptext] = RepPhpAspJspcode($add[temptext]); $add[listvar] = RepPhpAspJspcode($add[listvar]); if ($add['autorownum']) { $add[rownum] = substr_count($add[temptext], '<!--list.var'); } //变量处理 $add[subnews] = (int) $add[subnews]; $add[rownum] = (int) $add[rownum]; $add[modid] = (int) $add[modid]; $add[subtitle] = (int) $add[subtitle]; $docode = (int) $add[docode]; $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewssearchtemp", $gid) . " set subnews={$add['subnews']},tempname='{$add['tempname']}',temptext='" . eaddslashes2($add[temptext]) . "',listvar='" . eaddslashes2($add[listvar]) . "',rownum={$add['rownum']},modid={$add['modid']},showdate='{$add['showdate']}',subtitle={$add['subtitle']},classid={$classid},docode='{$docode}' where tempid='{$add['tempid']}'"); //备份模板 AddEBakTemp('searchtemp', $gid, $add[tempid], $add[tempname], $add[temptext], $add[subnews], 0, $add[listvar], $add[rownum], $add[modid], $add[showdate], $add[subtitle], $classid, $docode, $userid, $username); if ($sql) { //操作日志 insert_dolog("tempid=" . $add[tempid] . "<br>tempname=" . $add[tempname] . "&gid={$gid}"); printerror("EditMSearchTempSuccess", "ListSearchtemp.php?classid={$add['cid']}&modid={$add['mid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditBqtemp($tempid, $tempname, $modid, $subnews, $rownum, $showdate, $temptext, $listvar, $add, $userid, $username) { global $empire, $dbtbpre; $tempid = (int) $tempid; if (!$tempname || !$temptext || !$modid || !$listvar || !$tempid) { printerror("EmptyTempname", "history.go(-1)"); } //操作权限 CheckLevel($userid, $username, $classid, "template"); $classid = (int) $add['classid']; $tempname = hRepPostStr($tempname, 1); $temptext = RepPhpAspJspcode($temptext); $listvar = RepPhpAspJspcode($listvar); if ($add['autorownum']) { $rownum = substr_count($temptext, '<!--list.var'); } //变量处理 $modid = (int) $modid; $subnews = (int) $subnews; $rownum = (int) $rownum; $docode = (int) $add[docode]; $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewsbqtemp", $gid) . " set tempname='{$tempname}',temptext='" . eaddslashes2($temptext) . "',modid={$modid},showdate='{$showdate}',listvar='" . eaddslashes2($listvar) . "',subnews={$subnews},rownum={$rownum},classid={$classid},docode='{$docode}' where tempid='{$tempid}'"); //备份模板 AddEBakTemp('bqtemp', $gid, $tempid, $tempname, $temptext, $subnews, 0, $listvar, $rownum, $modid, $showdate, 0, $classid, $docode, $userid, $username); if ($sql) { //操作日志 insert_dolog("tempid=" . $tempid . "<br>tempname=" . $tempname . "&gid={$gid}"); printerror("EditBqtempSuccess", "ListBqtemp.php?classid={$add['cid']}&modid={$add['mid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditTempvar($add, $userid, $username) { global $empire, $dbtbpre; $add[varid] = (int) $add['varid']; if (!$add[varid] || !$add[myvar] || !$add[varvalue] || !$add[varname]) { printerror("EmptyTempvar", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "tempvar"); $add[myvar] = hRepPostStr($add[myvar], 1); $add[varname] = hRepPostStr($add[varname], 1); $add[varvalue] = RepPhpAspJspcode($add[varvalue]); $classid = (int) $add[classid]; $isclose = (int) $add[isclose]; $add[myorder] = (int) $add[myorder]; $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewstempvar", $gid) . " set myvar='{$add['myvar']}',varname='{$add['varname']}',varvalue='" . eaddslashes2($add[varvalue]) . "',classid={$classid},isclose={$isclose},myorder={$add['myorder']} where varid='{$add['varid']}'"); //备份模板 AddEBakTemp('tempvar', $gid, $add[varid], $add[myvar], $add[varvalue], $add[myorder], 0, $add[varname], 0, 0, '', 0, $classid, $isclose, $userid, $username); if ($sql) { //操作日志 insert_dolog("varid=" . $add[varid] . "<br>var=" . $add[myvar] . "&gid={$gid}"); printerror("EditTempvarSuccess", "ListTempvar.php?classid={$add['cid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditNewsTemplate($add, $userid, $username) { global $empire, $dbtbpre, $public_r; $add[tempid] = (int) $add[tempid]; if (!$add[tempid] || !$add[tempname] || !$add[temptext] || !$add[modid]) { printerror("EmptyTempname", "history.go(-1)"); } //操作权限 CheckLevel($userid, $username, $classid, "template"); $classid = (int) $add['classid']; $add[tempname] = hRepPostStr($add[tempname], 1); $add[temptext] = RepPhpAspJspcode($add[temptext]); $add[temptext] = RepTemplateJsUrl($add[temptext], 1, 0); //替换JS地址 $add[modid] = (int) $add[modid]; $gid = (int) $add['gid']; $sql = $empire->query("update " . GetDoTemptb("enewsnewstemp", $gid) . " set tempname='{$add['tempname']}',temptext='" . eaddslashes2($add[temptext]) . "',showdate='{$add['showdate']}',modid={$add['modid']},classid={$classid} where tempid='{$add['tempid']}'"); //将信息设为未生成 $mr = $empire->fetch1("select tbname from {$dbtbpre}enewsmod where mid='{$add['modid']}'"); //$usql=$empire->query("update {$dbtbpre}ecms_".$mr[tbname]." set havehtml=0 where newstempid='$add[tempid]'"); //备份模板 AddEBakTemp('newstemp', $gid, $add[tempid], $add[tempname], $add[temptext], 0, 0, '', 0, $add[modid], $add[showdate], 0, $classid, 0, $userid, $username); if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) { //删除动态模板缓存文件 DelOneTempTmpfile('text' . $add[tempid]); } if ($sql) { //操作日志 insert_dolog("tempid=" . $add[tempid] . "<br>tempname=" . $add[tempname] . "&gid={$gid}"); printerror("EditNewsTempSuccess", "ListNewstemp.php?classid={$add['cid']}&modid={$add['mid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function EditPagetemp($add,$userid,$username){ global $empire,$dbtbpre; $tempid=(int)$add['tempid']; if(!$tempid||!$add[tempname]||!$add[temptext]) { printerror("EmptyPagetempname","history.go(-1)"); } //验证权限 CheckLevel($userid,$username,$classid,"template"); $gid=(int)$add['gid']; $add[tempname]=hRepPostStr($add[tempname],1); $add[temptext]=RepPhpAspJspcode($add[temptext]); $sql=$empire->query("update ".GetDoTemptb("enewspagetemp",$gid)." set tempname='$add[tempname]',temptext='".eaddslashes2($add[temptext])."' where tempid='$tempid'"); //备份模板 AddEBakTemp('pagetemp',$gid,$tempid,$add[tempname],$add[temptext],0,0,'',0,0,'',0,0,0,$userid,$username); if($sql) { //操作日志 insert_dolog("tempid=$tempid&tempname=$add[tempname]&gid=$gid"); printerror("EditPagetempSuccess","ListPagetemp.php?gid=$gid".hReturnEcmsHashStrHref2(0)); } else { printerror("DbError","history.go(-1)"); } }
function EditCjNews($add, $newstext, $userid, $username) { global $empire, $class_r, $dbtbpre, $public_r; $add[classid] = (int) $add[classid]; $add[id] = (int) $add[id]; if (empty($add[classid]) || empty($add[id]) || empty($add[title])) { printerror("EmptyCjTitle", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "cj"); //取得采集字段 $record = "<!--record-->"; $field = "<!--field--->"; $cr = $empire->fetch1("select newsclassid,tbname from {$dbtbpre}enewsinfoclass where classid='{$add['classid']}'"); $r = $empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='" . $class_r[$cr[newsclassid]][modid] . "'"); $cjr = explode($record, $r[cj]); $count = count($cjr); $update = ""; for ($i = 0; $i < $count - 1; $i++) { $cjr1 = explode($field, $cjr[$i]); $dofield = $cjr1[1]; //图片集 if ($dofield == "morepic") { $add[$dofield] = ReturnMorepicpath($add['msmallpic'], $add['mbigpic'], $add['mpicname'], $add['mdelpicid'], $add['mpicid'], $add, $add['mpicurl_qz'], 1, 0, $public_r['filedeftb']); } //下载地址 if ($dofield == "downpath") { $add[$dofield] = ReturnDownpath($add['downname'], $add['downpath'], $add['delpathid'], $add['pathid'], $add['downuser'], $add['fen'], $add['thedownqz'], $add, $add['foruser'], $add['downurl'], 0); } //在线地址 if ($dofield == "onlinepath") { $add[$dofield] = ReturnDownpath($add['odownname'], $add['odownpath'], $add['odelpathid'], $add['opathid'], $add['odownuser'], $add['ofen'], $add['othedownqz'], $add, $add['oforuser'], $add['onlineurl_qz'], 1); } //发布时间 if ($dofield == "newstime") { continue; } $update .= "," . $dofield . "='" . eaddslashes2($add[$dofield]) . "'"; } $sql = $empire->query("update {$dbtbpre}ecms_infotmp_" . $cr[tbname] . " set keyboard='" . eaddslashes2($add[keyboard]) . "',newstime='{$add['newstime']}'" . $update . " where id='{$add['id']}'"); if ($sql) { //操作日志 insert_dolog("id=" . $add[id] . "<br>title=" . $add[title]); printerror("EditCjNewsSuccess", "CheckCj.php?classid={$add['classid']}&from=" . ehtmlspecialchars($_POST[from]) . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function SetPl($add, $userid, $username) { global $empire, $dbtbpre; //验证权限 CheckLevel($userid, $username, $classid, "public"); $add['pltime'] = (int) $add['pltime']; $add['plsize'] = (int) $add['plsize']; $add['plincludesize'] = (int) $add['plincludesize']; $add['plkey_ok'] = (int) $add['plkey_ok']; $add['plfacenum'] = (int) $add['plfacenum']; $add['plgroupid'] = (int) $add['plgroupid']; $add['pl_num'] = (int) $add['pl_num']; $add['plmaxfloor'] = (int) $add['plmaxfloor']; $sql = $empire->query("update {$dbtbpre}enewspl_set set pltime='{$add['pltime']}',plsize='{$add['plsize']}',plincludesize='{$add['plincludesize']}',plkey_ok='{$add['plkey_ok']}',plfacenum='{$add['plfacenum']}',plgroupid='{$add['plgroupid']}',plclosewords='" . eaddslashes($add[plclosewords]) . "',pl_num='{$add['pl_num']}',plurl='{$add['plurl']}',plmaxfloor='{$add['plmaxfloor']}',plquotetemp='" . eaddslashes2($add[plquotetemp]) . "' limit 1"); GetConfig(); //更新缓存 if ($sql) { insert_dolog(""); //操作日志 printerror('SetPlSuccess', 'pl/SetPl.php' . hReturnEcmsHashStrHref2(1)); } else { printerror('DbError', 'history.go(-1)'); } }
function AddEBakTemp($temptype, $gid, $tempid, $tempname, $temptext, $subnews, $isdefault, $listvar, $rownum, $modid, $showdate, $subtitle, $classid, $docode, $userid, $username) { global $empire, $dbtbpre; $tempid = (int) $tempid; $gid = (int) $gid; if (!$gid) { $gid = GetDoTempGid(); } if ($temptype == 'indexpage') { $gid = 1; } $pr = DelEBakTemp($temptype, $gid, $tempid); if (!$pr['baktempnum']) { return ''; } $subnews = (int) $subnews; $isdefault = (int) $isdefault; $rownum = (int) $rownum; $modid = (int) $modid; $subtitle = (int) $subtitle; $classid = (int) $classid; $docode = (int) $docode; $baktime = time(); $empire->query("insert into {$dbtbpre}enewstempbak(tempid,tempname,temptext,subnews,isdefault,listvar,rownum,modid,showdate,subtitle,classid,docode,baktime,temptype,gid,lastuser) values('{$tempid}','" . eaddslashes($tempname) . "','" . eaddslashes2($temptext) . "','{$subnews}','{$isdefault}','" . eaddslashes2($listvar) . "','{$rownum}','{$modid}','" . eaddslashes($showdate) . "','{$subtitle}','{$classid}','{$docode}','{$baktime}','{$temptype}','{$gid}','{$username}');"); }
function EditMemberForm($add, $userid, $username) { global $empire, $dbtbpre; $fid = (int) $add['fid']; if (empty($add[fname]) || !$fid) { printerror("EmptyMemberForm", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "memberf"); $enter = TogMemberqenter($add['cname'], $add['center']); //录入项 $viewenter = TogMemberqenter($add['cname'], $add['venter']); //显示项 $mustenter = TogMemberMustf($add['cname'], $add['menter']); //必填项 $canaddf = TogMemberMustf($add['cname'], $add['canadd']); //增加项 $caneditf = TogMemberMustf($add['cname'], $add['canedit']); //修改项 $searchvar = TogMemberMustf($add['cname'], $add['schange']); //搜索项 $filef = ReturnMFileF($enter, $dbtbpre . "enewsmemberf", 0, "file"); $imgf = ReturnMFileF($enter, $dbtbpre . "enewsmemberf", 0, "img"); $tobrf = ReturnMFileF($enter, $dbtbpre . "enewsmemberf", 0, "textarea"); $checkboxf = ReturnMFileF($enter, $dbtbpre . "enewsmemberf", 0, "checkbox"); //自动生成表单 if ($add[ftype]) { $add[ftemp] = ReturnMemberFtemp($add['cname'], $add['center']); } $sql = $empire->query("update {$dbtbpre}enewsmemberform set fname='{$add['fname']}',ftemp='" . eaddslashes2($add[ftemp]) . "',fzs='" . addslashes($add[fzs]) . "',enter='{$enter}',mustenter='{$mustenter}',filef='{$filef}',imgf='{$imgf}',tobrf='{$tobrf}',viewenter='{$viewenter}',searchvar='{$searchvar}',canaddf='{$canaddf}',caneditf='{$caneditf}',checkboxf='{$checkboxf}' where fid={$fid}"); //生成表单页面 ChangeMemberForm($fid, $add[ftemp]); if ($sql) { insert_dolog("fid=" . $fid . "<br>fname=" . $add[fname]); //操作日志 printerror("EditMemberFormSuccess", "member/ListMemberForm.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function DoRepNewstext($start,$oldword,$newword,$field,$classid,$tid,$tbname,$over,$dozz,$dotxt,$userid,$username){ global $empire,$public_r,$class_r,$fun_r,$dbtbpre,$emod_r; $tbname=RepPostVar($tbname); $field=RepPostVar($field); $tid=(int)$tid; $dotype=(int)$_POST['dotype']; $classid=(int)$classid; if(!$field||empty($tbname)||!$tid) { printerror("FailCX","history.go(-1)"); } if($dotype==0&&strlen($oldword)==0) { printerror("FailCX","history.go(-1)"); } CheckLevel($userid,$username,$classid,"repnewstext");//验证权限 //变量替换 $postoldword=ClearAddsData($oldword); $postnewword=ClearAddsData($newword); //替换条件 if($classid)//按栏目替换 { if(empty($class_r[$classid][islast]))//中级栏目 { $where=ReturnClass($class_r[$classid][sonclass]); } else//终极栏目 { $where="classid='$classid'"; } $add1=" and (".$where.")"; $add2=" where (".$where.")"; } $fr=$empire->fetch1("select tid,savetxt,tbdataf from {$dbtbpre}enewsf where tbname='$tbname' and f='$field' limit 1"); //系统字段 $specialdatafield=',keyid,dokey,newstempid,closepl,haveaddfen,infotags,'; if(!$fr['tid']&&stristr($specialdatafield,','.$field.',')) { $fr['tbdataf']=1; } //覆盖方式 if($dotype==1) { $repoldword=addslashes($oldword); $repnewword=addslashes($newword); if($over==1)//完全替换 { if(empty($add2)) { $and=" where "; } else { $and=" and "; } $add2.=$and.$field."='".$repoldword."'"; } if($fr['tbdataf'])//副表 { //已审核 $tbr=$empire->fetch1("select datatbs from {$dbtbpre}enewstable where tbname='$tbname' limit 1"); if($tbr['datatbs']) { $dtbr=explode(',',$tbr['datatbs']); $count=count($dtbr); for($i=1;$i<$count-1;$i++) { $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$dtbr[$i]." set ".$field."='$repnewword'".$add2); } } //未审核 $empire->query("update {$dbtbpre}ecms_".$tbname."_check_data set ".$field."='$repnewword'".$add2); } else//主表 { $empire->query("update {$dbtbpre}ecms_".$tbname." set ".$field."='$repnewword'".$add2); //未审核 $empire->query("update {$dbtbpre}ecms_".$tbname."_check set ".$field."='$repnewword'".$add2); } //替换完毕 insert_dolog("tbname=".$tbname."&field=".$field."&dotype=1<br>oldword=".$oldword."<br>newword=".$newword);//操作日志 printerror("DoRepNewstextSuccess","db/RepNewstext.php?tid=$tid".hReturnEcmsHashStrHref2(0)); } //存文本替换 elseif($fr['savetxt']) { $repoldword=addslashes($postoldword); $repnewword=addslashes($postnewword); //字段 $selectf=$fr['tbdataf']?',stb':','.$field; $fieldform="<input type='hidden' name='field' value='".$field."'>"; if(empty($public_r[dorepnum])) { $public_r[dorepnum]=600; } $start=(int)$start; $b=0; $sql=$empire->query("select id,checked from {$dbtbpre}ecms_".$tbname."_index where id>$start".$add1." order by id limit ".$public_r[dorepnum]); while($r=$empire->fetch($sql)) { $b=1; $newstart=$r[id]; //返回表 $infotb=ReturnInfoMainTbname($tbname,$r['checked']); //主表 $infor=$empire->fetch1("select isurl".$selectf." from ".$infotb." where id='$r[id]' limit 1"); if($infor['isurl']) { continue; } //副表 if($fr['tbdataf']) { //返回表信息 $infodatatb=ReturnInfoDataTbname($tbname,$r['checked'],$infor['stb']); $finfor=$empire->fetch1("select ".$field." from ".$infodatatb." where id='$r[id]' limit 1"); $infor[$field]=$finfor[$field]; } $value=GetTxtFieldText($infor[$field]); if(empty($value)) { continue; } if($dozz==1)//正则 { $newvalue=DoRepNewstextZz($repoldword,$repnewword,$value);//正则替换 } else//普通 { if(!stristr($value,$repoldword)) { continue; } $newvalue=str_replace($repoldword,$repnewword,$value); } EditTxtFieldText($infor[$field],$newvalue); } //替换完毕 if(empty($b)) { insert_dolog("tbname=".$tbname."&field=".$field."<br>oldword=".$oldword."<br>newword=".$newword);//操作日志 printerror("DoRepNewstextSuccess","db/RepNewstext.php?tid=$tid".hReturnEcmsHashStrHref2(0)); } EchoRepFieldForm($tid,$tbname,$over,$dozz,$dotxt,$newstart,$fieldform,$classid,$postoldword,$postnewword); } //正则替换 elseif($dozz==1) { //字段 $selectf=$fr['tbdataf']?',stb':','.$field; $fieldform="<input type='hidden' name='field' value='".$field."'>"; if(empty($public_r[dorepnum])) { $public_r[dorepnum]=600; } $start=(int)$start; $b=0; $sql=$empire->query("select id,checked from {$dbtbpre}ecms_".$tbname."_index where id>$start".$add1." order by id limit ".$public_r[dorepnum]); while($r=$empire->fetch($sql)) { $b=1; $newstart=$r[id]; //返回表 $infotb=ReturnInfoMainTbname($tbname,$r['checked']); //主表 $infor=$empire->fetch1("select isurl".$selectf." from ".$infotb." where id='$r[id]' limit 1"); if($infor['isurl']) { continue; } if($fr['tbdataf'])//副表 { //返回表信息 $infodatatb=ReturnInfoDataTbname($tbname,$r['checked'],$infor['stb']); $finfor=$empire->fetch1("select ".$field." from ".$infodatatb." where id='$r[id]' limit 1"); $newvalue=DoRepNewstextZz($oldword,$newword,stripSlashes($finfor[$field]));//正则替换 $empire->query("update ".$infodatatb." set ".$field."='".addslashes($newvalue)."' where id='$r[id]'"); } else//主表 { $newvalue=DoRepNewstextZz($oldword,$newword,stripSlashes($infor[$field]));//正则替换 $empire->query("update ".$infotb." set ".$field."='".addslashes($newvalue)."' where id='$r[id]'"); } } //替换完毕 if(empty($b)) { insert_dolog("tbname=".$tbname."&field=".$field."<br>oldword=".$oldword."<br>newword=".$newword);//操作日志 printerror("DoRepNewstextSuccess","db/RepNewstext.php?tid=$tid".hReturnEcmsHashStrHref2(0)); } EchoRepFieldForm($tid,$tbname,$over,$dozz,$dotxt,$newstart,$fieldform,$classid,$postoldword,$postnewword); } //普通替换 else { $repoldword=eaddslashes2($oldword); $repnewword=eaddslashes2($newword); if($over==1)//完全替换 { if(empty($add2)) { $and=" where "; } else { $and=" and "; } $add2.=$and.$field."='".$repoldword."'"; } if($fr['tbdataf'])//副表 { //已审核 $tbr=$empire->fetch1("select datatbs from {$dbtbpre}enewstable where tbname='$tbname' limit 1"); if($tbr['datatbs']) { $dtbr=explode(',',$tbr['datatbs']); $count=count($dtbr); for($i=1;$i<$count-1;$i++) { $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$dtbr[$i]." set ".$field."=REPLACE(".$field.",'$repoldword','$repnewword')".$add2); } } //未审核 $empire->query("update {$dbtbpre}ecms_".$tbname."_check_data set ".$field."=REPLACE(".$field.",'$repoldword','$repnewword')".$add2); } else//主表 { $empire->query("update {$dbtbpre}ecms_".$tbname." set ".$field."=REPLACE(".$field.",'$repoldword','$repnewword')".$add2); //未审核 $empire->query("update {$dbtbpre}ecms_".$tbname."_check set ".$field."=REPLACE(".$field.",'$repoldword','$repnewword')".$add2); } //替换完毕 insert_dolog("tbname=".$tbname."&field=".$field."<br>oldword=".$oldword."<br>newword=".$newword);//操作日志 printerror("DoRepNewstextSuccess","db/RepNewstext.php?tid=$tid".hReturnEcmsHashStrHref2(0)); } }
function EditSpInfo3_bak($spid, $sid, $sptext) { global $empire, $dbtbpre, $lur; $baknum = 10; //备份最大数量 $username = $lur[username]; $time = time(); $empire->query("insert into {$dbtbpre}enewssp_3_bak(sid,spid,sptext,lastuser,lasttime) values('{$sid}','{$spid}','" . eaddslashes2($sptext) . "','{$username}','{$time}');"); //删除多余备份 $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssp_3_bak where sid='{$sid}'"); if ($num > $baknum) { $limitnum = $num - $baknum; $ids = ''; $dh = ''; $sql = $empire->query("select bid from {$dbtbpre}enewssp_3_bak where sid='{$sid}' order by bid limit " . $limitnum); while ($r = $empire->fetch($sql)) { $ids .= $dh . $r[bid]; $dh = ','; } $empire->query("delete from {$dbtbpre}enewssp_3_bak where bid in ({$ids})"); } }
function ReturnAddCj($add, $cj, $do = 0) { global $empire; $record = "<!--record-->"; $field = "<!--field--->"; $record_r = explode($record, $cj); for ($i = 0; $i < count($record_r) - 1; $i++) { $field_r = explode($field, $record_r[$i]); //增加 if (empty($do)) { $f1 = "zz_" . $field_r[1]; $f2 = "z_" . $field_r[1]; $f3 = "qz_" . $field_r[1]; $f4 = "save_" . $field_r[1]; $ret_r[0] .= "," . $f1 . "," . $f2 . "," . $f3 . "," . $f4; $ret_r[1] .= ",'" . eaddslashes2($add[$f1]) . "','" . eaddslashes2($add[$f2]) . "','" . eaddslashes2($add[$f3]) . "','" . $add[$f4] . "'"; } else { $f1 = "zz_" . $field_r[1]; $f2 = "z_" . $field_r[1]; $f3 = "qz_" . $field_r[1]; $f4 = "save_" . $field_r[1]; $ret_r[0] .= "," . $f1 . "='" . eaddslashes2($add[$f1]) . "'," . $f2 . "='" . eaddslashes2($add[$f2]) . "'," . $f3 . "='" . eaddslashes2($add[$f3]) . "'," . $f4 . "='" . $add[$f4] . "'"; } } return $ret_r; }
function EditInfoClass($bclassid, $newsclassid, $add, $ztid, $userid, $username) { global $empire, $class_r, $dbtbpre; if (!$add[classid] || !$add[classname]) { printerror("EmptyInfoTitleSuccess", "history.go(-1)"); } //操作权限 CheckLevel($userid, $username, $classid, "cj"); //父节点与原节点一样 if ($add[classid] == $bclassid) { printerror("OldInfoidNotSingle", "history.go(-1)"); } //选择栏目 if ($newsclassid) { if (!$class_r[$newsclassid][islast]) { printerror("CjClassidMustLast", "history.go(-1)"); } //返回采集页面地址 $add[infourl] = ReturnInfoUrl($add); //取得采集字段 $mr = $empire->fetch1("select cj,tid,tbname from {$dbtbpre}enewsmod where mid='" . $class_r[$newsclassid][modid] . "'"); } if (empty($add[startday])) { $add[startday] = date("Y-m-d"); } if (empty($add[endday])) { $add[endday] = "2099-12-31"; } if (empty($add[relistnum])) { $add[relistnum] = 1; } if (empty($add[renum])) { $add[renum] = 2; } if (empty($add[insertnum])) { $add[insertnum] = 10; } //处理变量 $add[classid] = (int) $add[classid]; $bclassid = (int) $bclassid; $newsclassid = (int) $newsclassid; $add[num] = (int) $add[num]; $add[copyimg] = (int) $add[copyimg]; $add[renum] = (int) $add[renum]; $add[titlelen] = (int) $add[titlelen]; $add[retitlewriter] = (int) $add[retitlewriter]; $add[smalltextlen] = (int) $add[smalltextlen]; $add[relistnum] = (int) $add[relistnum]; $add[keynum] = (int) $add[keynum]; $add[insertnum] = (int) $add[insertnum]; $add[copyflash] = (int) $add[copyflash]; $mr[tid] = (int) $mr[tid]; $add[pagetype] = (int) $add[pagetype]; $add[mark] = (int) $add[mark]; $add[enpagecode] = (int) $add[enpagecode]; $add[recjtheurl] = (int) $add[recjtheurl]; $add[hiddenload] = (int) $add[hiddenload]; $add[justloadin] = (int) $add[justloadin]; $add[justloadcheck] = (int) $add[justloadcheck]; $add[delloadinfo] = (int) $add[delloadinfo]; $add[getfirstpic] = (int) $add[getfirstpic]; $add[getfirstspic] = (int) $add[getfirstspic]; $add[getfirstspicw] = (int) $add[getfirstspicw]; $add[getfirstspich] = (int) $add[getfirstspich]; $add[doaddtextpage] = (int) $add[doaddtextpage]; $add[infourlispage] = (int) $add[infourlispage]; $keeptime = (int) $add['keeptime']; $newstextisnull = (int) $add['newstextisnull']; //主表 $sql = $empire->query("update {$dbtbpre}enewsinfoclass set bclassid={$bclassid},classname='" . eaddslashes($add[classname]) . "',infourl='" . eaddslashes2($add[infourl]) . "',newsclassid={$newsclassid},startday='{$add['startday']}',endday='{$add['endday']}',bz='" . eaddslashes2($add[bz]) . "',num={$add['num']},copyimg={$add['copyimg']},renum={$add['renum']},keyboard='" . eaddslashes2($add[keyboard]) . "',oldword='" . eaddslashes2($add[oldword]) . "',newword='" . eaddslashes2($add[newword]) . "',titlelen={$add['titlelen']},retitlewriter={$add['retitlewriter']},smalltextlen={$add['smalltextlen']},zz_smallurl='" . eaddslashes2($add[zz_smallurl]) . "',zz_newsurl='" . eaddslashes2($add[zz_newsurl]) . "',httpurl='" . eaddslashes2($add[httpurl]) . "',repad='" . eaddslashes2($add[repad]) . "',imgurl='" . eaddslashes2($add[imgurl]) . "',relistnum={$add['relistnum']},zz_titlepicl='" . eaddslashes2($add[zz_titlepicl]) . "',z_titlepicl='" . eaddslashes2($add[z_titlepicl]) . "',qz_titlepicl='" . eaddslashes2($add[qz_titlepicl]) . "',save_titlepicl='{$add['save_titlepicl']}',keynum={$add['keynum']},insertnum={$add['insertnum']},copyflash={$add['copyflash']},tid={$mr['tid']},tbname='{$mr['tbname']}',pagetype={$add['pagetype']},smallpagezz='" . eaddslashes2($add[smallpagezz]) . "',pagezz='" . eaddslashes2($add[pagezz]) . "',smallpageallzz='" . eaddslashes2($add[smallpageallzz]) . "',pageallzz='" . eaddslashes2($add[pageallzz]) . "',mark={$add['mark']},enpagecode={$add['enpagecode']},recjtheurl={$add['recjtheurl']},hiddenload={$add['hiddenload']},justloadin={$add['justloadin']},justloadcheck={$add['justloadcheck']},delloadinfo={$add['delloadinfo']},pagerepad='" . eaddslashes2($add[pagerepad]) . "',getfirstpic={$add['getfirstpic']},oldpagerep='" . eaddslashes2($add[oldpagerep]) . "',newpagerep='" . eaddslashes2($add[newpagerep]) . "',keeptime='{$keeptime}',newstextisnull={$newstextisnull},getfirstspic={$add['getfirstspic']},getfirstspicw={$add['getfirstspicw']},getfirstspich={$add['getfirstspich']},doaddtextpage={$add['doaddtextpage']},infourlispage={$add['infourlispage']} where classid='{$add['classid']}'"); if ($newsclassid) { //是否已有记录 $havenum = $empire->num("select count(*) as total from {$dbtbpre}ecms_infoclass_" . $mr[tbname] . " where classid='{$add['classid']}' limit 1"); //原本是父栏目 if (empty($add[oldnewsclassid]) && !$havenum) { $ret_r = ReturnAddCj($add, $mr[cj], 0); //写入副表 $usql = $empire->query("insert into {$dbtbpre}ecms_infoclass_" . $mr[tbname] . "(classid" . $ret_r[0] . ") values({$add['classid']}" . $ret_r[1] . ");"); } else { $ret_r = ReturnAddCj($add, $mr[cj], 1); //副表 $usql = $empire->query("update {$dbtbpre}ecms_infoclass_" . $mr[tbname] . " set classid='{$add['classid']}'" . $ret_r[0] . " where classid='{$add['classid']}'"); } } //来源 if ($_POST['from']) { $returnurl = "ListPageInfoClass.php"; } else { $returnurl = "ListInfoClass.php"; } if ($sql) { //操作日志 insert_dolog("classid=" . $add[classid] . "<br>classname=" . $add[classname]); printerror("EditInfoClassSuccess", $returnurl . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function EditClass($add, $userid, $username) { global $empire, $class_r, $dbtbpre; //修改外部栏目 if ($add[ecmsclasstype]) { EditWbClass($add, $userid, $username); } $add[classid] = (int) $add[classid]; $add[classpath] = trim($add[classpath]); $checkclasspath = $add['classpath']; if ($add['oldclasspath'] != $add['pripath'] . $add['oldcpath']) { $add[classpath] = $add['oldcpath']; } if (!$add[classname] || !$add[classpath] || !$add[modid] || !$add[classid]) { printerror("EmptyClass", ""); } if ($add[islast] && (!$add[newstempid] || !$add[listtempid])) { printerror("LastMustChange", ""); } //操作权限 CheckLevel($userid, $username, $classid, "class"); $add = DoPostClassVar($add); $add[oldmodid] = (int) $add[oldmodid]; //改变目录 $classpath = $add[pripath] . $add[classpath]; if ($add[oldclasspath] != $classpath && $checkclasspath == $add['oldcpath']) { if (file_exists("../../" . $classpath)) { //检测目录是否存在 printerror("ReClasspath", ""); } } //取得表名 $tabler = GetModTable($add[modid]); $tabler[tid] = (int) $tabler[tid]; //修改大栏目 if (!$add[islast]) { //改变大栏目 if ($add[bclassid] != $add[oldbclassid]) { //转到主栏目 if (empty($add[bclassid])) { $sonclass = ""; $featherclass = ""; //取得本栏目的子栏目 $r = $empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //改变父栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($o = $empire->fetch($osql)) { $newsonclass = str_replace($r[sonclass], "|", $o[sonclass]); $uosql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$o['classid']}'"); } //修改子栏目的父栏目 $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "%|'"); while ($o = $empire->fetch($osql)) { $newclasspath = str_replace($r[classpath] . "/", $classpath . "/", $o[classpath]); $newfeatherclass = str_replace($r[featherclass], "|", $o[featherclass]); $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$o['classid']}'"); } } else { //大栏目跟原栏目相同 if ($add[classid] == $add[bclassid]) { printerror("BclassIsself", ""); } //取得现在大栏目的值 $b = $empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'"); //检测大栏目是否为终级栏目 if ($b[islast]) { printerror("BclassNotLast", ""); } if ($b[wburl]) { printerror("BclassNotWb", ""); } //是否非法父栏目 if ($b[featherclass]) { $c_nb_r = explode("|" . $add[classid] . "|", $b[featherclass]); if (count($c_nb_r) != 1) { printerror("BclassIssmall", ""); } } if (empty($b[featherclass])) { $b[featherclass] = "|"; } $featherclass = $b[featherclass] . $add[bclassid] . "|"; //取得现在栏目本身的值 $o = $empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //修改子栏目的父栏目 $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "|%'"); while ($or = $empire->fetch($osql)) { $newclasspath = str_replace($o[classpath] . "/", $classpath . "/", $or[classpath]); if (empty($o[featherclass])) { $newfeatherclass = $b[featherclass] . $add[bclassid] . $or[featherclass]; } else { $newfeatherclass = str_replace($o[featherclass], $featherclass, $or[featherclass]); } $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$or['classid']}'"); } //改变旧大栏目的所有子栏目 $owhere = ReturnClass($o[featherclass]); if (empty($owhere)) { $owhere = "classid=0"; } $oosql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $owhere); while ($oo = $empire->fetch($oosql)) { $newsonclass = str_replace($o[sonclass], "|", $oo[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$oo['classid']}'"); } //改变新大栏目的子栏目 $where = ReturnClass($featherclass); if (empty($where)) { $where = "classid=0"; } $nbsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($nb = $empire->fetch($nbsql)) { if (empty($nb[sonclass])) { $nb[sonclass] = "|"; } $newsonclass = $nb[sonclass] . substr($o[sonclass], 1); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'"); } } $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'"; } //绑定域名应用于子栏目 if ($add['UrlToSmall']) { UpdateSmallClassDomain($add['classid'], $add['classurl'], $classpath); } //wap模板应用于子栏目 if ($add['wapstylesclass']) { $empire->query("update {$dbtbpre}enewsclass set wapstyleid='{$add['wapstyleid']}' where featherclass like '%|" . $add[classid] . "|%'"); } //修改数据库资料 $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',islist={$add['islist']},listtempid={$add['listtempid']},lencord={$add['lencord']},searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},openadd={$add['openadd']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}',repagenum='{$add['repagenum']}',keycid='{$add['keycid']}'" . $change . " where classid='{$add['classid']}'"); //副表 $ret_cr = ReturnClassAddF($add, 1); $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . eaddslashes2($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'"); //更新附件 UpdateTheFileEditOther(1, $add['classid'], 'other'); GetClass(); //生成栏目文件 if ($add[islist] == 0 || $add[islist] == 2) { $classtemp = $add[islist] == 2 ? GetClassText($add[classid]) : GetClassTemp($add['classtempid']); NewsBq($add[classid], $classtemp, 0, 1); } elseif ($add[islist] == 3) { ReClassBdInfo($add[classid]); } if ($add[islist] == 2) { //删除动态模板缓存文件 DelOneTempTmpfile('classpage' . $add[classid]); } } else { if ($add[modid] != $add[oldmodid]) { $chmtbr = GetModTable($add[oldmodid]); if ($chmtbr[tid] != $tabler[tid] && $chmtbr[tbname]) { $chmchecknum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $chmtbr[tbname] . "_index where classid='{$add['classid']}'"); if ($chmchecknum) { printerror("ClassChangeModHaveInfo", "history.go(-1)"); } } } //改变大栏目 if ($add[bclassid] != $add[oldbclassid]) { //转到主栏目 if (empty($add[bclassid])) { $sonclass = ""; $featherclass = ""; //取得栏目原本的大栏目 $r = $empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); //改变原本大栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($bsql)) { $newsonclass = str_replace("|" . $add[classid] . "|", "|", $br[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'"); } } else { //取得现在大栏目的值 $b = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'"); //检测大栏目是否为终级栏目 if ($b[islast]) { printerror("BclassNotLast", ""); } if ($b[wburl]) { printerror("BclassNotWb", ""); } if (empty($b[featherclass])) { $b[featherclass] = "|"; } $featherclass = $b[featherclass] . $add[bclassid] . "|"; //改变新大栏目的子栏目 $where = ReturnClass($featherclass); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($nb = $empire->fetch($bsql)) { if (empty($nb[sonclass])) { $nb[sonclass] = "|"; } $newsonclass = $nb[sonclass] . $add[classid] . "|"; $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'"); } //改变旧大栏目的子栏目 $o = $empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['classid']}'"); $where = ReturnClass($o[featherclass]); if (empty($where)) { $where = "classid=0"; } $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($ob = $empire->fetch($osql)) { $newsonclass = str_replace("|" . $add[classid] . "|", "|", $ob[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$ob['classid']}'"); } } $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'"; } //应用于已生成的信息 if ($add['tobetempinfo']) { UpdateAllDataTbField($tabler['tbname'], "newstempid='{$add['newstempid']}'", " where classid='{$add['classid']}'", 1); } //文件前缀 $add[filename_qz] = RepFilenameQz($add[filename_qz]); $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',link_num={$add['link_num']},lencord={$add['lencord']},newstempid={$add['newstempid']},listtempid={$add['listtempid']},newspath='{$add['newspath']}',filename={$add['filename']},filetype='{$add['filetype']}',openpl={$add['openpl']},openadd={$add['openadd']},newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},addinfofen={$add['addinfofen']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},checkqadd={$add['checkqadd']},qaddlist={$add['qaddlist']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['smallbdinfoid']}',repagenum='{$add['repagenum']}',keycid='{$add['keycid']}'" . $change . " where classid='{$add['classid']}'"); //副表 $ret_cr = ReturnClassAddF($add, 1); $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . eaddslashes2($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'"); //更新附件 UpdateTheFileEditOther(1, $add['classid'], 'other'); GetClass(); } //移动目录 if ($add[bclassid] != $add[oldbclassid] || $add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath']) { $opath = "../../" . $add[oldclasspath]; $newpath = "../../" . $classpath; MovePath($opath, $newpath); $opath = "../../data/" . $add[oldclasspath]; $npath = "../../data/" . $classpath; CopyPath($opath, $npath); } else { if ($add['oldcpath'] != $add['classpath']) { AlterClassPath($add['classid'], $add['islast'], $add['oldclasspath'], $classpath); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'"); GetClass(); } } //删除缓存文件 $cache_mid = 0; $cache_oldmid = 0; if ($add[oldclassname] != $add[classname] || $add[bclassid] != $add[oldbclassid]) { DelListEnews(); //GetSearch($add[modid]); DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='{$add['modid']}')"); $cache_mid = $add[modid]; } else { if ($add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath'] || $add[listdt] != $add[oldlistdt]) { DelListEnews(); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews'"); } if ($add[openadd] != $add[oldopenadd] || $add[modid] != $add[oldmodid]) { //GetSearch($add[modid]); DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='{$add['modid']}'"); $cache_mid = $add[modid]; if ($add[modid] != $add[oldmodid]) { //GetSearch($add[oldmodid]); DelFiletext("../data/js/js/addinfo" . $add[oldmodid] . ".js"); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='modclass' and modid='{$add['oldmodid']}'"); $cache_oldmid = $add[oldmodid]; } } } //修改栏目扩展名 if ($add[oldclasstype] != $add[classtype]) { $todaytime = date("Y-m-d H:i:s"); if ($add[islast]) { $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where classid='{$add['classid']}'"; $lencord = $add[oldlencord]; $num = $empire->gettotal($query); } else { $lencord = $add[oldlencord]; if ($add[oldislist] == 1) { $where = ReturnClass($class_r[$add[classid]][sonclass]); $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where (" . $where . ")"; $num = $empire->gettotal($query); } else { $num = 1; } } RenameListfile($add[classid], $lencord, $num, $add[oldclasstype], $add[classtype], $classpath); } //来源 if ($add['from']) { $returnurl = "ListPageClass.php"; } else { $returnurl = "ListClass.php"; } TogNotReClass(1); if ($sql) { insert_dolog("classid=" . $add[classid] . "<br>classname=" . $add[classname]); //操作日志 $cache_enews = 'doclass,doinfo,douserinfo,domod,dostemp'; $cache_ecmstourl = urlencode($returnurl . hReturnEcmsHashStrHref2(1)); $cache_mess = 'EditClassSuccess'; $cache_url = "CreateCache.php?enews={$cache_enews}&mid={$cache_mid}&oldmid={$cache_oldmid}&ecmstourl={$cache_ecmstourl}&mess={$cache_mess}" . hReturnEcmsHashStrHref2(0); //printerror("EditClassSuccess",$returnurl); echo '<meta http-equiv="refresh" content="0;url=' . $cache_url . '">'; db_close(); $empire = null; exit; } else { printerror("DbError", "history.go(-1)"); } }
function EditM($add, $cname, $cchange, $schange, $center, $cqenter, $menter, $listand, $ltempf, $ptempf, $canadd, $canedit, $listorder, $userid, $username) { global $empire, $dbtbpre; $tid = (int) $add['tid']; $tbname = RepPostVar($add['tbname']); $add[mid] = (int) $add[mid]; if (empty($add[mname]) || empty($add[mid]) || !$tid || !$tbname) { printerror("EmptyM", "history.go(-1)"); } $listfile = eReturnCPath(str_replace('.', '', $add[listfile]), ''); //验证权限 CheckLevel($userid, $username, $classid, "m"); //组合采集项 $cj = TogMCj($cname, $cchange); //组合搜索项 $searchvar = TogMSearch($cname, $schange); //组合必填项 $mustqenterf = TogMustf($cname, $menter); //组合结合项 $listandf = TogMustf($cname, $listand); //组合排序项 $orderf = TogMustf($cname, $listorder); //组合投稿项 $qenter = TogMqenter($cname, $cqenter); //组合可增加项 $canaddf = TogMustf($cname, $canadd); //组合可修改项 $caneditf = TogMustf($cname, $canedit); //组合录入项 $er = TogMEnter($cname, $center, $ltempf, $ptempf, $tid); $enter = $er[0]; //录入项 $listtempvar = $er[1]; //列表模板项 $tempvar = $er[2]; //内容模板项 //自动生成表单 if ($add[mtype]) { $add[mtemp] = ReturnMtemp($cname, $center); } if ($add[qmtype]) { $add[qmtemp] = ReturnQmtemp($cname, $cqenter); } $setandf = (int) $add['setandf']; $add[definfovoteid] = (int) $add[definfovoteid]; $showmod = (int) $add['showmod']; $usemod = (int) $add['usemod']; $myorder = (int) $add['myorder']; $add[printtempid] = (int) $add[printtempid]; $sql = $empire->query("update {$dbtbpre}enewsmod set mname='{$add['mname']}',mtemp='" . eaddslashes2($add[mtemp]) . "',mzs='{$add['mzs']}',cj='{$cj}',enter='{$enter}',tempvar='{$tempvar}',searchvar='{$searchvar}',qenter='{$qenter}',mustqenterf='{$mustqenterf}',qmtemp='" . eaddslashes2($add[qmtemp]) . "',listandf='" . addslashes($listandf) . "',setandf={$setandf},listtempvar='{$listtempvar}',qmname='{$add['qmname']}',canaddf='{$canaddf}',caneditf='{$caneditf}',definfovoteid={$add['definfovoteid']},showmod='{$showmod}',usemod='{$usemod}',myorder='{$myorder}',orderf='{$orderf}',listfile='{$listfile}',printtempid='{$add['printtempid']}' where mid='{$add['mid']}'"); //更新表单 ChangeMForm($add[mid], $tid, $add[mtemp]); ChangeQmForm($add[mid], $tid, $add[qmtemp]); //采集文件 ChangeMCj($add[mid], $tid, $cj); GetConfig(1); //更新缓存 if ($sql) { //操作日志 insert_dolog("mid=" . $add[mid] . "<br>m=" . $add[mname]); printerror("EditMSuccess", "db/ListM.php?tid={$tid}&tbname={$tbname}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }