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', '', ''); } }
function CopyImg($text, $copyimg, $copyflash, $classid, $qz, $username, $theid, $cjid, $mark) { global $empire, $public_r, $cjnewsurl, $navtheid, $dbtbpre; if (empty($text)) { return ""; } if ($copyimg) { $text = RepImg($text, $copyflash); } if ($copyflash) { $text = RepFlash($text, $copyflash); } $exp1 = "[--copyimg--]"; $exp2 = "[/--copyimg--]"; $r = explode($exp1, $text); for ($i = 1; $i < count($r); $i++) { $r1 = explode($exp2, $r[$i]); if (strstr($r1[0], "http://") || strstr($r1[0], "https://")) { $dourl = $r1[0]; } else { //是否是本地址 if (!strstr($r1[0], "/") && $cjnewsurl) { $fileqz_r = GetPageurlQz($cjnewsurl); $fileqz = $fileqz_r['selfqz']; $dourl = $fileqz . $r1[0]; } else { $dourl = $qz . $r1[0]; } } $return_r = DoTranUrl($dourl, $classid); $text = str_replace($exp1 . $r1[0] . $exp2, $return_r[url], $text); if ($return_r[tran]) { //记录数据库 $filetime = date("Y-m-d H:i:s"); //变量处理 $return_r[filesize] = (int) $return_r[filesize]; $classid = (int) $classid; $return_r[type] = (int) $return_r[type]; $theid = (int) $theid; $cjid = (int) $cjid; $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,onclick,fpath) values('{$return_r['filename']}',{$return_r['filesize']},'{$username}','{$return_r['filepath']}','{$filetime}',{$classid},'[URL]" . $return_r[filename] . "',{$return_r['type']},{$theid},{$cjid},0,'{$public_r['fpath']}');"); //加水 if ($mark && $return_r[type] == 1) { GetMyMarkImg($return_r['yname']); } } } return $text; }
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']); }
function CopyImg($text, $copyimg, $copyflash, $classid, $qz, $username, $theid, $cjid, $mark, $fstb = 1) { global $empire, $public_r, $cjnewsurl, $navtheid, $dbtbpre; if (empty($text)) { return ""; } $navtheid = (int) $navtheid; $fstb = (int) $fstb; if ($copyimg) { $text = RepImg($text, $copyflash); } if ($copyflash) { $text = RepFlash($text, $copyflash); } $exp1 = "[--copyimg--]"; $exp2 = "[/--copyimg--]"; $r = explode($exp1, $text); for ($i = 1; $i < count($r); $i++) { $r1 = explode($exp2, $r[$i]); if (strstr($r1[0], "http://") || strstr($r1[0], "https://")) { $dourl = $r1[0]; } else { //是否是本地址 if (!strstr($r1[0], "/") && $cjnewsurl) { $fileqz_r = GetPageurlQz($cjnewsurl); $fileqz = $fileqz_r['selfqz']; $dourl = $fileqz . $r1[0]; } else { $dourl = $qz . $r1[0]; } } $return_r = DoTranUrl($dourl, $classid); $text = str_replace($exp1 . $r1[0] . $exp2, $return_r[url], $text); if ($return_r[tran]) { //记录数据库 //变量处理 $return_r[filesize] = (int) $return_r[filesize]; $classid = (int) $classid; $return_r[type] = (int) $return_r[type]; $theid = (int) $theid; $cjid = (int) $cjid; eInsertFileTable($return_r[filename], $return_r[filesize], $return_r[filepath], $username, $classid, '[URL]' . $return_r[filename], $return_r[type], $theid, $cjid, $public_r[fpath], 0, 0, $fstb); //加水 if ($mark && $return_r[type] == 1) { GetMyMarkImg($return_r['yname']); } } } return $text; }
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', '', ''); } }