Пример #1
0
function EditNews($add, $userid, $username)
{
    global $empire, $class_r, $class_zr, $bclassid, $public_r, $dbtbpre, $emod_r;
    $add[classid] = (int) $add[classid];
    $userid = (int) $userid;
    $add[id] = (int) $add[id];
    if (!$add[id] || !$add[title] || !$add[classid] || !$add[filename]) {
        printerror("EmptyTitle", "history.go(-1)");
    }
    $doselfinfo = CheckLevel($userid, $username, $add[classid], "news");
    //操作权限
    if (!$doselfinfo['doeditinfo']) {
        printerror("NotEditInfoLevel", "history.go(-1)");
    }
    $ccr = $empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='{$add['classid']}' and islast=1 limit 1");
    if (!$ccr['classid'] || $ccr['wburl']) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    //索引表
    $index_checkr = $empire->fetch1("select id,classid,checked from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . "_index where id='{$add['id']}' limit 1");
    if (!$index_checkr['id'] || $index_checkr['classid'] != $add['classid']) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    //主表
    $infotb = ReturnInfoMainTbname($class_r[$add[classid]][tbname], $index_checkr['checked']);
    $checkr = $empire->fetch1("select id,classid,userid,username,ismember,stb,newspath,filename,isqf,fstb,isgood,firsttitle,istop from " . $infotb . " where id='{$add['id']}' limit 1");
    if ($doselfinfo['doselfinfo'] && ($checkr['userid'] != $userid || $checkr['ismember'])) {
        printerror("NotDoSelfinfo", "history.go(-1)");
    }
    //已审核信息不可修改
    if ($doselfinfo['docheckedit'] && $index_checkr['checked']) {
        printerror("NotEditCheckInfoLevel", "history.go(-1)");
    }
    //审核权限
    if (!$doselfinfo['docheckinfo']) {
        $add['checked'] = $index_checkr['checked'];
    }
    //必须审核
    if ($doselfinfo['domustcheck'] && !$index_checkr['checked']) {
        $add['checked'] = 0;
    }
    //推荐权限
    if (!$doselfinfo['dogoodinfo']) {
        $add['isgood'] = $checkr['isgood'];
        $add['firsttitle'] = $checkr['firsttitle'];
        $add['istop'] = $checkr['istop'];
    }
    if ($ccr['sametitle']) {
        if (ReturnCheckRetitle($add)) {
            printerror("ReInfoTitle", "history.go(-1)");
        }
    }
    //公共表
    $pubid = ReturnInfoPubid($add['classid'], $add['id']);
    $pubcheckr = $empire->fetch1("select copyids from {$dbtbpre}enewsinfovote where pubid='{$pubid}' limit 1");
    $mid = $class_r[$add[classid]][modid];
    $pf = $emod_r[$mid]['pagef'];
    $add = DoPostInfoVar($add);
    //返回变量
    $add['fstb'] = $checkr['fstb'];
    $ret_r = ReturnAddF($add, $class_r[$add[classid]][modid], $userid, $username, 1, 0, 1);
    //返回自定义字段
    $deloldfile = 0;
    if ($add[groupid] != $add[oldgroupid] || $index_checkr['checked'] && !$add[checked]) {
        DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
        //删除旧的文件
        $deloldfile = 1;
    }
    //签发
    $newchecked = $index_checkr['checked'];
    $a = '';
    if ($class_r[$add[classid]][wfid] && $checkr['isqf']) {
        $qfr = $empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='{$add['id']}' and classid='{$add['classid']}' limit 1");
        if ($qfr['checktno'] == '100') {
            $aqf = ",checked='{$add['checked']}'";
            $newchecked = $add[checked];
        } else {
            if ($add[reworkflow]) {
                InfoUpdateToWorkflow($add[id], $add[classid], $class_r[$add[classid]][wfid], $userid, $username);
            }
            $aqf = '';
        }
    } else {
        $aqf = ",checked='{$add['checked']}'";
        $newchecked = $add[checked];
    }
    //日期目录
    $updatefile = '';
    $urlnewspath = $checkr['newspath'];
    if ($add['newspath'] != $checkr[newspath]) {
        $add[newspath] = FormatPath($add[classid], $add[newspath], 1);
        //查看目录是否存在,不存在则建立
        $updatefile .= ",newspath='{$add['newspath']}'";
        if ($deloldfile == 0) {
            DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
            //删除旧文件
            $deloldfile = 1;
        }
        $urlnewspath = $add['newspath'];
    }
    //文件名
    $urlfilename = $checkr['filename'];
    if ($add['filename'] && $add['filename'] != $checkr[filename]) {
        $newfilename = $add['filename'];
        $updatefile .= ",filename='{$newfilename}'";
        if ($deloldfile == 0) {
            DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
            //删除旧文件
            $deloldfile = 1;
        }
        $urlfilename = $newfilename;
    }
    $newstime = empty($add['newstime']) ? time() : to_time($add['newstime']);
    $lastdotime = time();
    //返回关键字组合
    if ($add['info_diyotherlink']) {
        $keyid = DoPostDiyOtherlinkID($add['info_keyid']);
    } else {
        $keyid = GetKeyid($add[keyboard], $add[classid], $add[id], $class_r[$add[classid]][link_num]);
    }
    //附加链接参数
    $addecmscheck = empty($newchecked) ? '&ecmscheck=1' : '';
    //信息地址
    $infourl = GotoGetTitleUrl($add['classid'], $add['id'], $urlnewspath, $urlfilename, $add['groupid'], $add['isurl'], $add['titleurl']);
    //返回表信息
    $infotbr = ReturnInfoTbname($class_r[$add[classid]][tbname], $index_checkr['checked'], $checkr['stb']);
    //索引表
    $indexsql = $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . "_index set newstime='{$newstime}',lastdotime='{$lastdotime}'" . $aqf . " where id='{$add['id']}' limit 1");
    //主表
    $sql = $empire->query("update " . $infotbr['tbname'] . " set classid='{$add['classid']}',ttid='{$add['ttid']}',onclick='{$add['onclick']}',totaldown='{$add['totaldown']}',firsttitle={$add['firsttitle']},isgood={$add['isgood']},ispic='{$add['ispic']}',istop={$add['istop']},isurl='{$add['isurl']}',lastdotime={$lastdotime},groupid={$add['groupid']},userfen={$add['userfen']},titlefont='" . addslashes($add[my_titlefont]) . "',titleurl='" . addslashes($infourl) . "',keyboard='" . addslashes($add[keyboard]) . "'" . $updatefile . $ret_r[values] . " where id='{$add['id']}' limit 1");
    //副表
    $stb = $checkr['stb'];
    $fsql = $empire->query("update " . $infotbr['datatbname'] . " set classid='{$add['classid']}',keyid='{$keyid}',dokey={$add['dokey']},newstempid={$add['newstempid']},closepl={$add['closepl']},infotags='" . addslashes($add[infotags]) . "'" . $ret_r[datavalues] . " where id='{$add['id']}' limit 1");
    //取第一张图作为标题图片
    if ($add['getfirsttitlepic'] && empty($add['titlepic'])) {
        $firsttitlepic = GetFpicToTpic($add['classid'], $add['id'], $add['getfirsttitlepic'], $add['getfirsttitlespic'], $add['getfirsttitlespicw'], $add['getfirsttitlespich'], $checkr['fstb']);
        if ($firsttitlepic) {
            $usql = $empire->query("update " . $infotbr['tbname'] . " set titlepic='" . addslashes($firsttitlepic) . "',ispic=1 where id='{$add['id']}'");
        }
    }
    //更新附件
    UpdateTheFileEdit($add['classid'], $add['id'], $checkr['fstb']);
    //替换图片下一页
    if ($add['repimgnexturl']) {
        UpdateImgNexturl($add['classid'], $add['id'], $index_checkr['checked']);
    }
    //投票
    AddInfoVote($add['classid'], $add['id'], $add);
    //写入专题
    InsertZtInfo($add['ztids'], $add['zcids'], $add['oldztids'], $add['oldzcids'], $add['classid'], $add['id'], $newstime);
    //TAGS
    if ($add[infotags] && $add[infotags] != $add[oldinfotags]) {
        eInsertTags($add[infotags], $add['classid'], $add['id'], $newstime);
    }
    //是否改变审核状态
    if ($index_checkr['checked'] != $newchecked) {
        MoveCheckInfoData($class_r[$add[classid]][tbname], $index_checkr['checked'], $checkr['stb'], "id='{$add['id']}'");
        //更新栏目信息数
        if ($newchecked) {
            AddClassInfos($add['classid'], '', '+1');
        } else {
            AddClassInfos($add['classid'], '', '-1');
        }
    }
    //生成文件
    if ($ccr['addreinfo'] && $newchecked) {
        GetHtml($add['classid'], $add['id'], '', 0);
    }
    //生成上一篇
    if ($ccr['repreinfo'] && ($newchecked || $newchecked != $add[oldchecked])) {
        $prer = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id<{$add['id']} and classid='{$add['classid']}' order by id desc limit 1");
        GetHtml($prer['classid'], $prer['id'], $prer, 1);
    }
    //生成栏目
    if ($ccr['haddlist'] && ($newchecked || $newchecked != $add[oldchecked])) {
        hAddListHtml($add[classid], $ccr['modid'], $ccr['haddlist'], $ccr['listdt']);
        //生成信息列表
        if ($add['ttid']) {
            ListHtml($add['ttid'], '', 5);
        }
        //改变标题分类
        if ($add['oldttid'] && $add['ttid'] != $add['oldttid']) {
            ListHtml($add['oldttid'], '', 5);
        }
    }
    //同时更新
    if ($pubcheckr['copyids'] && $pubcheckr['copyids'] != '1') {
        EditInfoToCopyInfo($add[classid], $add[id], $userid, $username, $doselfinfo);
    } else {
        $copyclassid = $add[copyclassid];
        $cpcount = count($copyclassid);
        if ($cpcount) {
            $copyids = AddInfoToCopyInfo($add[classid], $add[id], $copyclassid, $userid, $username, $doselfinfo);
            if ($copyids) {
                UpdateInfoCopyids($add['classid'], $add['id'], $copyids);
            }
        }
    }
    if ($sql) {
        //返回地址
        if ($add['ecmsfrom'] && (stristr($add['ecmsfrom'], 'ListNews.php') || stristr($add['ecmsfrom'], 'ListAllInfo.php'))) {
            $ecmsfrom = $add['ecmsfrom'];
        } else {
            $ecmsfrom = "ListNews.php?bclassid={$add['bclassid']}&classid={$add['classid']}" . hReturnEcmsHashStrHref2(0);
        }
        insert_dolog("classid={$add['classid']}<br>id=" . $add[id] . "<br>title=" . $add[title], $pubid);
        //操作日志
        printerror("EditNewsSuccess", $ecmsfrom . $addecmscheck);
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Пример #2
0
function CjNewsIn_all($classid, $checked, $uptime, $start, $userid, $username)
{
    global $class_r, $empire, $public_r, $dbtbpre, $fun_r, $emod_r;
    $checked = (int) $checked;
    $classid = (int) $classid;
    $start = (int) $start;
    if (empty($classid)) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "cj");
    $cr = $empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='{$classid}'");
    //副表
    $cra = $empire->fetch1("select * from {$dbtbpre}ecms_infoclass_" . $cr[tbname] . " where classid='{$classid}'");
    //组合两数组
    $cr = TogTwoArray($cr, $cra);
    //导入gd处理文件
    if ($cr['mark'] || $cr['getfirstspic']) {
        @(include_once "gd.php");
    }
    if (empty($cr[insertnum])) {
        $cr[insertnum] = 10;
    }
    $mid = $class_r[$cr[newsclassid]][modid];
    $savetxtf = $emod_r[$mid]['savetxtf'];
    $stb = $emod_r[$mid]['deftb'];
    //取得采集字段
    $record = "<!--record-->";
    $field = "<!--field--->";
    $mr = $empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='" . $class_r[$cr[newsclassid]][modid] . "'");
    $cjr = explode($record, $mr[cj]);
    $ccount = count($cjr);
    $sql = $empire->query("select * from {$dbtbpre}ecms_infotmp_" . $cr[tbname] . " where classid='{$classid}' and checked=0 and id>{$start} order by id limit " . $cr[insertnum]);
    $todaytime = time();
    $filetime = $todaytime;
    $b = 0;
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[id];
        $ivalue = '';
        $ifield = '';
        $dataivalue = '';
        $dataifield = '';
        $titlepicnoval = 0;
        for ($j = 0; $j < $ccount - 1; $j++) {
            $cjr1 = explode($field, $cjr[$j]);
            $dofield = $cjr1[1];
            $var = "zz_" . $dofield;
            $var1 = "z_" . $dofield;
            $var2 = "qz_" . $dofield;
            $var3 = "save_" . $dofield;
            $value = $r[$dofield];
            //自身链接
            if ($dofield == "empireselfurl") {
                $value = $r['oldurl'];
            }
            //内容
            if ($dofield == "newstext") {
                if ($cr[copyimg] || $cr[copyflash]) {
                    $GLOBALS['cjnewsurl'] = $r[oldurl];
                    $value = addslashes(CopyImg(stripSlashes($value), $cr[copyimg], $cr[copyflash], $cr[newsclassid], $cr[imgurl], $username, 0, $r['id'], $cr['mark'], $public_r['filedeftb']));
                }
                //替换关键字和字符
                $value = DoReplaceKeyAndWord($value, 1, $cr[newsclassid]);
            }
            //简介
            if ($dofield == "smalltext") {
                if (empty($value)) {
                    $value = SubSmalltextVal($r[newstext], $cr[smalltextlen]);
                } else {
                    $value = DoClearSmalltextVal($value);
                }
            }
            //图片集
            if ($dofield == "morepic") {
                if ($cr[$var3] == " checked") {
                    $msavepic = 1;
                    $r['filepass'] = $r['id'];
                    $value = LoadInSaveMorepicFile($value, $msavepic, $cr[newsclassid], 0, $r, 0, $public_r['filedeftb']);
                }
            }
            //时间
            if ($dofield == "newstime") {
                continue;
            }
            //图片标题
            if ($dofield == "titlepic" && $cr[zz_titlepicl]) {
                $cr[$var] = $cr[zz_titlepicl];
                $cr[$var1] = $cr[z_titlepicl];
                $cr[$var2] = $cr[qz_titlepicl];
                $cr[$var3] = $cr[save_titlepicl];
            }
            if ($dofield == "titlepic" && empty($value)) {
                $titlepicnoval = 1;
            }
            //是否远程保存
            if ($value && !$cr[$var1] && $cr[$var3] == " checked" && $dofield != "morepic") {
                $tranr = DoTranUrl($value, $cr[newsclassid]);
                if ($tranr[tran]) {
                    $tranr[filesize] = (int) $tranr[filesize];
                    $tranr[type] = (int) $tranr[type];
                    $r[id] = (int) $r[id];
                    //记录数据库
                    eInsertFileTable($tranr[filename], $tranr[filesize], $tranr[filepath], $username, $cr[newsclassid], '[URL]' . $tranr[filename], $tranr[type], 0, $r[id], $public_r[fpath], 0, 0, $public_r['filedeftb']);
                    $value = $tranr[url];
                }
            }
            //存放文本
            if ($savetxtf == $dofield) {
                //建立目录
                $thetxtfile = GetFileMd5();
                $truevalue = MkDirTxtFile(date("Y/md"), $thetxtfile);
                //写放文件
                EditTxtFieldText($truevalue, $value);
                $value = $truevalue;
            }
            $value = addslashes($value);
            if (strstr($emod_r[$mid]['tbdataf'], ',' . $dofield . ',')) {
                $dataifield .= "," . $dofield;
                $dataivalue .= ",'" . $value . "'";
            } else {
                $ifield .= "," . $dofield;
                $ivalue .= ",'" . $value . "'";
            }
        }
        $r[keyboard] = addslashes($r[keyboard]);
        //时间
        if ($uptime) {
            $r[newstime] = $todaytime;
            $r[truetime] = $todaytime;
        } else {
            if ($r[newstime] == "0000-00-00 00:00:00") {
                $r[newstime] = $todaytime;
            } else {
                $r[newstime] = to_time($r[newstime]);
            }
        }
        //查看目录是否存在,不存在则建立
        $newspath = FormatPath($cr[newsclassid], "", 0);
        //强制签发
        if ($class_r[$cr[newsclassid]][wfid]) {
            $checked = 0;
            $isqf = 1;
        } else {
            $checked = $checked;
            $isqf = 0;
        }
        //变量处理
        $newstempid = 0;
        $ispic = $r[titlepic] ? 1 : 0;
        //返回关键字
        $keyid = GetKeyid($r[keyboard], $cr[newsclassid], 0, $class_r[$cr[newsclassid]][link_num]);
        //索引表
        $havehtml = 0;
        $indexsql = $empire->query("insert into {$dbtbpre}ecms_" . $class_r[$cr[newsclassid]][tbname] . "_index(classid,checked,newstime,truetime,lastdotime,havehtml) values('{$cr['newsclassid']}','{$checked}','{$r['newstime']}','{$r['truetime']}','{$r['truetime']}','{$havehtml}');");
        $id = $empire->lastid();
        $infotbr = ReturnInfoTbname($class_r[$cr[newsclassid]][tbname], $checked, $stb);
        //主表
        $isurl = $r['titleurl'] ? 1 : 0;
        $isql = $empire->query("insert into " . $infotbr['tbname'] . "(id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,newstime" . $ifield . ") values('{$id}','{$cr['newsclassid']}',0,0,0,0,'{$newspath}','{$filename}','{$r['userid']}','{$r['username']}',0,0,'{$ispic}',0,'{$isqf}',0,'{$isurl}','{$r['truetime']}','{$r['truetime']}','{$havehtml}',0,0,'{$r['titlefont']}','{$r['titleurl']}','{$stb}','{$public_r['filedeftb']}','{$public_r['pldeftb']}','{$r['keyboard']}','{$r['newstime']}'" . $ivalue . ");");
        //副表
        $fisql = $empire->query("insert into " . $infotbr['datatbname'] . "(id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags" . $dataifield . ") values('{$id}','{$cr['newsclassid']}','{$keyid}',1,'{$newstempid}',0,0,''" . $dataivalue . ");");
        //更新栏目信息数
        AddClassInfos($cr['newsclassid'], '+1', '+1', $checked);
        //更新新信息数
        DoUpdateAddDataNum('info', $class_r[$cr['newsclassid']]['tid'], 1);
        //签发
        if ($isqf == 1) {
            InfoInsertToWorkflow($id, $cr[newsclassid], $class_r[$cr[newsclassid]][wfid], $userid, $username);
        }
        //更新附件
        UpdateTheFile($id, $r['id'], $cr[newsclassid], $public_r['filedeftb']);
        //取第一张图片为标题图片
        $addtitlepic = "";
        if ($cr['getfirstpic'] && $titlepicnoval) {
            $firsttitlepic = GetFpicToTpic($cr[newsclassid], $id, $cr['getfirstpic'], $cr['getfirstspic'], $cr['getfirstspicw'], $cr['getfirstspich'], $public_r['filedeftb']);
            if ($firsttitlepic) {
                $addtitlepic = ",titlepic='" . addslashes($firsttitlepic) . "',ispic=1";
            }
        }
        //文件命名
        $filename = ReturnInfoFilename($cr[newsclassid], $id, $r[filenameqz]);
        //信息地址
        $updateinfourl = '';
        if (!$isurl) {
            $infourl = GotoGetTitleUrl($cr['newsclassid'], $id, $newspath, $filename, 0, $isurl, '');
            $updateinfourl = ",titleurl='{$infourl}'";
        }
        $usql = $empire->query("update " . $infotbr['tbname'] . " set filename='{$filename}'" . $updateinfourl . $addtitlepic . " where id='{$id}'");
    }
    $fm = ehtmlspecialchars($_GET['fm']);
    //全部入库完毕
    if (empty($b)) {
        //取得忧化字段
        for ($ci = 0; $ci < $ccount - 1; $ci++) {
            $cir = explode($field, $cjr[$ci]);
            $cifield = $cir[1];
            if ($cifield == "title") {
                continue;
            }
            $updatefield .= "," . $cifield . "=''";
        }
        //状态原记录
        if ($cr['delloadinfo']) {
            $del = $empire->query("delete from {$dbtbpre}ecms_infotmp_" . $cr[tbname] . " where classid='{$classid}'");
        } else {
            $del = $empire->query("update {$dbtbpre}ecms_infotmp_" . $cr[tbname] . " set checked=1,keyboard=''" . $updatefield . " where classid='{$classid}'");
        }
        if ($fm) {
            echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><body topmargin=0><font color=red>" . $cr[classname] . "  " . $fun_r['CjLoadInInfosSuccess'] . "</font>,  <input type=button name=button value='" . $fun_r['OnlickLoadInCj'] . "' onclick=\"window.open('CheckCj.php?classid={$classid}&from=" . ehtmlspecialchars($_GET[from]) . hReturnEcmsHashStrHref2(0) . "');\"></body>";
            exit;
        } else {
            printerror("CjLoadDbSuccess", "CheckCj.php?classid={$classid}&from=" . ehtmlspecialchars($_GET[from]) . hReturnEcmsHashStrHref2(0));
        }
    }
    echo "<b>{$cr['classname']}</b>&nbsp;&nbsp;" . $fun_r['OneCjLoadDbSuccess'] . "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ecmscj.php?enews=CjNewsIn_all&checked={$checked}&uptime={$uptime}&classid={$classid}&start={$newstart}&fm={$fm}&from=" . ehtmlspecialchars($_GET[from]) . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Пример #3
0
function EditNews($add, $userid, $username)
{
    global $empire, $class_r, $class_zr, $bclassid, $public_r, $dbtbpre, $emod_r;
    $add[classid] = (int) $add[classid];
    $userid = (int) $userid;
    $ztid = $add[ztid];
    $add[id] = (int) $add[id];
    if (!$add[id] || !$add[title] || !$add[classid] || !$add[filename]) {
        printerror("EmptyTitle", "history.go(-1)");
    }
    $doselfinfo = CheckLevel($userid, $username, $add[classid], "news");
    //操作权限
    if (!$doselfinfo['doeditinfo']) {
        printerror("NotEditInfoLevel", "history.go(-1)");
    }
    $ccr = $empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='{$add['classid']}' and islast=1");
    if (!$ccr['classid'] || $ccr[wburl]) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    $checkr = $empire->fetch1("select id,userid,username,ismember,stb,copyids,newspath,filename,isqf,checked from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id='{$add['id']}' and classid='{$add['classid']}'");
    if (!$checkr[id]) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    if ($doselfinfo['doselfinfo'] && ($checkr[userid] != $userid || $checkr[ismember])) {
        printerror("NotDoSelfinfo", "history.go(-1)");
    }
    if ($ccr['sametitle']) {
        $num = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where title='{$add['title']}' and id<>{$add['id']} limit 1");
        if ($num) {
            printerror("ReInfoTitle", "history.go(-1)");
        }
    }
    $mid = $class_r[$add[classid]][modid];
    $pf = $emod_r[$mid]['pagef'];
    $add = DoPostInfoVar($add);
    //返回变量
    $ret_r = ReturnAddF($add, $class_r[$add[classid]][modid], $userid, $username, 1, 0, 1);
    //返回自定义字段
    $deloldfile = 0;
    if ($add[groupid] != $add[oldgroupid] || $checkr['checked'] && !$add[checked]) {
        DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
        //删除旧的文件
        $deloldfile = 1;
    }
    //签发
    $a = '';
    if ($class_r[$add[classid]][wfid] && $checkr['isqf']) {
        $qfr = $empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='{$add['id']}' and classid='{$add['classid']}' limit 1");
        if ($qfr['checktno'] == '100') {
            $aqf = ",checked='{$add['checked']}'";
        } else {
            if ($add[reworkflow]) {
                InfoUpdateToWorkflow($add[id], $add[classid], $class_r[$add[classid]][wfid], $userid, $username);
            }
            $aqf = '';
        }
    } else {
        $aqf = ",checked='{$add['checked']}'";
    }
    //日期目录
    $updatefile = '';
    if ($add['newspath'] != $checkr[newspath]) {
        $add[newspath] = FormatPath($add[classid], $add[newspath], 1);
        //查看目录是否存在,不存在则建立
        $updatefile .= ",newspath='{$add['newspath']}'";
        if ($deloldfile == 0) {
            DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
            //删除旧文件
            $deloldfile = 1;
        }
    }
    //文件名
    if ($add['filename'] && $add['filename'] != $checkr[filename]) {
        $newfilename = $add['filename'];
        $updatefile .= ",filename='{$newfilename}'";
        if ($deloldfile == 0) {
            DelNewsFile($checkr[filename], $checkr[newspath], $add[classid], $add[$pf], $add[oldgroupid]);
            //删除旧文件
            $deloldfile = 1;
        }
    }
    $lastdotime = time();
    //返回关键字组合
    if ($add['info_diyotherlink']) {
        $keyid = DoPostDiyOtherlinkID($add['info_keyid']);
    } else {
        $keyid = GetKeyid($add[keyboard], $add[classid], $add[id], $class_r[$add[classid]][link_num]);
    }
    //主表
    $sql = $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " set classid='{$add['classid']}',keyboard='" . addslashes($add[keyboard]) . "',keyid='{$keyid}',ztid='{$add['my_ztid']}',istop={$add['istop']},dokey={$add['dokey']},isgood={$add['isgood']},titlefont='" . addslashes($add[my_titlefont]) . "',titleurl='" . addslashes($add[titleurl]) . "',groupid={$add['groupid']},newstempid={$add['newstempid']},firsttitle={$add['firsttitle']},userfen={$add['userfen']},closepl={$add['closepl']},lastdotime={$lastdotime},ttid='{$add['ttid']}',onclick='{$add['onclick']}',totaldown='{$add['totaldown']}',infotags='" . addslashes($add[infotags]) . "',ispic='{$add['ispic']}'" . $updatefile . $aqf . $ret_r[values] . " where id='{$add['id']}'");
    //副表
    $stb = $checkr['stb'];
    $fsql = $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . "_data_" . $stb . " set classid='{$add['classid']}'" . $ret_r[datavalues] . " where id='{$add['id']}'");
    //取第一张图作为标题图片
    if ($add['getfirsttitlepic'] && empty($add['titlepic'])) {
        $firsttitlepic = GetFpicToTpic($add['classid'], $add['id'], $add['getfirsttitlepic'], $add['getfirsttitlespic'], $add['getfirsttitlespicw'], $add['getfirsttitlespich']);
        if ($firsttitlepic) {
            $usql = $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " set titlepic='" . addslashes($firsttitlepic) . "',ispic=1 where id='{$add['id']}'");
        }
    }
    //更新附件
    UpdateTheFileEdit($add['classid'], $add['id']);
    //替换图片下一页
    if ($add['repimgnexturl']) {
        UpdateImgNexturl($add['classid'], $add['id']);
    }
    //投票
    AddInfoVote($add['classid'], $add['id'], $add);
    //TAGS
    if ($add[infotags] && $add[infotags] != $add[oldinfotags]) {
        $tagtime = empty($add[newstime]) ? time() : to_time($add[newstime]);
        eInsertTags($add[infotags], $add['classid'], $add['id'], $tagtime);
    }
    //生成文件
    if ($ccr['addreinfo']) {
        $ar = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id='{$add['id']}'");
        GetHtml($ar, '');
    }
    //生成上一篇
    if ($ccr['repreinfo'] && ($add[checked] || $add[checked] != $add[oldchecked])) {
        $prer = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id<{$add['id']} and classid='{$add['classid']}' and checked=1 order by id desc limit 1");
        GetHtml($prer, '');
    }
    //生成栏目
    if ($ccr['haddlist'] && ($add[checked] || $add[checked] != $add[oldchecked])) {
        hAddListHtml($add[classid], $ccr['modid'], $ccr['haddlist'], $ccr['listdt']);
        //生成信息列表
        for ($z = 0; $z < count($ztid); $z++) {
            ListHtml(intval($ztid[$z]), '', 1);
        }
        //改变专题
        $oldztid = $add[oldztid];
        $myztid = $add['my_ztid'];
        if ($oldztid != $myztid && $oldztid) {
            $o_z = explode("|", $oldztid);
            for ($z = 1; $z < count($o_z) - 1; $z++) {
                $cr = explode("|" . $o_z[$z] . "|", $myztid);
                if ($cr == 1) {
                    ListHtml(intval($o_z[$z]), '', 1);
                }
            }
        }
    }
    //同时更新
    if ($checkr['copyids'] && $checkr['copyids'] != '1') {
        EditInfoToCopyInfo($add[classid], $add[id], $userid, $username);
    } else {
        $copyclassid = $add[copyclassid];
        $cpcount = count($copyclassid);
        if ($cpcount) {
            $copyids = AddInfoToCopyInfo($add[classid], $add[id], $copyclassid, $userid, $username);
            if ($copyids) {
                $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " set copyids='{$copyids}' where id='{$add['id']}'");
            }
        }
    }
    if ($sql) {
        //返回地址
        if ($add['ecmsfrom'] && (stristr($add['ecmsfrom'], 'ListNews.php') || stristr($add['ecmsfrom'], 'ListAllInfo.php'))) {
            $ecmsfrom = $add['ecmsfrom'];
        } else {
            $ecmsfrom = "ListNews.php?bclassid={$add['bclassid']}&classid={$add['classid']}";
        }
        insert_dolog("classid={$add['classid']}<br>id=" . $add[id] . "<br>title=" . $add[title]);
        //操作日志
        printerror("EditNewsSuccess", $ecmsfrom);
    } else {
        printerror("DbError", "history.go(-1)");
    }
}