Ejemplo n.º 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', '', '');
    }
}
Ejemplo n.º 2
0
function DoMarkSmallPic($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre, $public_r, $efileftp_fr;
    //导入gd处理文件
    if ($add['getsmall'] || $add['getmark']) {
        @(include ECMS_PATH . DASHBOARD . "/class/gd.php");
    } else {
        printerror("EmptyDopicFileid", "history.go(-1)");
    }
    $fileid = $add['fileid'];
    $count = count($fileid);
    if ($count == 0) {
        printerror("EmptyDopicFileid", "history.go(-1)");
    }
    $add['classid'] = (int) $add['classid'];
    $modtype = (int) $add['modtype'];
    $fstb = (int) $add['fstb'];
    $fstb = eReturnFileStb($fstb);
    for ($i = 0; $i < $count; $i++) {
        $fileid[$i] = intval($fileid[$i]);
        $r = $empire->fetch1("select classid,filename,path,no,fpath from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid[$i]}'");
        $rpath = $r['path'] ? $r['path'] . '/' : $r['path'];
        $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
        $path = eReturnEcmsMainPortPath() . $fspath['filepath'] . $rpath;
        //moreport
        $yname = $path . $r[filename];
        //缩略图
        if ($add['getsmall']) {
            $filetype = GetFiletype($r[filename]);
            $insertfile = substr($r[filename], 0, strlen($r[filename]) - strlen($filetype)) . time();
            $name = $path . "small" . $insertfile;
            GetMySmallImg($add['classid'], $r[no], $insertfile, $r[path], $yname, $add[width], $add[height], $name, $add['filepass'], $add['filepass'], $userid, $username, $modtype, $fstb);
        }
        //水印
        if ($add['getmark']) {
            GetMyMarkImg($yname);
            //FileServer
            if ($public_r['openfileserver']) {
                $efileftp_fr[] = $yname;
            }
        }
    }
    printerror("DoMarkSmallPicSuccess", $_SERVER['HTTP_REFERER']);
}
Ejemplo n.º 3
0
function ReturnMorepicpath($smallpic, $bigpic, $picname, $delpicid, $picid, $add, $downurl, $down = 0)
{
    global $loginin, $logininid;
    $f_exp = "::::::";
    $r_exp = "\r\n";
    $returnstr = "";
    $downurl = str_replace($f_exp, "", $downurl);
    $downurl = str_replace($r_exp, "", $downurl);
    //增加信息
    if (empty($down)) {
        for ($i = 0; $i < count($smallpic); $i++) {
            $name = str_replace($f_exp, "", $picname[$i]);
            $name = str_replace($r_exp, "", $name);
            //替换非法字符
            $spic = str_replace($f_exp, "", $smallpic[$i]);
            $spic = str_replace($r_exp, "", $spic);
            $spic = $spic ? $downurl . $spic : '';
            //保存图片
            $smpr = SaveMorepicFile("msmallpfile", $add[msavepic], $i, $spic, $name, $add[classid], $add[id], $add);
            $spic = $smpr[url];
            //如没有大图的话跟缩略图一样
            if (empty($bigpic[$i]) && !$_FILES['mbigpfile']['name'][$i]) {
                $bpic = $spic;
            } else {
                $bpic = str_replace($f_exp, "", $bigpic[$i]);
                $bpic = str_replace($r_exp, "", $bpic);
                $bpic = $bpic ? $downurl . $bpic : '';
                //保存图片
                $bmpr = SaveMorepicFile("mbigpfile", $add[msavepic], $i, $bpic, $name, $add[classid], $add[id], $add);
                $bpic = $bmpr[url];
                //生成缩图
                if (empty($spic) && $bpic && $bmpr[tran] && $add[mcreatespic]) {
                    $picno = '[b]' . ($name ? $name : $bmpr[filename]);
                    $sfiler = GetMySmallImg($add['classid'], $picno, $bmpr[insertfile], $bmpr[filepath], $bmpr[yname], $add[mcreatespicwidth], $add[mcreatespicheight], $bmpr[name], $add['filepass'], $add['filepass'], $logininid, $loginin);
                    $spic = str_replace("/" . $bmpr[filename], "/small" . $bmpr[insertfile] . $sfiler['filetype'], $bmpr[url]);
                }
            }
            if (empty($spic)) {
                $spic = $bpic;
            }
            if ($spic) {
                $returnstr .= $spic . $f_exp . $bpic . $f_exp . $name . $r_exp;
            }
        }
    } else {
        for ($i = 0; $i < count($smallpic); $i++) {
            //删除地址
            $del = 0;
            for ($j = 0; $j < count($delpicid); $j++) {
                if ($delpicid[$j] == $picid[$i]) {
                    $del = 1;
                }
            }
            if ($del) {
                continue;
            }
            $name = str_replace($f_exp, "", $picname[$i]);
            $name = str_replace($r_exp, "", $name);
            //替换非法字符
            $spic = str_replace($f_exp, "", $smallpic[$i]);
            $spic = str_replace($r_exp, "", $spic);
            $spic = $spic ? $downurl . $spic : '';
            //保存图片
            $smpr = SaveMorepicFile("msmallpfile", $add[msavepic], $i, $spic, $name, $add[classid], $add[id], $add);
            $spic = $smpr[url];
            //如没有大图的话跟缩略图一样
            if (empty($bigpic[$i]) && !$_FILES['mbigpfile']['name'][$i]) {
                $bpic = $spic;
            } else {
                $bpic = str_replace($f_exp, "", $bigpic[$i]);
                $bpic = str_replace($r_exp, "", $bpic);
                $bpic = $bpic ? $downurl . $bpic : '';
                //保存图片
                $bmpr = SaveMorepicFile("mbigpfile", $add[msavepic], $i, $bpic, $name, $add[classid], $add[id], $add);
                $bpic = $bmpr[url];
                //生成缩图
                if (empty($spic) && $bpic && $bmpr[tran] && $add[mcreatespic]) {
                    $picno = '[b]' . ($name ? $name : $bmpr[filename]);
                    $sfiler = GetMySmallImg($add['classid'], $picno, $bmpr[insertfile], $bmpr[filepath], $bmpr[yname], $add[mcreatespicwidth], $add[mcreatespicheight], $bmpr[name], $add['filepass'], $add['filepass'], $logininid, $loginin);
                    $spic = str_replace("/" . $bmpr[filename], "/small" . $bmpr[insertfile] . $sfiler['filetype'], $bmpr[url]);
                }
            }
            if (empty($spic)) {
                $spic = $bpic;
            }
            if ($spic) {
                $returnstr .= $spic . $f_exp . $bpic . $f_exp . $name . $r_exp;
            }
        }
    }
    //去掉最后的字符
    $returnstr = substr($returnstr, 0, strlen($returnstr) - 2);
    return $returnstr;
}
Ejemplo n.º 4
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', '', '');
    }
}