예제 #1
0
파일: index.php 프로젝트: novnan/meiju
function DoDownFile($fileid)
{
    global $empire, $public_r, $class_r, $dbtbpre;
    if (empty($fileid)) {
        printerror("ErrorUrl", "history.go(-1)", 1);
    }
    $r = $empire->fetch1("select fileid,path,filename,classid,fpath from {$dbtbpre}enewsfile_1 where fileid='{$fileid}'");
    if (empty($r[fileid])) {
        printerror("ErrorUrl", "history.go(-1)", 1);
    }
    //下载数加1
    $sql = $empire->query("update {$dbtbpre}enewsfile_1 set onclick=onclick+1 where fileid='{$fileid}'");
    $ok = 1;
    //按栏目
    $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
    $filepath = $r[path] ? $r[path] . '/' : $r[path];
    $downurl = $fspath['fileurl'] . $filepath . $r[filename];
    if ($ok) {
        Header("Location:{$downurl}");
    }
}
예제 #2
0
    <td width="42%">
<div align="center">文件名</div></td>
    <td width="15%">
<div align="center">大小</div></td>
    <td width="21%">
<div align="center">上传时间</div></td>
    <td width="10%">
<div align="center">选择</div></td>
  </tr>
  <?
  while($r=$empire->fetch($sql))
  {
	$filesize=ChTheFilesize($r[filesize]);
	$filetype=GetFiletype($r[filename]);//取得文件扩展名
	//文件
	$fspath=ReturnFileSavePath($r[classid],$r[fpath]);
	$filepath=$r[path]?$r[path].'/':$r[path];
	$file=$fspath['fileurl'].$filepath.$r[filename];
	//播放器
	if(strstr($ecms_config['sets']['mediaplayertype'],",".$filetype.","))//mediaplayer
	{
		$fileimg="<img src='../../data/type/mywmv.gif' border=0>";
	}
	else//realplayer
	{
		  $fileimg="<img src='../../data/type/myrm.gif' border=0>";
	}
	$buttonr=ToReturnDoFileButton($doing,$tranfrom,$field,$file,$r[filename],$r[fileid],$filesize,$filetype,$r[no],$type);
	$button=$buttonr['button'];
	$buttonurl=$buttonr['bturl'];
  ?>
예제 #3
0
파일: copyimgfun.php 프로젝트: novnan/meiju
function DoCropImage($add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r, $class_r, $ecms_config, $efileftp_fr, $efileftp_dr;
    //参数处理
    $pic_x = (int) $add['pic_x'];
    $pic_y = (int) $add['pic_y'];
    $pic_w = (int) $add['pic_w'];
    $pic_h = (int) $add['pic_h'];
    $doing = (int) $add['doing'];
    $fileid = (int) $add['fileid'];
    $filepass = (int) $add['filepass'];
    $classid = (int) $add['classid'];
    $infoid = (int) $add['infoid'];
    $modtype = (int) $add['modtype'];
    $fstb = 0;
    if (empty($modtype)) {
        $fstb = GetInfoTranFstb($classid, $infoid, 0);
    }
    //取得文件地址
    if (empty($fileid)) {
        printerror('NotCropImage', 'history.go(-1)');
    }
    $filer = $empire->fetch1("select fileid,path,filename,classid,fpath,no from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'");
    if (empty($filer['fileid'])) {
        printerror('NotCropImage', 'history.go(-1)');
    }
    $path = $filer['path'] ? $filer['path'] . '/' : $filer['path'];
    $fspath = ReturnFileSavePath($filer['classid'], $filer['fpath']);
    $big_image_name = eReturnEcmsMainPortPath() . $fspath['filepath'] . $path . $filer['filename'];
    //moreport
    if (!file_exists($big_image_name)) {
        printerror('NotCropImage', 'history.go(-1)');
    }
    $filetype = GetFiletype($filer['filename']);
    //取得文件类型
    if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
        printerror('CropImageFiletypeFail', 'history.go(-1)');
    }
    //目标图片
    $new_datepath = FormatFilePath($filer['classid'], '', 0);
    $new_path = $new_datepath ? $new_datepath . '/' : $new_datepath;
    $new_insertfile = ReturnDoTranFilename($filer['filename'], 0);
    $new_fspath = ReturnFileSavePath($filer['classid']);
    $new_savepath = eReturnEcmsMainPortPath() . $new_fspath['filepath'] . $new_path;
    //moreport
    $new_name = $new_savepath . $new_insertfile;
    //处理图片
    $returnr['file'] = '';
    $returnr['filetype'] = '';
    if ($temp_img_type = @getimagesize($big_image_name)) {
        preg_match('/\\/([a-z]+)$/i', $temp_img_type[mime], $tpn);
        $img_type = $tpn[1];
    } else {
        preg_match('/\\.([a-z]+)$/i', $big_image_name, $tpn);
        $img_type = $tpn[1];
    }
    $all_type = array("jpg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "gif" => array("create" => "ImageCreateFromGIF", "output" => "imagegif", "exn" => ".gif"), "jpeg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "png" => array("create" => "imagecreatefrompng", "output" => "imagepng", "exn" => ".png"), "wbmp" => array("create" => "imagecreatefromwbmp", "output" => "image2wbmp", "exn" => ".wbmp"));
    $func_create = $all_type[$img_type]['create'];
    if (empty($func_create) or !function_exists($func_create)) {
        printerror('CropImageFiletypeFail', 'history.go(-1)');
    }
    //输出
    $func_output = $all_type[$img_type]['output'];
    $func_exname = $all_type[$img_type]['exn'];
    if (($func_exname == '.gif' || $func_exname == '.png' || $func_exname == '.wbmp') && !function_exists($func_output)) {
        $func_output = 'imagejpeg';
        $func_exname = '.jpg';
    }
    $big_image = $func_create($big_image_name);
    $big_width = imagesx($big_image);
    $big_height = imagesy($big_image);
    if (!$big_width || !$big_height || $big_width < 10 || $big_height < 10) {
        printerror('CropImageFilesizeFail', 'history.go(-1)');
    }
    if (function_exists("imagecopyresampled")) {
        $temp_image = imagecreatetruecolor($pic_w, $pic_h);
        imagecopyresampled($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h);
    } else {
        $temp_image = imagecreate($pic_w, $pic_h);
        imagecopyresized($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h);
    }
    $func_output($temp_image, $new_name . $func_exname);
    ImageDestroy($big_image);
    ImageDestroy($temp_image);
    $insert_file = $new_name . $func_exname;
    $insert_filename = $new_insertfile . $func_exname;
    if (file_exists($insert_file)) {
        if (!$doing) {
            $empire->query("delete from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'");
            DelFiletext($big_image_name);
            //FileServer
            if ($public_r['openfileserver']) {
                $efileftp_dr[] = $big_image_name;
            }
        }
        //写入数据库
        $no = '[CropImg]' . $filer['no'];
        $filesize = filesize($insert_file);
        $filesize = (int) $filesize;
        $classid = (int) $classid;
        $type = 1;
        eInsertFileTable($insert_filename, $filesize, $new_datepath, $username, $classid, $no, $type, $filepass, $filepass, $public_r[fpath], 0, $modtype, $fstb);
        //FileServer
        if ($public_r['openfileserver']) {
            $efileftp_fr[] = $insert_file;
        }
    }
    echo "<script>opener.ReloadChangeFilePage();window.close();</script>";
    db_close();
    exit;
}
예제 #4
0
function action_list($classid, $username)
{
    global $empire, $class_r, $dbtbpre, $public_r;
    $action = $_GET['action'];
    $classid = (int) $_GET['classid'];
    $list = array();
    $result = json_encode(array("state" => "no match file", "list" => $list, "start" => 0, "total" => 0));
    $where = "";
    if ($action == 'listimage') {
        $where = ' and type=1';
    } else {
        if ($action == 'listfile') {
            $where = ' and type!=1';
        } else {
            return $result;
        }
    }
    $size = (int) $_GET['size'];
    $start = (int) $_GET['start'];
    $limit = $start . "," . $size;
    // 统计总数
    $total = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsfile_1 where adduser='******'" . $where);
    $sql = $empire->query("select * from {$dbtbpre}enewsfile_1 where adduser='******'" . $where . " order by fileid DESC limit " . $limit);
    $bqno = 0;
    while ($r = $empire->fetch($sql)) {
        $classpath = ReturnFileSavePath($r['classid']);
        $list[$bqno]['url'] = $public_r['newsurl'] . $classpath['filepath'] . $r['path'] . '/' . $r['filename'];
        $list[$bqno]['mtime'] = $r['filetime'];
        $bqno++;
    }
    /* 返回数据 */
    if (!count($list)) {
        return $result;
    }
    return $result = json_encode(array("state" => "SUCCESS", "list" => $list, "start" => $start, "total" => $total));
}
예제 #5
0
        $incftp = 1;
    }
    include 'copyimgfun.php';
    DoCropImage($_POST, $logininid, $loginin);
}
$fileid = (int) $_GET['fileid'];
$filepass = (int) $_GET['filepass'];
if (empty($fileid)) {
    printerror('NotCropImage', 'history.go(-1)');
}
$filer = $empire->fetch1("select fileid,path,filename,classid,fpath,no from {$dbtbpre}enewsfile where fileid='{$fileid}'");
if (empty($filer['fileid'])) {
    printerror('NotCropImage', 'history.go(-1)');
}
$path = $filer['path'] ? $filer['path'] . '/' : $filer['path'];
$fspath = ReturnFileSavePath($filer['classid'], $filer['fpath']);
$big_image_name = ECMS_PATH . $fspath['filepath'] . $path . $filer['filename'];
$imgurl = $fspath['fileurl'] . $path . $filer['filename'];
if (!file_exists($big_image_name)) {
    printerror('NotCropImage', 'history.go(-1)');
}
$filetype = GetFiletype($filer['filename']);
//È¡µÃÎļþÀàÐÍ
if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
    printerror('CropImageFiletypeFail', 'history.go(-1)');
}
db_close();
$empire = null;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
예제 #6
0
function GetFpicToTpic($classid, $id, $num = 1, $getfirsttitlespic = 0, $swidth = 0, $sheight = 0)
{
    global $empire, $dbtbpre, $public_r, $class_r;
    $num = $num - 1;
    $picr = $empire->fetch1("select fileid,filename,path,id,classid,no,fpath from {$dbtbpre}enewsfile where id={$id} and classid={$classid} and type=1 order by fileid limit {$num},1");
    $firsttitlepic = "";
    if ($picr['fileid']) {
        $rpath = $picr['path'] ? $picr['path'] . '/' : $picr['path'];
        $fspath = ReturnFileSavePath($picr[classid], $picr[fpath]);
        if ($getfirsttitlespic == 1 && $swidth && $sheight) {
            $path = "../../" . $fspath['filepath'] . $rpath;
            $yname = $path . $picr[filename];
            $filetype = GetFiletype($picr[filename]);
            $insertfile = substr($picr[filename], 0, strlen($picr[filename]) - strlen($filetype)) . time();
            $name = $path . "small" . $insertfile;
            $sfiler = GetMySmallImg($classid, $picr[no], $insertfile, $picr[path], $yname, $swidth, $sheight, $name, $add['filepass'], $add['filepass'], $userid, $username);
            $firsttitlepic = $fspath['fileurl'] . $rpath . "small" . $insertfile . $sfiler['filetype'];
        } else {
            $firsttitlepic = $fspath['fileurl'] . $rpath . $picr[filename];
        }
    }
    return $firsttitlepic;
}
예제 #7
0
$record = "<!--record-->";
$field = "<!--field--->";
$er = explode($record, $br['enter']);
$count = count($er);
for ($i = 0; $i < $count - 1; $i++) {
    $er1 = explode($field, $er[$i]);
    //附件
    if (strstr($br['filef'], "," . $er1[1] . ",")) {
        if ($r[$er1[1]]) {
            if (!$getfpath) {
                $filename = GetFilename($r[$er1[1]]);
                $filer = $empire->fetch1("select fpath from {$dbtbpre}enewsfile where path='{$r['filepath']}' and filename='{$filename}' limit 1");
                $fpath = $filer[fpath];
                $getfpath = 1;
            }
            $fspath = ReturnFileSavePath(0, $fpath);
            $fileurl = $fspath['fileurl'] . $r[$er1[1]];
            $val = "<b>附件:</b><a href='" . $fileurl . "' target=_blank>" . $r[$er1[1]] . "</a>";
        } else {
            $val = "";
        }
    } else {
        $val = $r[$er1[1]];
    }
    $feedbackinfo .= "<tr bgcolor='#FFFFFF'><td height=25>" . $er1[0] . ":</td><td>" . nl2br($val) . "</td></tr>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
예제 #8
0
파일: filefun.php 프로젝트: novnan/meiju
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']);
}
예제 #9
0
function DelFeedbackFile($filename, $filepath)
{
    global $empire, $dbtbpre, $public_r, $efileftp_dr;
    if ($filename) {
        $fpath = 0;
        $getfpath = 0;
        $addfilepath = $filepath ? $filepath . '/' : '';
        $filer = explode(",", $filename);
        $fcount = count($filer);
        for ($j = 0; $j < $fcount; $j++) {
            if (!$getfpath) {
                $ftr = $empire->fetch1("select fpath from {$dbtbpre}enewsfile where path='{$filepath}' and filename='" . $filer[$j] . "' limit 1");
                $fpath = $ftr[fpath];
                $getfpath = 1;
            }
            $fspath = ReturnFileSavePath(0, $fpath);
            $delfile = ECMS_PATH . $fspath['filepath'] . $addfilepath . $filer[$j];
            DelFiletext($delfile);
            $where .= $or . "filename='" . $filer[$j] . "'";
            $or = " or ";
            //FileServer
            if ($public_r['openfileserver']) {
                $efileftp_dr[] = $delfile;
            }
        }
        $delsql = $empire->query("delete from {$dbtbpre}enewsfile where path='{$filepath}' and (" . $where . ")");
    }
}
예제 #10
0
파일: connect.php 프로젝트: novnan/meiju
function DoDelFile($r)
{
    global $class_r, $public_r, $efileftp_dr;
    $path = $r['path'] ? $r['path'] . '/' : $r['path'];
    $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
    $delfile = eReturnEcmsMainPortPath() . $fspath['filepath'] . $path . $r['filename'];
    //moreport
    DelFiletext($delfile);
    //FileServer
    if ($public_r['openfileserver']) {
        $efileftp_dr[] = $delfile;
    }
}