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 LoadInTGNewstemp($gid, $en, $record, $field, $text) { global $empire, $dbtbpre; if (empty($text)) { return ""; } $text = RepTemplateJsUrl($text, 1, 0); //替换JS地址 $tb = $dbtbpre . "enewsnewstemp" . $en; $rr = explode($record, $text); $count = count($rr); for ($i = 0; $i < $count - 1; $i++) { $r = explode($field, $rr[$i]); $sql = $empire->query("insert into " . $tb . "(tempid,tempname,isdefault,temptext,showdate,modid,classid) values('{$r['0']}','" . addslashes($r[1]) . "','{$r['2']}','" . addslashes(addslashes($r[3])) . "','" . addslashes($r[4]) . "','{$r['5']}','{$r['6']}');"); } }