Exemple #1
0
function AddAd($add, $titlefont, $titlecolor, $userid, $username)
{
    global $empire, $dbtbpre;
    if (!$add[classid] || !$add[title] || !$add[adtype]) {
        printerror("EmptyAd", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "ad");
    $add[htmlcode] = AddAddsData(RepPhpAspJspcodeText($add[htmlcode]));
    $add[reptext] = AddAddsData(RepPhpAspJspcodeText($add[reptext]));
    $ttitlefont = TitleFont($titlefont, 'no');
    //变量处理
    $add['title'] = hRepPostStr($add['title'], 1);
    $add[pic_width] = (int) $add[pic_width];
    $add[pic_height] = (int) $add[pic_height];
    $add[classid] = (int) $add[classid];
    $add[adtype] = (int) $add[adtype];
    $add[t] = (int) $add[t];
    $add[ylink] = (int) $add[ylink];
    $add['filepass'] = (int) $add['filepass'];
    $sql = $empire->query("insert into {$dbtbpre}enewsad(picurl,url,pic_width,pic_height,onclick,classid,adtype,title,target,alt,starttime,endtime,adsay,titlefont,titlecolor,htmlcode,t,ylink,reptext) values('{$add['picurl']}','{$add['url']}',{$add['pic_width']},{$add['pic_height']},0,{$add['classid']},{$add['adtype']},'{$add['title']}','{$add['target']}','{$add['alt']}','{$add['starttime']}','{$add['endtime']}','{$add['adsay']}','{$ttitlefont}','{$titlecolor}','{$add['htmlcode']}',{$add['t']},{$add['ylink']},'{$add['reptext']}');");
    $adid = $empire->lastid();
    //更新附件
    UpdateTheFileOther(3, $adid, $add['filepass'], 'other');
    GetAdJs($adid);
    if ($sql) {
        //操作日志
        insert_dolog("adid=" . $adid . "<br>title=" . $add[title]);
        printerror("AddAdSuccess", "AddAd.php?enews=AddAd&t=" . $add[t] . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Exemple #2
0
function AddSp($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $add['varname'] = RepPostVar($add['varname']);
    if (!$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']}' 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['spfileline'] = (int) $add['spfileline'];
    $add['spfilesub'] = (int) $add['spfilesub'];
    $add['filepass'] = (int) $add['filepass'];
    $sql = $empire->query("insert into {$dbtbpre}enewssp(spname,varname,sppic,spsay,sptype,cid,classid,tempid,maxnum,sptime,groupid,userclass,username,isclose,cladd,refile,spfile,spfileline,spfilesub) values('{$add['spname']}','{$add['varname']}','{$add['sppic']}','{$add['spsay']}','{$add['sptype']}','{$add['cid']}','{$add['classid']}','{$add['tempid']}','{$add['maxnum']}','{$sptime}','{$groupid}','{$userclass}','{$username}','{$add['isclose']}','{$add['cladd']}','{$add['refile']}','{$add['spfile']}','{$add['spfileline']}','{$add['spfilesub']}');");
    $spid = $empire->lastid();
    //更新附件
    UpdateTheFileOther(7, $spid, $add['filepass'], 'other');
    //生成碎片文件
    if ($add['refile']) {
        DoSpReFile($add, 0);
    }
    if ($sql) {
        //操作日志
        insert_dolog("spid=" . $spid . "<br>spname=" . $add[spname]);
        printerror("AddSpSuccess", "AddSp.php?enews=AddSp" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Exemple #3
0
function AddFeedback($add)
{
    global $empire, $dbtbpre, $level_r, $public_r;
    CheckCanPostUrl();
    //验证来源
    if ($add['bid']) {
        $bid = (int) $add['bid'];
    } else {
        $bid = (int) getcvar('feedbackbid');
    }
    if (empty($bid)) {
        printerror("EmptyFeedbackname", "history.go(-1)", 1);
    }
    //验证码
    $keyvname = 'checkfeedbackkey';
    if ($public_r['fbkey_ok']) {
        ecmsCheckShowKey($keyvname, $add['key'], 1);
    }
    //版面是否存在
    $br = $empire->fetch1("select bid,enter,mustenter,filef,groupid,checkboxf from {$dbtbpre}enewsfeedbackclass where bid='{$bid}';");
    if (empty($br['bid'])) {
        printerror("EmptyFeedback", "history.go(-1)", 1);
    }
    //权限
    if ($br['groupid']) {
        $user = islogin();
        if ($level_r[$br[groupid]][level] > $level_r[$user[groupid]][level]) {
            printerror("HaveNotEnLevel", "history.go(-1)", 1);
        }
    }
    $pr = $empire->fetch1("select feedbacktfile,feedbackfilesize,feedbackfiletype from {$dbtbpre}enewspublic limit 1");
    //必填项
    $mustr = explode(",", $br['mustenter']);
    $count = count($mustr);
    for ($i = 1; $i < $count - 1; $i++) {
        $mf = $mustr[$i];
        if (strstr($br['filef'], "," . $mf . ",")) {
            if (!$pr['feedbacktfile']) {
                printerror("NotOpenFBFile", "", 1);
            }
            if (!$_FILES[$mf]['name']) {
                printerror("EmptyFeedbackname", "", 1);
            }
        } else {
            $chmustval = ReturnFBCheckboxAddF($add[$mf], $mf, $br['checkboxf']);
            if (!trim($chmustval)) {
                printerror("EmptyFeedbackname", "", 1);
            }
        }
    }
    $saytime = date("Y-m-d H:i:s");
    //字段处理
    $dh = "";
    $tranf = "";
    $record = "<!--record-->";
    $field = "<!--field--->";
    $er = explode($record, $br['enter']);
    $count = count($er);
    for ($i = 0; $i < $count - 1; $i++) {
        $er1 = explode($field, $er[$i]);
        $f = $er1[1];
        //附件
        $add[$f] = str_replace('[!#@-', 'ecms', $add[$f]);
        if (strstr($br['filef'], "," . $f . ",")) {
            if ($_FILES[$f]['name']) {
                if (!$pr['feedbacktfile']) {
                    printerror("NotOpenFBFile", "", 1);
                }
                $filetype = GetFiletype($_FILES[$f]['name']);
                //取得文件类型
                if (CheckSaveTranFiletype($filetype)) {
                    printerror("NotQTranFiletype", "", 1);
                }
                if (!strstr($pr['feedbackfiletype'], "|" . $filetype . "|")) {
                    printerror("NotQTranFiletype", "", 1);
                }
                if ($_FILES[$f]['size'] > $pr['feedbackfilesize'] * 1024) {
                    printerror("TooBigQTranFile", "", 1);
                }
                $tranf .= $dh . $f;
                $dh = ",";
                $fval = "[!#@-" . $f . "-@!]";
            } else {
                $fval = "";
            }
        } else {
            $add[$f] = ReturnFBCheckboxAddF($add[$f], $f, $br['checkboxf']);
            $fval = $add[$f];
        }
        $addf .= ",`" . $f . "`";
        $addval .= ",'" . addslashes(RepPostStr($fval)) . "'";
    }
    $type = 0;
    $classid = 0;
    $filename = '';
    $filepath = '';
    $userid = (int) getcvar('mluserid');
    $username = RepPostVar(getcvar('mlusername'));
    $filepass = ReturnTranFilepass();
    //上传附件
    if ($tranf) {
        $dh = "";
        $tranr = explode(",", $tranf);
        $count = count($tranr);
        for ($i = 0; $i < $count; $i++) {
            $tf = $tranr[$i];
            $tfr = DoTranFile($_FILES[$tf]['tmp_name'], $_FILES[$tf]['name'], $_FILES[$tf]['type'], $_FILES[$tf]['size'], $classid);
            if ($tfr['tran']) {
                $filepath = $tfr[filepath];
                //写入数据库
                $filetime = $saytime;
                $filesize = (int) $_FILES[$tf]['size'];
                eInsertFileTable($tfr[filename], $filesize, $tfr[filepath], '[Member]' . $username, $classid, '[FB]' . addslashes(RepPostStr($add[title])), $type, $filepass, $filepass, $public_r[fpath], 0, 4, 0);
                $repfval = ($tfr[filepath] ? $tfr[filepath] . '/' : '') . $tfr[filename];
                $filename .= $dh . $tfr[filename];
                $dh = ",";
            } else {
                $repfval = "";
            }
            $addval = str_replace("[!#@-" . $tf . "-@!]", $repfval, $addval);
        }
    }
    $ip = egetip();
    $eipport = egetipport();
    $sql = $empire->query("insert into {$dbtbpre}enewsfeedback(bid,saytime,ip,filepath,filename,userid,username,haveread,eipport" . $addf . ") values('{$bid}','{$saytime}','{$ip}','{$filepath}','{$filename}','{$userid}','{$username}',0,'{$eipport}'" . $addval . ");");
    $fid = $empire->lastid();
    //更新附件
    UpdateTheFileOther(4, $fid, $filepass, 'other');
    ecmsEmptyShowKey($keyvname);
    //清空验证码
    if ($sql) {
        $reurl = DoingReturnUrl("../tool/feedback/?bid={$bid}", $add['ecmsfrom']);
        printerror("AddFeedbackSuccess", $reurl, 1);
    } else {
        printerror("DbError", "history.go(-1)", 1);
    }
}
Exemple #4
0
function register($add)
{
    global $empire, $dbtbpre, $public_r, $ecms_config;
    //关闭注册
    if ($public_r['register_ok']) {
        printerror('CloseRegister', '', 1);
    }
    //验证时间段允许操作
    eCheckTimeCloseDo('reg');
    //验证IP
    eCheckAccessDoIp('register');
    if (!empty($ecms_config['member']['registerurl'])) {
        Header("Location:" . $ecms_config['member']['registerurl']);
        exit;
    }
    //已经登陆不能注册
    if (getcvar('mluserid')) {
        printerror('LoginToRegister', '', 1);
    }
    CheckCanPostUrl();
    //验证来源
    $username = trim($add['username']);
    $password = trim($add['password']);
    $username = RepPostVar($username);
    $password = RepPostVar($password);
    $email = RepPostStr($add['email']);
    if (!$username || !$password || !$email) {
        printerror("EmptyMember", "history.go(-1)", 1);
    }
    $tobind = (int) $add['tobind'];
    //验证码
    $keyvname = 'checkregkey';
    if ($public_r['regkey_ok']) {
        ecmsCheckShowKey($keyvname, $add['key'], 1);
    }
    $user_groupid = eReturnMemberDefGroupid();
    $groupid = (int) $add['groupid'];
    $groupid = empty($groupid) ? $user_groupid : $groupid;
    CheckMemberGroupCanReg($groupid);
    //IP
    $regip = egetip();
    $regipport = egetipport();
    //用户字数
    $pr = $empire->fetch1("select min_userlen,max_userlen,min_passlen,max_passlen,regretime,regclosewords,regemailonly from {$dbtbpre}enewspublic limit 1");
    $userlen = strlen($username);
    if ($userlen < $pr[min_userlen] || $userlen > $pr[max_userlen]) {
        printerror('FaiUserlen', '', 1);
    }
    //密码字数
    $passlen = strlen($password);
    if ($passlen < $pr[min_passlen] || $passlen > $pr[max_passlen]) {
        printerror('FailPasslen', '', 1);
    }
    if ($add['repassword'] !== $password) {
        printerror('NotRepassword', '', 1);
    }
    if (!chemail($email)) {
        printerror('EmailFail', '', 1);
    }
    if (strstr($username, '|') || strstr($username, '*')) {
        printerror('NotSpeWord', '', 1);
    }
    //同一IP注册
    eCheckIpRegTime($regip, $pr['regretime']);
    //保留用户
    toCheckCloseWord($username, $pr['regclosewords'], 'RegHaveCloseword');
    $username = RepPostStr($username);
    //重复用户
    $num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$username}' limit 1");
    if ($num) {
        printerror('ReUsername', '', 1);
    }
    //重复邮箱
    if ($pr['regemailonly']) {
        $num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('email') . "='{$email}' limit 1");
        if ($num) {
            printerror('ReEmailFail', '', 1);
        }
    }
    //注册时间
    $lasttime = time();
    $registertime = eReturnAddMemberRegtime();
    $rnd = make_password(20);
    //产生随机密码
    $userkey = eReturnMemberUserKey();
    //密码
    $truepassword = $password;
    $salt = eReturnMemberSalt();
    $password = eDoMemberPw($password, $salt);
    //审核
    $checked = ReturnGroupChecked($groupid);
    if ($checked && $public_r['regacttype'] == 1) {
        $checked = 0;
    }
    //验证附加表必填项
    $mr['add_filepass'] = ReturnTranFilepass();
    $fid = GetMemberFormId($groupid);
    $member_r = ReturnDoMemberF($fid, $add, $mr, 0, $username);
    $sql = $empire->query("insert into " . eReturnMemberTable() . "(" . eReturnInsertMemberF('username,password,rnd,email,registertime,groupid,userfen,userdate,money,zgroupid,havemsg,checked,salt,userkey') . ") values('{$username}','{$password}','{$rnd}','{$email}','{$registertime}','{$groupid}','{$public_r['reggetfen']}','0','0','0','0','{$checked}','{$salt}','{$userkey}');");
    //取得userid
    $userid = $empire->lastid();
    //附加表
    $addr = $empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='{$userid}'");
    if (!$addr[userid]) {
        $spacestyleid = ReturnGroupSpaceStyleid($groupid);
        $sql1 = $empire->query("insert into {$dbtbpre}enewsmemberadd(userid,spacestyleid,regip,lasttime,lastip,loginnum,regipport,lastipport" . $member_r[0] . ") values('{$userid}','{$spacestyleid}','{$regip}','{$lasttime}','{$regip}','1','{$regipport}','{$regipport}'" . $member_r[1] . ");");
    }
    //更新附件
    UpdateTheFileOther(6, $userid, $mr['add_filepass'], 'member');
    ecmsEmptyShowKey($keyvname);
    //清空验证码
    //绑定帐号
    if ($tobind) {
        MemberConnect_BindUser($userid);
    }
    if ($sql) {
        //邮箱激活
        if ($checked == 0 && $public_r['regacttype'] == 1) {
            include 'class/member_actfun.php';
            SendActUserEmail($userid, $username, $email);
        }
        //审核
        if ($checked == 0) {
            $location = DoingReturnUrl("../../", $_POST['ecmsfrom']);
            printerror("RegisterSuccessCheck", $location, 1);
        }
        $logincookie = 0;
        if ($ecms_config['member']['regcookietime']) {
            $logincookie = time() + $ecms_config['member']['regcookietime'];
        }
        $r = $empire->fetch1("select " . eReturnSelectMemberF('*') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}' limit 1");
        $set1 = esetcookie("mlusername", $username, $logincookie);
        $set2 = esetcookie("mluserid", $userid, $logincookie);
        $set3 = esetcookie("mlgroupid", $groupid, $logincookie);
        $set4 = esetcookie("mlrnd", $rnd, $logincookie);
        //验证符
        qGetLoginAuthstr($userid, $username, $rnd, $groupid, $logincookie);
        //登录附加cookie
        AddLoginCookie($r);
        $location = "../member/cp/";
        $returnurl = getcvar('returnurl');
        if ($returnurl && !strstr($returnurl, "e/member/iframe") && !strstr($returnurl, "e/member/register") && !strstr($returnurl, "enews=exit")) {
            $location = $returnurl;
        }
        $set5 = esetcookie("returnurl", "");
        //易通行系统
        DoEpassport('reg', $userid, $username, $truepassword, $salt, $email, $groupid, $registertime);
        $location = DoingReturnUrl($location, $_POST['ecmsfrom']);
        printerror("RegisterSuccess", $location, 1);
    } else {
        printerror("DbError", "history.go(-1)", 1);
    }
}
Exemple #5
0
function AddClass($add, $userid, $username)
{
    global $empire, $dbtbpre;
    //增加外部栏目
    if ($add[ecmsclasstype]) {
        AddWbClass($add, $userid, $username);
    }
    $add[classpath] = trim($add[classpath]);
    if (!$add[classname] || !$add[classpath] || !$add[modid]) {
        printerror("EmptyClass", "");
    }
    if ($add[islast] && (!$add[newstempid] || !$add[listtempid])) {
        printerror("LastMustChange", "");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "class");
    $add = DoPostClassVar($add);
    //目录已存在
    if (strstr($add[classpath], ".") || strstr($add[classpath], "/") || strstr($add[classpath], "\\")) {
        printerror("badpath", "");
    }
    $classpath = $add[pripath] . $add[classpath];
    if (file_exists("../../" . $classpath)) {
        printerror("ReClasspath", "");
    }
    $addtime = time();
    //取得表名
    $tabler = GetModTable($add[modid]);
    $tabler[tid] = (int) $tabler[tid];
    //增加大栏目
    if (!$add[islast]) {
        if (empty($add[bclassid])) {
            $sonclass = "";
            $featherclass = "";
        } else {
            //取得上一级父栏目
            $r = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
            if ($r[islast]) {
                printerror("BclassNotLast", "");
            }
            if ($r[wburl]) {
                printerror("BclassNotWb", "");
            }
            if (empty($r[featherclass])) {
                $r[featherclass] = "|";
            }
            $featherclass = $r[featherclass] . $add[bclassid] . "|";
            $sonclass = "";
        }
        //建立目录
        CreateClassPath($classpath);
        $sql = $empire->query("insert into {$dbtbpre}enewsclass(bclassid,classname,is_zt,sonclass,lencord,link_num,newstempid,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,filename_qz,hotplline,modid,checked,firstline,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorder,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey,dtlisttempid,classtempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,sametitle,definfovoteid,wburl,qeditchecked,wapstyleid,repreinfo,pltempid,cgroupid,yhid,wfid,cgtoinfo,bdinfoid,repagenum,keycid,addtime) values({$add['bclassid']},'{$add['classname']}',0,'{$sonclass}',{$add['lencord']},{$add['link_num']},{$add['newstempid']},0,{$add['listtempid']},'{$featherclass}',{$add['islast']},'{$classpath}','{$add['classtype']}','{$add['newspath']}',{$add['filename']},'{$add['filetype']}',{$add['openpl']},{$add['openadd']},{$add['newline']},{$add['hotline']},{$add['goodline']},'{$add['classurl']}',{$add['groupid']},{$add['myorder']},'{$add['filename_qz']}',{$add['hotplline']},{$add['modid']},{$add['checked']},{$add['firstline']},'{$add['bname']}',{$add['islist']},{$add['searchtempid']},{$tabler['tid']},'{$tabler['tbname']}',{$add['maxnum']},{$add['checkpl']},{$add['down_num']},{$add['online_num']},'{$add['listorder']}','{$add['reorder']}','{$add['intro']}','{$add['classimg']}',{$add['jstempid']},{$add['addinfofen']},{$add['listdt']},{$add['showclass']},{$add['showdt']},{$add['checkqadd']},{$add['qaddlist']},'{$add['qaddgroupid']}',{$add['qaddshowkey']},{$add['adminqinfo']},{$add['doctime']},'{$add['classpagekey']}','{$add['dtlisttempid']}','{$add['classtempid']}',{$add['nreclass']},{$add['nreinfo']},{$add['nrejs']},{$add['nottobq']},'{$add['ipath']}',{$add['addreinfo']},{$add['haddlist']},{$add['sametitle']},{$add['definfovoteid']},'',{$add['qeditchecked']},{$add['wapstyleid']},'{$add['repreinfo']}','{$add['pltempid']}','{$add['cgroupid']}','{$add['yhid']}','{$add['wfid']}','{$add['cgtoinfo']}','{$add['bdinfoid']}','{$add['repagenum']}','{$add['keycid']}','{$addtime}');");
        $lastid = $empire->lastid();
        //副表
        $ret_cr = ReturnClassAddF($add, 0);
        $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext" . $ret_cr[0] . ") values('{$lastid}','" . eaddslashes2($add[classtext]) . "'" . $ret_cr[1] . ");");
        //统计表
        $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('{$lastid}');");
        //更新附件
        UpdateTheFileOther(1, $lastid, $add['filepass'], 'other');
        TogNotReClass(1);
        GetClass();
        if ($add[islist] == 0 || $add[islist] == 2) {
            $classtemp = $add[islist] == 2 ? GetClassText($lastid) : GetClassTemp($add['classtempid']);
            NewsBq($lastid, $classtemp, 0, 1);
        } elseif ($add[islist] == 3) {
            ReClassBdInfo($lastid);
        }
        DelListEnews();
        //删除缓存文件
        //GetSearch($add[modid]);//更新缓存
        if ($sql) {
            //删除导航缓存
            $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='{$add['modid']}')");
            DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js");
            $cache_enews = 'doclass,doinfo,domod,dostemp';
            $cache_ecmstourl = urlencode("AddClass.php?enews=AddClass&from=" . ehtmlspecialchars($add[from]) . hReturnEcmsHashStrHref2(0));
            $cache_mess = 'AddClassSuccess';
            $cache_mid = $add[modid];
            $cache_url = "CreateCache.php?enews={$cache_enews}&mid={$cache_mid}&ecmstourl={$cache_ecmstourl}&mess={$cache_mess}" . hReturnEcmsHashStrHref2(0);
            insert_dolog("classid=" . $lastid . "<br>classname=" . $add[classname]);
            //操作日志
            //printerror("AddClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
            echo '<meta http-equiv="refresh" content="0;url=' . $cache_url . '">';
            db_close();
            $empire = null;
            exit;
        } else {
            printerror("DbError", "");
        }
    } else {
        //文件前缀
        $add[filename_qz] = RepFilenameQz($add[filename_qz]);
        if (empty($add[bclassid])) {
            $sonclass = "";
            $featherclass = "";
        } else {
            //取得上一级父栏目
            $r = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
            //是否终极类别
            if ($r[islast]) {
                printerror("BclassNotLast", "");
            }
            if ($r[wburl]) {
                printerror("BclassNotWb", "");
            }
            if (empty($r[featherclass])) {
                $r[featherclass] = "|";
            }
            $featherclass = $r[featherclass] . $add[bclassid] . "|";
            $sonclass = "";
        }
        //建立栏目目录
        CreateClassPath($classpath);
        $sql = $empire->query("insert into {$dbtbpre}enewsclass(bclassid,classname,sonclass,is_zt,lencord,link_num,newstempid,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,hotline,goodline,classurl,groupid,myorder,filename_qz,hotplline,modid,checked,firstline,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorder,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey,dtlisttempid,classtempid,nreclass,nreinfo,nrejs,nottobq,ipath,addreinfo,haddlist,sametitle,definfovoteid,wburl,qeditchecked,wapstyleid,repreinfo,pltempid,cgroupid,yhid,wfid,cgtoinfo,bdinfoid,repagenum,keycid,addtime) values({$add['bclassid']},'{$add['classname']}','{$sonclass}',0,{$add['lencord']},{$add['link_num']},{$add['newstempid']},0,{$add['listtempid']},'{$featherclass}',{$add['islast']},'{$classpath}','{$add['classtype']}','{$add['newspath']}',{$add['filename']},'{$add['filetype']}',{$add['openpl']},{$add['openadd']},{$add['newline']},{$add['hotline']},{$add['goodline']},'{$add['classurl']}',{$add['groupid']},{$add['myorder']},'{$add['filename_qz']}',{$add['hotplline']},{$add['modid']},{$add['checked']},{$add['firstline']},'{$add['bname']}',{$add['islist']},{$add['searchtempid']},{$tabler['tid']},'{$tabler['tbname']}',{$add['maxnum']},{$add['checkpl']},{$add['down_num']},{$add['online_num']},'{$add['listorder']}','{$add['reorder']}','{$add['intro']}','{$add['classimg']}',{$add['jstempid']},{$add['addinfofen']},{$add['listdt']},{$add['showclass']},{$add['showdt']},{$add['checkqadd']},{$add['qaddlist']},'{$add['qaddgroupid']}',{$add['qaddshowkey']},{$add['adminqinfo']},{$add['doctime']},'{$add['classpagekey']}','{$add['dtlisttempid']}','{$add['classtempid']}',{$add['nreclass']},{$add['nreinfo']},{$add['nrejs']},{$add['nottobq']},'{$add['ipath']}',{$add['addreinfo']},{$add['haddlist']},{$add['sametitle']},{$add['definfovoteid']},'',{$add['qeditchecked']},{$add['wapstyleid']},'{$add['repreinfo']}','{$add['pltempid']}','{$add['cgroupid']}','{$add['yhid']}','{$add['wfid']}','{$add['cgtoinfo']}','{$add['smallbdinfoid']}','{$add['repagenum']}','{$add['keycid']}','{$addtime}');");
        $lastid = $empire->lastid();
        //副表
        $ret_cr = ReturnClassAddF($add, 0);
        $empire->query("replace into {$dbtbpre}enewsclassadd(classid,classtext" . $ret_cr[0] . ") values('{$lastid}','" . eaddslashes2($add[classtext]) . "'" . $ret_cr[1] . ");");
        //统计表
        $empire->query("replace into {$dbtbpre}enewsclass_stats(classid) values('{$lastid}');");
        //修改父栏目的子栏目
        if ($add[bclassid]) {
            $b_r = $empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
            if (empty($b_r[sonclass])) {
                $b_r[sonclass] = "|";
            }
            $new_sonclass = $b_r[sonclass] . $lastid . "|";
            $update = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$new_sonclass}' where classid='{$add['bclassid']}'");
            //更改父类别的父栏目的子栏目
            $where = ReturnClass($b_r[featherclass]);
            if (empty($where)) {
                $where = "classid=0";
            }
            $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
            while ($br = $empire->fetch($bsql)) {
                if (empty($br[sonclass])) {
                    $br[sonclass] = "|";
                }
                $new_sonclass = $br[sonclass] . $lastid . "|";
                $update = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$new_sonclass}' where classid='{$br['classid']}'");
            }
        }
        //更新附件
        UpdateTheFileOther(1, $lastid, $add['filepass'], 'other');
        DelListEnews();
        //删除缓存文件
        TogNotReClass(1);
        GetClass();
        //GetSearch($add[modid]);//更新缓存
        if ($sql) {
            //删除导航缓存
            $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or (navtype='modclass' and modid='{$add['modid']}')");
            DelFiletext("../data/js/js/addinfo" . $add[modid] . ".js");
            $cache_enews = 'doclass,doinfo,domod,dostemp';
            $cache_ecmstourl = urlencode("AddClass.php?enews=AddClass&from=" . ehtmlspecialchars($add[from]) . hReturnEcmsHashStrHref2(0));
            $cache_mess = 'AddLastClassSuccess';
            $cache_mid = $add[modid];
            $cache_url = "CreateCache.php?enews={$cache_enews}&mid={$cache_mid}&ecmstourl={$cache_ecmstourl}&mess={$cache_mess}" . hReturnEcmsHashStrHref2(0);
            insert_dolog("classid=" . $lastid . "<br>classname=" . $add[classname]);
            //操作日志
            //printerror("AddLastClassSuccess","AddClass.php?enews=AddClass&from=".ehtmlspecialchars($add[from]).hReturnEcmsHashStrHref2(0));
            echo '<meta http-equiv="refresh" content="0;url=' . $cache_url . '">';
            db_close();
            $empire = null;
            exit;
        } else {
            printerror("DbError", "history.go(-1)");
        }
    }
}