示例#1
0
function TranFile($file, $file_name, $file_type, $file_size, $tranurl, $no, $classid, $type, $post, $userid, $username)
{
    global $empire, $public_r, $loginrnd, $dbtbpre, $ecms_config;
    if (!$no) {
        $no = $file_name;
    }
    $tranfrom = (int) $post['tranfrom'];
    $classid = (int) $classid;
    $modtype = (int) $post['modtype'];
    $infoid = (int) $post['infoid'];
    $fstb = 0;
    if (empty($modtype)) {
        $fstb = GetInfoTranFstb($classid, $infoid, 0);
    }
    //是否为空
    if (!$file_name) {
        if (empty($tranurl) || $tranurl == "http://") {
            $tranfrom == 0 ? printerror("EmptyHttp", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'EmptyHttp', '', '');
        }
        $filetype = GetFiletype($tranurl);
        //取得文件类型
        $file_size = 0;
    } else {
        $filetype = GetFiletype($file_name);
        //取得文件类型
    }
    //如果是.php文件
    if (CheckSaveTranFiletype($filetype)) {
        $tranfrom == 0 ? printerror("TranPHP", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranPHP', '', '');
    }
    $type_r = explode("|" . $filetype . "|", $public_r['filetype']);
    if (count($type_r) < 2) {
        $tranfrom == 0 ? printerror("TranFiletypeFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFiletypeFail', '', '');
    }
    if ($file_size > $public_r['filesize'] * 1024) {
        $tranfrom == 0 ? printerror("TranFilesizeFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFilesizeFail', '', '');
    }
    if ($type == 1) {
        if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
            $tranfrom == 0 ? printerror("NotTranImg", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'NotTranImg', '', '');
        }
    } elseif ($type == 2) {
        if (!strstr($ecms_config['sets']['tranflashtype'], ',' . $filetype . ',')) {
            $tranfrom == 0 ? printerror("NotTranFlash", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'NotTranFlash', '', '');
        }
    } elseif ($type == 3) {
    } else {
    }
    //远程保存
    if (empty($file_name)) {
        $r = DoTranUrl($tranurl, $classid);
        if (empty($r[tran])) {
            $tranfrom == 0 ? printerror("TranHttpFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranHttpFail', '', '');
        }
    } else {
        $r = DoTranFile($file, $file_name, $file_type, $file_size, $classid);
        if (empty($r[tran])) {
            $tranfrom == 0 ? printerror("TranFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFail', '', '');
        }
    }
    if (!$no) {
        $no = $r[filename];
    }
    //写入数据库
    $r[filesize] = (int) $r[filesize];
    $classid = (int) $classid;
    $post[filepass] = (int) $post[filepass];
    $type = (int) $type;
    $sql = eInsertFileTable($r[filename], $r[filesize], $r[filepath], $username, $classid, $no, $type, $post[filepass], $post[filepass], $public_r[fpath], 0, $modtype, $fstb);
    $fileid = $empire->lastid();
    //导入gd.php文件
    if ($type == 1 && ($post['getsmall'] || $post['getmark'])) {
        @(include ECMS_PATH . DASHBOARD . "/class/gd.php");
    }
    //缩略图
    if ($type == 1 && $post['getsmall']) {
        GetMySmallImg($classid, $no, $r[insertfile], $r[filepath], $r[yname], $post[width], $post[height], $r[name], $post['filepass'], $post['filepass'], $userid, $username, $modtype, $fstb);
    }
    //水印
    if ($type == 1 && $post['getmark']) {
        GetMyMarkImg($r['yname']);
    }
    if ($sql) {
        if ($tranfrom == 1) {
            //$imgstr=EditorSetTranPic($r[url],$r[url],$post);
            ECMS_EditorPrintError(0, $r[url], $r[filename], '', $no, $r[filesize]);
            db_close();
            exit;
        }
        echo "<script>parent.location.reload();</script>";
        db_close();
        exit;
    } else {
        $tranfrom == 0 ? printerror("InTranRecordFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'InTranRecordFail', '', '');
    }
}
示例#2
0
function SaveMorepicFile($varname, $msavepic, $i, $picurl, $picname, $classid, $id, $add)
{
    global $public_r, $empire, $loginin, $dbtbpre, $tranpicturetype;
    if ($varname == "mbigpfile") {
        $addname = "[b]";
    }
    $type = 1;
    $r[url] = $picurl;
    //上传
    if ($_FILES[$varname]['name'][$i]) {
        //取得文件类型
        $filetype = GetFiletype($_FILES[$varname]['name'][$i]);
        //允许上传类型
        if (CheckSaveTranFiletype($filetype)) {
            return $r;
        }
        if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
            return $r;
        }
        //图片文件
        if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
            return $r;
        }
        //文件大小
        if ($_FILES[$varname]['size'][$i] > $public_r['filesize'] * 1024) {
            return $r;
        }
        //上传
        $r = DoTranFile($_FILES[$varname]['tmp_name'][$i], $_FILES[$varname]['name'][$i], $_FILES[$varname]['type'][$i], $_FILES[$varname]['size'][$i], $classid);
        //------------------------写入数据库
        $r[filesize] = (int) $r[filesize];
        $classid = (int) $classid;
        $filetime = date("Y-m-d H:i:s");
        if (empty($picname)) {
            $picname = $r[filename];
        } else {
            $picname = $addname . $picname;
        }
        $picname = RepPostStr($picname);
        $id = (int) $id;
        $cjid = 0;
        if (!$id) {
            $cjid = (int) $add['filepass'];
        }
        $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,onclick,id,cjid,fpath) values('{$r['filename']}',{$r['filesize']},'{$loginin}','{$r['filepath']}','{$filetime}',{$classid},'{$picname}',{$type},0,{$id},{$cjid},'{$public_r['fpath']}');");
        return $r;
    } else {
        if (empty($msavepic)) {
            return $r;
        }
        if (empty($picurl)) {
            return $r;
        }
        //----------------取得文件类型
        $filetype = GetFiletype($picurl);
        //允许上传类型
        if (CheckSaveTranFiletype($filetype)) {
            return $r;
        }
        if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
            return $r;
        }
        //图片文件
        if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
            return $r;
        }
        //保存
        $r = DoTranUrl($picurl, $classid);
        if ($r['tran']) {
            //记录数据库
            $filetime = date("Y-m-d H:i:s");
            //变量处理
            $r[filesize] = (int) $r[filesize];
            $classid = (int) $classid;
            $r[type] = (int) $r[type];
            if (empty($picname)) {
                $picname = $r[filename];
            } else {
                $picname = $addname . $picname;
            }
            $picname = RepPostStr($picname);
            $id = (int) $id;
            $cjid = 0;
            if (!$id) {
                $cjid = (int) $add['filepass'];
            }
            $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,onclick,fpath) values('{$r['filename']}',{$r['filesize']},'{$loginin}','{$r['filepath']}','{$filetime}',{$classid},'{$picname}',{$type},{$id},{$cjid},0,'{$public_r['fpath']}');");
            return $r;
        }
        return $r;
    }
}
示例#3
0
function SaveMorepicFile($varname, $msavepic, $i, $picurl, $picname, $classid, $id, $add, $modtype = 0, $fstb = 1)
{
    global $public_r, $empire, $loginin, $dbtbpre, $ecms_config;
    if ($varname == "mbigpfile") {
        $addname = "[b]";
    }
    $type = 1;
    $r[url] = $picurl;
    //上传
    if ($_FILES[$varname]['name'][$i]) {
        //取得文件类型
        $filetype = GetFiletype($_FILES[$varname]['name'][$i]);
        //允许上传类型
        if (CheckSaveTranFiletype($filetype)) {
            return $r;
        }
        if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
            return $r;
        }
        //图片文件
        if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
            return $r;
        }
        //文件大小
        if ($_FILES[$varname]['size'][$i] > $public_r['filesize'] * 1024) {
            return $r;
        }
        //上传
        $r = DoTranFile($_FILES[$varname]['tmp_name'][$i], $_FILES[$varname]['name'][$i], $_FILES[$varname]['type'][$i], $_FILES[$varname]['size'][$i], $classid);
        //------------------------写入数据库
        $r[filesize] = (int) $r[filesize];
        $classid = (int) $classid;
        if (empty($picname)) {
            $picname = $r[filename];
        } else {
            $picname = $addname . $picname;
        }
        $picname = RepPostStr($picname);
        $id = (int) $id;
        $cjid = 0;
        if (!$id) {
            $cjid = (int) $add['filepass'];
        }
        eInsertFileTable($r[filename], $r[filesize], $r[filepath], $loginin, $classid, $picname, $type, $id, $cjid, $public_r[fpath], 0, 0, $fstb);
        return $r;
    } else {
        if (empty($msavepic)) {
            return $r;
        }
        if (empty($picurl)) {
            return $r;
        }
        //----------------取得文件类型
        $filetype = GetFiletype($picurl);
        //允许上传类型
        if (CheckSaveTranFiletype($filetype)) {
            return $r;
        }
        if (!strstr($public_r['filetype'], "|" . $filetype . "|")) {
            return $r;
        }
        //图片文件
        if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
            return $r;
        }
        //保存
        $r = DoTranUrl($picurl, $classid);
        if ($r['tran']) {
            //记录数据库
            //变量处理
            $r[filesize] = (int) $r[filesize];
            $classid = (int) $classid;
            $r[type] = (int) $r[type];
            if (empty($picname)) {
                $picname = $r[filename];
            } else {
                $picname = $addname . $picname;
            }
            $picname = RepPostStr($picname);
            $id = (int) $id;
            $cjid = 0;
            if (!$id) {
                $cjid = (int) $add['filepass'];
            }
            eInsertFileTable($r[filename], $r[filesize], $r[filepath], $loginin, $classid, $picname, $type, $id, $cjid, $public_r[fpath], 0, 0, $fstb);
            return $r;
        }
        return $r;
    }
}
示例#4
0
文件: cjfun.php 项目: novnan/meiju
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;
}
示例#5
0
function TranFile($file, $file_name, $file_type, $file_size, $tranurl, $no, $classid, $type, $post, $userid, $username)
{
    global $empire, $public_r, $loginrnd, $dbtbpre, $tranpicturetype, $tranflashtype, $mediaplayertype, $realplayertype;
    if (!$no) {
        $no = $file_name;
    }
    $tranfrom = (int) $post['tranfrom'];
    $classid = (int) $classid;
    //是否为空
    if (!$file_name) {
        if (empty($tranurl) || $tranurl == "http://") {
            $tranfrom == 0 ? printerror("EmptyHttp", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'EmptyHttp', '', '');
        }
        $filetype = GetFiletype($tranurl);
        //取得文件类型
        $file_size = 0;
    } else {
        $filetype = GetFiletype($file_name);
        //取得文件类型
    }
    //如果是.php文件
    if (CheckSaveTranFiletype($filetype)) {
        $tranfrom == 0 ? printerror("TranPHP", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranPHP', '', '');
    }
    $type_r = explode("|" . $filetype . "|", $public_r['filetype']);
    if (count($type_r) < 2) {
        $tranfrom == 0 ? printerror("TranFiletypeFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFiletypeFail', '', '');
    }
    if ($file_size > $public_r['filesize'] * 1024) {
        $tranfrom == 0 ? printerror("TranFilesizeFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFilesizeFail', '', '');
    }
    if ($type == 1) {
        if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
            $tranfrom == 0 ? printerror("NotTranImg", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'NotTranImg', '', '');
        }
    } elseif ($type == 2) {
        if (!strstr($tranflashtype, ',' . $filetype . ',')) {
            $tranfrom == 0 ? printerror("NotTranFlash", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'NotTranFlash', '', '');
        }
    } elseif ($type == 3) {
    } else {
    }
    //远程保存
    if (empty($file_name)) {
        $r = DoTranUrl($tranurl, $classid);
        if (empty($r[tran])) {
            $tranfrom == 0 ? printerror("TranHttpFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranHttpFail', '', '');
        }
    } else {
        $r = DoTranFile($file, $file_name, $file_type, $file_size, $classid);
        if (empty($r[tran])) {
            $tranfrom == 0 ? printerror("TranFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'TranFail', '', '');
        }
    }
    if (!$no) {
        $no = $r[filename];
    }
    //写入数据库
    $r[filesize] = (int) $r[filesize];
    $classid = (int) $classid;
    $post[filepass] = (int) $post[filepass];
    $type = (int) $type;
    $filetime = date("Y-m-d H:i:s");
    $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,fpath) values('{$r['filename']}',{$r['filesize']},'{$username}','{$r['filepath']}','{$filetime}',{$classid},'{$no}',{$type},{$post['filepass']},{$post['filepass']},'{$public_r['fpath']}');");
    $fileid = $empire->lastid();
    //导入gd.php文件
    if ($type == 1 && ($post['getsmall'] || $post['getmark'])) {
        @(include ECMS_PATH . "e/class/gd.php");
    }
    //缩略图
    if ($type == 1 && $post['getsmall']) {
        GetMySmallImg($classid, $no, $r[insertfile], $r[filepath], $r[yname], $post[width], $post[height], $r[name], $post['filepass'], $post['filepass'], $userid, $username);
    }
    //水印
    if ($type == 1 && $post['getmark']) {
        GetMyMarkImg($r['yname']);
    }
    if ($sql) {
        if ($tranfrom == 1) {
            //$imgstr=EditorSetTranPic($r[url],$r[url],$post);
            ECMS_EditorPrintError(0, $r[url], $r[filename], '', $no, $r[filesize]);
            db_close();
            exit;
        }
        echo "<script>parent.location.reload();</script>";
        db_close();
        exit;
    } else {
        $tranfrom == 0 ? printerror("InTranRecordFail", "history.go(-1)", 8) : ECMS_EditorPrintError(1, '', '', 'InTranRecordFail', '', '');
    }
}