예제 #1
0
function TranTruePathFile($level, $path, $file, $file_name, $file_type, $file_size, $add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r;
    if (!$file_name) {
        printerror("EmptyTranFile", "history.go(-1)");
    }
    $r['filetype'] = GetFiletype($file_name);
    //取得文件类型
    //如果是.php文件
    if (CheckSaveTranFiletype($r['filetype'])) {
        printerror("TranPHP", "history.go(-1)");
    }
    $type_r = explode("|" . $r['filetype'] . "|", $public_r['filetype']);
    if (count($type_r) < 2) {
        printerror("TranFiletypeFail", "history.go(-1)");
    }
    if ($file_size > $public_r['filesize'] * 1024) {
        printerror("TranFilesizeFail", "history.go(-1)");
    }
    //文件名
    $r['insertfile'] = ReturnDoTranFilename($file_name, $classid);
    $r['filename'] = $r['insertfile'] . $r['filetype'];
    $r['name'] = ECMS_PATH . $path . '/' . $r['filename'];
    $r['tran'] = 1;
    //上传文件
    $cp = @move_uploaded_file($file, $r['name']);
    if (empty($cp)) {
        $r['tran'] = 0;
        printerror('TranFail', '');
    }
    DoChmodFile($r['name']);
    //操作日志
    insert_dolog("path={$path}<br>filename=" . $r['filename']);
    echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['HTTP_REFERER'] . '">';
    db_close();
    $empire = null;
}
예제 #2
0
파일: ListAd.php 프로젝트: novnan/meiju
function GetAdJs($adid)
{
    global $empire, $public_r, $dbtbpre;
    $r = $empire->fetch1("select * from {$dbtbpre}enewsad where adid='{$adid}'");
    $file = "../../../d/js/acmsd/" . $public_r[adfile] . $adid . ".js";
    //到期
    if ($r['endtime'] != '0000-00-00' && time() > to_time($r['endtime'])) {
        $r[reptext] = ClearHtmlZs($r[reptext]);
        $h = addslashes(str_replace("\r\n", "", $r[reptext]));
        $html = "document.write(\"" . $h . "\")";
        WriteFiletext_n($file, $html);
        return '';
    }
    if ($r['ylink']) {
        $ad_url = $r['url'];
    } else {
        $ad_url = $public_r[newsurl] . "e/public/ClickAd?adid=" . $adid;
        //广告链接
    }
    //----------------------文字广告
    if ($r[t] == 1) {
        $r[titlefont] = $r[titlecolor] . ',' . $r[titlefont];
        $picurl = DoTitleFont($r[titlefont], $r[picurl]);
        //文字属性
        $h = "<a href='" . $ad_url . "' target=" . $r[target] . " title='" . $r[alt] . "'>" . addslashes($picurl) . "</a>";
        //普通显示
        if ($r[adtype] == 1) {
            $html = "document.write(\"" . $h . "\")";
        } else {
            $html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;" . $h . "</td></tr></table></div>\");";
        }
    } elseif ($r[t] == 2) {
        $r[htmlcode] = ClearHtmlZs($r[htmlcode]);
        $h = addslashes(str_replace("\r\n", "", $r[htmlcode]));
        //普通显示
        if ($r[adtype] == 1) {
            $html = "document.write(\"" . $h . "\")";
        } else {
            $html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;" . $h . "</td></tr></table></div>\");";
        }
    } elseif ($r[t] == 3) {
        //打开新窗口
        if ($r[adtype] == 8) {
            $html = "window.open('" . $r[url] . "');";
        } elseif ($r[adtype] == 9) {
            $html = "window.open('" . $r[url] . "','','width=" . $r[pic_width] . ",height=" . $r[pic_height] . ",scrollbars=yes');";
        } else {
            $html = "window.showModalDialog('" . $r[url] . "','','dialogWidth:" . $r[pic_width] . "px;dialogHeight:" . $r[pic_height] . "px;scroll:no;status:no;help:no');";
        }
    } else {
        $filetype = GetFiletype($r[picurl]);
        //flash
        if ($filetype == ".swf") {
            $h = "<object classid=\\\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\\\" name=\\\"movie\\\" width=\\\"" . $r[pic_width] . "\\\" height=\\\"" . $r[pic_height] . "\\\" id=\\\"movie\\\"><param name=\\\"movie\\\" value=\\\"" . $r[picurl] . "\\\"><param name=\\\"quality\\\" value=\\\"high\\\"><param name=\\\"menu\\\" value=\\\"false\\\"><embed src=\\\"" . $r[picurl] . "\\\" width=\\\"" . $r[pic_width] . "\\\" height=\\\"" . $r[pic_height] . "\\\" quality=\\\"high\\\" pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\" type=\\\"application/x-shockwave-flash\\\" id=\\\"movie\\\" name=\\\"movie\\\" menu=\\\"false\\\"></embed><PARAM NAME='wmode' VALUE='Opaque'></object>";
        } else {
            $h = "<a href='" . $ad_url . "' target=" . $r[target] . "><img src='" . $r[picurl] . "' border=0 width='" . $r[pic_width] . "' height='" . $r[pic_height] . "' alt='" . $r[alt] . "'></a>";
        }
        //普通显示
        if ($r[adtype] == 1) {
            $html = "document.write(\"" . $h . "\");";
        } elseif ($r[adtype] == 4) {
            $html = "ns4=(document.layers)?true:false;\nie4=(document.all)?true:false;\nif(ns4){document.write(\"<layer id=DGbanner2 width=" . $r[pic_width] . " height=" . $r[pic_height] . " onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner2 style='position:absolute; width:" . $r[pic_width] . "px; height:" . $r[pic_height] . "px; z-index:9; filter: Alpha(Opacity=90)' onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_fullscreen.js></script>\");";
        } elseif ($r[adtype] == 5) {
            $html = "if (navigator.appName == 'Netscape')\n{document.write(\"<layer id=DGbanner3 top=150 width=" . $r[pic_width] . " height=" . $r[pic_height] . ">" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner3 style='position: absolute;width:" . $r[pic_height] . ";top:150;visibility: visible;z-index: 1'>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_upanddown.js></script>\");";
        } elseif ($r[adtype] == 6) {
            $html = "if(navigator.appName == 'Netscape')\n{document.write(\"<layer id=DGbanner10 top=150 width=" . $r[pic_width] . " height=" . $r[pic_height] . ">" . $h . "</layer>\");}\nelse{document.write(\"<div id=DGbanner10 style='position: absolute;width:" . $r[pic_width] . ";top:150;visibility: visible;z-index: 1'>" . $h . "</div>\");}\ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_float_upanddown_L.js></script>\");";
        } elseif ($r[adtype] == 7) {
            $html = "ns4=(document.layers)?true:false;\nif(ns4){document.write(\"<layer id=DGbanner4Cont onLoad='moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height=" . $r[pic_height] . ";clip.width=" . $r[pic_width] . "; visibility=show;'><layer id=DGbanner4News position:absolute; top:0; left:0>" . $h . "</layer></layer>\");}\nelse{document.write(\"<div id=DGbanner4 style='position:absolute;top:0; left:0;'><div id=DGbanner4Cont style='position:absolute;width:" . $r[pic_width] . ";height:" . $r[pic_height] . ";clip:rect(0," . $r[pic_width] . "," . $r[pic_height] . ",0)'><div id=DGbanner4News style='position:absolute;top:0;left:0;right:820'>" . $h . "</div></div></div>\");} \ndocument.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_fullscreen.js></script>\");";
        } elseif ($r[adtype] == 3) {
            $html = "document.write(\"<script language=javascript src=" . $public_r[newsurl] . "d/js/acmsd/ecms_dialog.js></script>\"); \ndocument.write(\"<div style='position:absolute;left:300px;top:150px;width:" . $r[pic_width] . "; height:" . $r[pic_height] . ";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=" . $r[pic_width] . " height=" . $r[pic_height] . " bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='" . $public_r[newsurl] . "d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;" . $h . "</td></tr></table></div>\");";
        } else {
            $html = "function closeAd(){huashuolayer2.style.visibility='hidden';huashuolayer3.style.visibility='hidden';}function winload(){huashuolayer2.style.top=109;huashuolayer2.style.left=5;huashuolayer3.style.top=109;huashuolayer3.style.right=5;}//if(document.body.offsetWidth>800){\n\t\t\t\t{document.write(\"<div id=huashuolayer2 style='position: absolute;visibility:visible;z-index:1'><table width=0  border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=" . $public_r[newsurl] . "d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>" . $h . "</td></tr></table></div>\"+\"<div id=huashuolayer3 style='position: absolute;visibility:visible;z-index:1'><table width=0  border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=" . $public_r[newsurl] . "d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>" . $h . "</td></tr></table></div>\");}winload()//}";
        }
    }
    WriteFiletext_n($file, $html);
}
예제 #3
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;
    }
}
예제 #4
0
function TranMoreFile($file, $file_name, $file_type, $file_size, $no, $type, $userid, $username)
{
    global $empire, $public_r, $dbtbpre;
    $count = count($file_name);
    if (empty($count)) {
        printerror("MustChangeTranOneFile", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "file");
    $type = (int) $type;
    for ($i = 0; $i < $count; $i++) {
        if (empty($file_name[$i])) {
            continue;
        }
        //取得文件类型
        $filetype = GetFiletype($file_name[$i]);
        //如果是.php文件
        if (CheckSaveTranFiletype($filetype)) {
            continue;
        }
        $type_r = explode("|" . $filetype . "|", $public_r['filetype']);
        if (count($type_r) < 2) {
            continue;
        }
        if ($file_size[$i] > $public_r['filesize'] * 1024) {
            continue;
        }
        //上传
        $r = DoTranFile($file[$i], $file_name[$i], $file_type[$i], $file_size[$i], $classid);
        //写入数据库
        $r[filesize] = (int) $r[filesize];
        $classid = (int) $classid;
        $filetime = date("Y-m-d H:i:s");
        if (empty($no[$i])) {
            $no[$i] = $r[filename];
        }
        $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,onclick,id,cjid,fpath) values('{$r['filename']}',{$r['filesize']},'{$username}','{$r['filepath']}','{$filetime}',{$classid},'{$no[$i]}',{$type},0,0,0,'{$public_r['fpath']}');");
    }
    insert_dolog("");
    //操作日志
    printerror("TranMoreFileSuccess", "file/TranMoreFile.php");
}
예제 #5
0
function Ebak_DoTranExecSql($file, $file_name, $file_type, $file_size, $add)
{
    global $empire, $phome_db_dbname, $phome_db_ver, $phome_db_char;
    if (!$file_name || !$file_size) {
        printerror("NotChangeSQLFile", "history.go(-1)");
    }
    $filetype = GetFiletype($file_name);
    //取得扩展名
    if ($filetype != ".sql") {
        printerror("NotTranSQLFile", "history.go(-1)");
    }
    //上传文件
    $newfile = 'tmp/uploadsql' . time() . '.sql';
    $cp = Ebak_DoTranFile($file, $newfile);
    if (empty($cp)) {
        printerror("TranSQLFileFail", "history.go(-1)");
    }
    $query = ReadFiletext($newfile);
    DelFiletext($newfile);
    if (!$query) {
        printerror("EmptyRunSql", "history.go(-1)");
    }
    //数据库
    if ($add['mydbname']) {
        $empire->query("use `" . $add['mydbname'] . "`");
    }
    //编码
    if ($add['mydbchar']) {
        DoSetDbChar($add['mydbchar']);
    }
    Ebak_DoRunQuery($query, $add['mydbchar'], $phome_db_ver);
    printerror("RunSqlSuccess", "DoSql.php");
}
예제 #6
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;
}
예제 #7
0
    <td width="4%"><div align="center"></div></td>
    <td width="8%"><div align="center">ID</div></td>
    <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'];
예제 #8
0
    <td width="4%">&nbsp;</td>
    <td width="8%">
<div align="center">ID</div></td>
    <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>
  <?php 
while ($r = $empire->fetch($sql)) {
    $filesize = ChTheFilesize($r[filesize]);
    //取得文件类型
    $truefiletype = GetFiletype($r[filename]);
    $filetype = substr($truefiletype, 1);
    //文件
    $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
    $filepath = $r[path] ? $r[path] . '/' : $r[path];
    $file = $fspath['fileurl'] . $filepath . $r[filename];
    $buttonr = ToReturnDoFileButton($doing, $tranfrom, $field, $file, $r[filename], $r[fileid], $filesize, $truefiletype, $r[no], $type);
    $button = $buttonr['button'];
    $buttonurl = $buttonr['bturl'];
    ?>
  <tr> 
    <td bgcolor="#FFFFFF"><div align="center"> 
        <input type=checkbox name=fileid[] value="<?php 
    echo $r[fileid];
    ?>
">
예제 #9
0
function LoadInMod($add, $file, $file_name, $file_type, $file_size, $userid, $username)
{
    global $empire, $dbtbpre, $phome_db_dbchar;
    //验证权限
    CheckLevel($userid, $username, $classid, "table");
    $tbname = RepPostVar(trim($add['tbname']));
    if (!$file_name || !$file_size || !$tbname) {
        printerror("EmptyLoadInMod", "");
    }
    //扩展名
    $filetype = GetFiletype($file_name);
    if ($filetype != ".mod") {
        printerror("LoadInModMustmod", "");
    }
    //表名是否已存在
    $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewstable where tbname='{$tbname}' limit 1");
    if ($num) {
        printerror("HaveLoadInTb", "");
    }
    //上传文件
    $path = ECMS_PATH . "e/data/tmp/mod/uploadm" . time() . make_password(10) . ".php";
    $cp = @move_uploaded_file($file, $path);
    if (!$cp) {
        printerror("EmptyLoadInMod", "");
    }
    DoChmodFile($path);
    @(include $path);
    UpdateTbDefMod($tid, $tbname, $mid);
    //公共变量
    TogSaveTxtF(1);
    GetConfig(1);
    //更新缓存
    //生成模型表单文件
    $modr = $empire->fetch1("select mtemp,qmtemp,cj from {$dbtbpre}enewsmod where mid='{$mid}'");
    ChangeMForm($mid, $tid, $modr[mtemp]);
    //更新表单
    ChangeQmForm($mid, $tid, $modr[qmtemp]);
    //更新前台表单
    ChangeMCj($mid, $tid, $modr[cj]);
    //采集表单
    //删除文件
    DelFiletext($path);
    //操作日志
    insert_dolog("tid={$tid}&tb={$tbname}<br>mid={$mid}");
    printerror("LoadInModSuccess", "db/ListTable.php");
}
예제 #10
0
파일: tempfun.php 프로젝트: novnan/meiju
function LoadInTempGroup($add, $file, $file_name, $file_type, $file_size, $userid, $username)
{
    global $empire, $dbtbpre;
    //验证权限
    CheckLevel($userid, $username, $classid, "tempgroup");
    if (!$file_name || !$file_size) {
        printerror("EmptyLoadInTempGroup", "");
    }
    $gid = (int) $add['gid'];
    //扩展名
    $filetype = GetFiletype($file_name);
    if ($filetype != ".temp") {
        printerror("LoadInTempGroupMusttemp", "");
    }
    //上传文件
    $path = ECMS_PATH . DASHBOARD . '/data/tmp/temp/uploadtg' . time() . make_password(10) . '.temp';
    $cp = @move_uploaded_file($file, $path);
    DoChmodFile($path);
    $data = ReadFiletext($path);
    DelFiletext($path);
    //转码
    if ($add['ChangeChar']) {
        $data = LoadInTempChangeChar($add['tempchar'], $data);
    }
    if (empty($data)) {
        printerror("EmptyLoadInTempGroup", "");
    }
    //返回版本
    $pageexp = "<!---ecms.temp--->";
    $checkpr = explode($pageexp, $data);
    $tempverr = LoadInTGReturnVer($checkpr[0]);
    $gname = $tempverr['gname'];
    $thistempver = $tempverr['ver'];
    $thistempchar = $tempverr['tempchar'];
    //替换旧地址
    $GLOBALS['loadtempver'] = $thistempver;
    if (empty($thistempver)) {
        $data = LoadInTGReptext_pubvar($data);
    }
    //入库
    $pageexp = "<!---ecms.temp--->";
    $record = "<!---ecms.record--->";
    $field = "<!---ecms.field--->";
    $pr = explode($pageexp, $data);
    if (empty($gid)) {
        $sql = $empire->query("insert into {$dbtbpre}enewstempgroup(gname,isdefault) values('" . addslashes($gname) . "',0);");
        $gid = $empire->lastid();
        $gname = $pr[0];
        $en = "_" . $gid;
        CreateTempTb($gid, $en);
        //复制表
    } else {
        $r = $empire->fetch1("select gid,gname from {$dbtbpre}enewstempgroup where gid={$gid}");
        if (!$r['gid']) {
            printerror("LoadInTempGroupMusttemp", "");
        }
        if ($gid == 1) {
            $en = "";
        } else {
            $en = "_" . $gid;
        }
        $gname = $r['gname'];
        ClearTempTb($gid, $en);
        //清空表
    }
    //版本
    $isold = 0;
    $ckcount = count($pr);
    if ($ckcount <= 10) {
        $isold = 1;
    } elseif ($ckcount <= 11) {
        $isold = 2;
    }
    LoadInTGBqtemp($gid, $en, $record, $field, $pr[1]);
    //标签模板
    LoadInTGJstemp($gid, $en, $record, $field, $pr[2]);
    //JS模板
    LoadInTGListtemp($gid, $en, $record, $field, $pr[3]);
    //列表模板
    LoadInTGNewstemp($gid, $en, $record, $field, $pr[4]);
    //内容模板
    LoadInTGPubtemp($gid, $en, $record, $field, $pr[5], $isold);
    //公共模板
    LoadInTGSearchtemp($gid, $en, $record, $field, $pr[6]);
    //搜索模板
    LoadInTGTempvar($gid, $en, $record, $field, $pr[7]);
    //模板变量
    LoadInTGVotetemp($gid, $en, $record, $field, $pr[8]);
    //投票模板
    LoadInTGClasstemp($gid, $en, $record, $field, $pr[9]);
    //栏目模板
    if ($isold != 1) {
        LoadInTGPltemp($gid, $en, $record, $field, $pr[10]);
        //评论模板
    }
    if ($isold == 0) {
        LoadInTGPrinttemp($gid, $en, $record, $field, $pr[11]);
        //打印模板
    }
    LoadInTGPagetemp($gid, $en, $record, $field, $pr[12]);
    //自定义页面模板
    //操作日志
    insert_dolog("gid={$gid}&gname={$gname}");
    printerror("LoadInTempGroupSuccess", "TempGroup.php" . hReturnEcmsHashStrHref2(1));
}
예제 #11
0
파일: qinfofun.php 프로젝트: novnan/meiju
function DoQTranFile($add, $file, $file_name, $file_type, $file_size, $userid, $username, $rnd, $ecms = 0)
{
    global $empire, $dbtbpre, $class_r, $public_r, $ecms_config;
    if ($public_r['addnews_ok']) {
        $ecms != 1 ? printerror("NotOpenCQInfo", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotOpenCQInfo', '', '');
    }
    $filepass = (int) $add['filepass'];
    $classid = (int) $add['classid'];
    $infoid = (int) $add['infoid'];
    if (!$file_name || !$filepass || !$classid || !$class_r[$classid][tbname]) {
        $ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
    }
    //信息
    if ($infoid) {
        $index_r = $empire->fetch1("select classid,checked from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . "_index where id='{$infoid}'");
        if (!$index_r['classid'] || $classid != $index_r['classid']) {
            $ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
        }
        $infotb = ReturnInfoMainTbname($class_r[$classid][tbname], $index_r['checked']);
        $infor = $empire->fetch1("select classid,fstb from " . $infotb . " where id='{$infoid}'");
        if (!$infor['fstb'] || $classid != $infor['classid']) {
            $ecms != 1 ? printerror("EmptyQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'EmptyQTranFile', '', '');
        }
        $fstb = $infor['fstb'];
    } else {
        $fstb = $public_r['filedeftb'];
    }
    //验证权限
    $userid = (int) $userid;
    $username = RepPostVar($username);
    $rnd = RepPostVar($rnd);
    DoQCheckAddLevel($classid, $userid, $username, $rnd, 0, 0);
    $filetype = GetFiletype($file_name);
    //取得文件类型
    if (CheckSaveTranFiletype($filetype)) {
        $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
    }
    $type = (int) $add['type'];
    $pr = $empire->fetch1("select qaddtran,qaddtransize,qaddtranimgtype,qaddtranfile,qaddtranfilesize,qaddtranfiletype from {$dbtbpre}enewspublic limit 1");
    if ($type == 1) {
        if (!$pr['qaddtran']) {
            $ecms != 1 ? printerror("CloseQTranPic", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranPic', '', '');
        }
        if (!strstr($pr['qaddtranimgtype'], "|" . $filetype . "|")) {
            $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
        }
        if ($file_size > $pr['qaddtransize'] * 1024) {
            $ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
        }
        if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) {
            $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
        }
    } elseif ($type == 2) {
        if (!$pr['qaddtranfile']) {
            $ecms != 1 ? printerror("CloseQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranFile', '', '');
        }
        if (!strstr($pr['qaddtranfiletype'], "|" . $filetype . "|")) {
            $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
        }
        if ($file_size > $pr['qaddtranfilesize'] * 1024) {
            $ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
        }
        if (!strstr($ecms_config['sets']['tranflashtype'], ',' . $filetype . ',')) {
            $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
        }
    } else {
        if (!$pr['qaddtranfile']) {
            $ecms != 1 ? printerror("CloseQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'CloseQTranFile', '', '');
        }
        if (!strstr($pr['qaddtranfiletype'], "|" . $filetype . "|")) {
            $ecms != 1 ? printerror("NotQTranFiletype", "", 9) : ECMS_QEditorPrintError(1, '', '', 'NotQTranFiletype', '', '');
        }
        if ($file_size > $pr['qaddtranfilesize'] * 1024) {
            $ecms != 1 ? printerror("TooBigQTranFile", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TooBigQTranFile', '', '');
        }
    }
    $r = DoTranFile($file, $file_name, $file_type, $file_size, $classid);
    if (empty($r[tran])) {
        $ecms != 1 ? printerror("TranFail", "", 9) : ECMS_QEditorPrintError(1, '', '', 'TranFail', '', '');
    }
    //写入数据库
    $filetime = time();
    $r[filesize] = (int) $r[filesize];
    $classid = (int) $classid;
    eInsertFileTable($r[filename], $r[filesize], $r[filepath], '[Member]' . $username, $classid, $r[filename], $type, $filepass, $filepass, $public_r[fpath], 0, 0, $fstb);
    //编辑器
    if ($ecms == 1) {
        ECMS_QEditorPrintError(0, $r[url], $r[filename], '', $r[filename], $r[filesize]);
    } else {
        echo "<script>opener.document.add." . $add['field'] . ".value='" . $r['url'] . "';window.close();</script>";
    }
    db_close();
    $empire = null;
    exit;
}
예제 #12
0
                $have_fen = 1;
            }
        }
    }
}
//验证码
$ip = egetip();
$pass = md5(ReturnDownSysCheckIp() . "wm_chief" . $public_r[downpass] . $user[userid]);
$op = GetOnlinePass();
$url = "../../enews/?enews=GetSofturl&classid={$classid}&id={$id}&pathid={$pathid}&pass="******"&p=" . $user[userid] . ":::" . $user[rnd] . "&onlinetime=" . $op[0] . "&onlinepass="******"wm_chief";
//自动识别播放器
if (empty($r[playerid])) {
    $ftype = GetFiletype($showdown_r[1]);
    if ($ftype == '.swf') {
        @(include "flasher.php");
    } elseif ($ftype == '.flv') {
        @(include "flver.php");
    } elseif (strstr($realplayertype, ',' . $ftype . ',')) {
        @(include "realplayer.php");
    } else {
        @(include "mediaplayer.php");
    }
} else {
    $playerr = $empire->fetch1("select filename from {$dbtbpre}enewsplayer where id='{$r['playerid']}'");
    if ($playerr['filename']) {
        @(include $playerr[filename]);
    }
}
예제 #13
0
파일: functions.php 프로젝트: novnan/meiju
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;
    }
}
예제 #14
0
파일: filefun.php 프로젝트: novnan/meiju
function TranMoreFile($file, $file_name, $file_type, $file_size, $no, $type, $userid, $username)
{
    global $empire, $public_r, $dbtbpre;
    $count = count($file_name);
    if (empty($count)) {
        printerror("MustChangeTranOneFile", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "file");
    $type = (int) $type;
    for ($i = 0; $i < $count; $i++) {
        if (empty($file_name[$i])) {
            continue;
        }
        //取得文件类型
        $filetype = GetFiletype($file_name[$i]);
        //如果是.php文件
        if (CheckSaveTranFiletype($filetype)) {
            continue;
        }
        $type_r = explode("|" . $filetype . "|", $public_r['filetype']);
        if (count($type_r) < 2) {
            continue;
        }
        if ($file_size[$i] > $public_r['filesize'] * 1024) {
            continue;
        }
        //上传
        $r = DoTranFile($file[$i], $file_name[$i], $file_type[$i], $file_size[$i], $classid);
        //写入数据库
        $r[filesize] = (int) $r[filesize];
        $classid = (int) $classid;
        if (empty($no[$i])) {
            $no[$i] = $file_name[$i];
        }
        eInsertFileTable($r[filename], $r[filesize], $r[filepath], $username, $classid, $no[$i], $type, 0, 0, $public_r[fpath], 0, 5, 0);
    }
    insert_dolog("");
    //操作日志
    printerror("TranMoreFileSuccess", "file/TranMoreFile.php" . hReturnEcmsHashStrHref2(1));
}
예제 #15
0
파일: connect.php 프로젝트: novnan/meiju
function DoTranUrl($url, $classid)
{
    global $public_r, $class_r, $ecms_config, $efileftp_fr;
    $classid = (int) $classid;
    //处理地址
    $url = trim($url);
    $url = str_replace(" ", "%20", $url);
    $r[tran] = 1;
    //附件地址
    $r[url] = $url;
    //文件类型
    $r[filetype] = GetFiletype($url);
    if (CheckSaveTranFiletype($r[filetype])) {
        $r[tran] = 0;
        return $r;
    }
    //是否已上传的文件
    $havetr = CheckNotSaveUrl($url);
    if ($havetr) {
        $r[tran] = 0;
        return $r;
    }
    //是否地址
    if (!strstr($url, '://')) {
        $r[tran] = 0;
        return $r;
    }
    $string = ReadFiletext($url);
    if (empty($string)) {
        $r[tran] = 0;
        return $r;
    }
    //文件名
    $r[insertfile] = ReturnDoTranFilename($file_name, $classid);
    $r[filename] = $r[insertfile] . $r[filetype];
    //日期目录
    $r[filepath] = FormatFilePath($classid, $mynewspath, 0);
    $filepath = $r[filepath] ? $r[filepath] . '/' : $r[filepath];
    //存放目录
    $fspath = ReturnFileSavePath($classid);
    $r[savepath] = eReturnEcmsMainPortPath() . $fspath['filepath'] . $filepath;
    //moreport
    //附件地址
    $r[url] = $fspath['fileurl'] . $filepath . $r[filename];
    //缩图文件
    $r[name] = $r[savepath] . "small" . $r[insertfile];
    //附件文件
    $r[yname] = $r[savepath] . $r[filename];
    WriteFiletext_n($r[yname], $string);
    $r[filesize] = @filesize($r[yname]);
    //返回类型
    if (strstr($ecms_config['sets']['tranflashtype'], ',' . $r[filetype] . ',')) {
        $r[type] = 2;
    } elseif (strstr($ecms_config['sets']['tranpicturetype'], ',' . $r[filetype] . ',')) {
        $r[type] = 1;
    } elseif (strstr($ecms_config['sets']['mediaplayertype'], ',' . $r[filetype] . ',') || strstr($ecms_config['sets']['realplayertype'], ',' . $r[filetype] . ',')) {
        $r[type] = 3;
    } else {
        $r[type] = 0;
    }
    //FileServer
    if ($public_r['openfileserver']) {
        $efileftp_fr[] = $r['yname'];
    }
    return $r;
}
예제 #16
0
파일: cjfun.php 프로젝트: novnan/meiju
function LoadInCj($add, $file, $file_name, $file_type, $file_size, $userid, $username)
{
    global $empire, $dbtbpre;
    $lineexp = '<!-#-|-line-|-#-!>';
    $recordexp = '<!-#-|-record-|-#-!>';
    $fieldexp = '<!-#-|-field-|-#-!>';
    $sfieldexp = '<!-#-|-smallfield-|-#-!>';
    //验证权限
    CheckLevel($userid, $username, $classid, "loadcj");
    $classid = (int) $add['classid'];
    if (!$classid) {
        printerror("EmptyLoadInCjFile", "history.go(-1)");
    }
    $cr = $empire->fetch1("select classid,islast,tid,tbname from {$dbtbpre}enewsclass where classid='{$classid}' and islast=1");
    if (!$cr['classid']) {
        printerror("LoadInCjMustLastClass", "history.go(-1)");
    }
    if (!$file_name || !$file_size) {
        printerror("EmptyLoadInCjFile", "history.go(-1)");
    }
    //扩展名
    $filetype = GetFiletype($file_name);
    if ($filetype != ".cj") {
        printerror("LoadInCjErrorfiletype", "history.go(-1)");
    }
    $path = ECMS_PATH . DASHBOARD . '/data/tmp/cj/uploadcj' . time() . '.cj';
    //上传文件
    $cp = @move_uploaded_file($file, $path);
    DoChmodFile($path);
    $data = ReadFiletext($path);
    DelFiletext($path);
    $r = explode($recordexp, $data);
    $empirecmsver = $r[0];
    $mainstr = $r[1];
    $datafield = $r[2];
    $datastr = $r[3];
    if (empty($mainstr)) {
        printerror("EmptyLoadInCjFile", "history.go(-1)");
    }
    //主表
    $infoclassid = LoadInCjInsertMainstr($classid, $cr['tid'], $cr['tbname'], $mainstr, $fieldexp, $sfieldexp);
    //副表
    LoadInCjInsertDatastr($classid, $cr['tid'], $cr['tbname'], $infoclassid, $datafield, $datastr, $fieldexp, $sfieldexp);
    $cjr = $empire->fetch1("select classname from {$dbtbpre}enewsinfoclass where classid='{$infoclassid}'");
    //操作日志
    insert_dolog("classid=" . $infoclassid . "<br>classname=" . $cjr[classname]);
    printerror("LoadInCjSuccess", "cj/LoadInCj.php?from=" . ehtmlspecialchars($_POST[from]) . hReturnEcmsHashStrHref2(0));
}
예제 #17
0
파일: editorfun.php 프로젝트: novnan/meiju
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', '', '');
    }
}
예제 #18
0
function sys_ResizeImg($file,$width,$height,$docut=0,$target_filename='',$target_path='e/data/tmp/titlepic/'){
	global $public_r,$ecms_config;
	if(!$file||!$width||!$height)
	{
		return $file;
	}
	//扩展名
	$filetype=GetFiletype($file);
	if(!strstr($ecms_config['sets']['tranpicturetype'],','.$filetype.','))
	{
		return $file;
	}
	$efileurl=eReturnFileUrl();
	if(strstr($file,$efileurl))
	{
		$file=str_replace($efileurl,'/data/',$file);
	}
	if(strstr($file,'://'))
	{
		return $file;
	}
	$filename=eReturnEcmsMainPortPath().substr($file,1);//moreport
	if(!file_exists($filename))
	{
		return $file;
	}
	if($target_filename)
	{
		$newfilename=$target_filename;
	}
	else
	{
		$newfilename=md5($file.'-'.$width.'-'.$height.'-'.$docut);
	}
	$newpath=ECMS_PATH.$target_path;
	$newurl=$public_r['newsurl'].$target_path;
	$newname=$newpath.$newfilename;
	if(empty($target_filename)&&file_exists($newname.$filetype))
	{
		return $newurl.$newfilename.$filetype;
	}
	if(!defined('InEmpireCMSGd'))
	{
		include_once ECMS_PATH.DASHBOARD.'/class/gd.php';
	}
	$filer=ResizeImage($filename,$newname,$width,$height,$docut);
	$fileurl=$newurl.$newfilename.$filer['filetype'];
	return $fileurl;
}
예제 #19
0
$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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>²Ã¼ôͼƬ£º<?php 
echo $filer['no'];
?>
 (<?php 
예제 #20
0
파일: DownSysFun.php 프로젝트: novnan/meiju
function GetSofturl($classid, $id, $pathid, $p, $pass, $onlinetime, $onlinepass)
{
    global $empire, $dbtbpre, $public_r, $class_r, $emod_r, $level_r, $ecms_config;
    //验证IP
    eCheckAccessDoIp('onlineinfo');
    $classid = (int) $classid;
    $id = (int) $id;
    $pathid = (int) $pathid;
    $onlinetime = (int) $onlinetime;
    $p = RepPostVar($p);
    if (!$classid || empty($id) || empty($p)) {
        exit;
    }
    $p_r = explode(":::", $p);
    $userid = $p_r[0];
    $rnd = $p_r[1];
    //验证码
    $cpass = md5(ReturnDownSysCheckIp() . "wm_chief" . $public_r[downpass] . $userid);
    if ($cpass != $pass) {
        exit;
    }
    //验证验证码
    CheckOnlinePass($onlinetime, $onlinepass);
    //表不存在
    if (empty($class_r[$classid][tbname])) {
        exit;
    }
    $mid = $class_r[$classid][modid];
    $tbname = $class_r[$classid][tbname];
    $r = $empire->fetch1("select * from {$dbtbpre}ecms_" . $tbname . " where id='{$id}' limit 1");
    if (empty($r['id']) || $r['classid'] != $classid) {
        exit;
    }
    //副表
    $finfor = $empire->fetch1("select " . ReturnSqlFtextF($mid) . " from {$dbtbpre}ecms_" . $tbname . "_data_" . $r[stb] . " where id='{$r['id']}' limit 1");
    $r = array_merge($r, $finfor);
    //区分下载地址
    $path_r = explode("\r\n", $r[onlinepath]);
    if (!$path_r[$pathid]) {
        exit;
    }
    $showdown_r = explode("::::::", $path_r[$pathid]);
    $downgroup = $showdown_r[2];
    //下载权限
    if ($downgroup) {
        $userid = (int) $userid;
        $rnd = RepPostVar($rnd);
        //取得会员资料
        $u = $empire->fetch1("select " . eReturnSelectMemberF('*') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}' and " . egetmf('rnd') . "='{$rnd}' limit 1");
        if (empty($u['userid'])) {
            exit;
        }
        //下载次数限制
        $setuserday = "";
        if ($level_r[$u['groupid']]['daydown']) {
            $setuserday = DoCheckMDownNum($userid, $u['groupid'], 1);
        }
        if ($level_r[$downgroup][level] > $level_r[$u[groupid]][level]) {
            exit;
        }
        //点数是否足够
        $showdown_r[3] = intval($showdown_r[3]);
        if ($showdown_r[3]) {
            //---------是否有历史记录
            $bakr = $empire->fetch1("select id,truetime from {$dbtbpre}enewsdownrecord where id='{$id}' and classid='{$classid}' and userid='{$userid}' and pathid='{$pathid}' and online=1 order by truetime desc limit 1");
            if ($bakr[id] && time() - $bakr[truetime] <= $public_r[redodown] * 3600) {
            } else {
                //包月卡
                if ($u['userdate'] - time() > 0) {
                } else {
                    if ($showdown_r[3] > $u['userfen']) {
                        exit;
                    }
                    //去除点数
                    $usql = $empire->query("update " . eReturnMemberTable() . " set " . egetmf('userfen') . "=" . egetmf('userfen') . "-" . $showdown_r[3] . " where " . egetmf('userid') . "='{$userid}'");
                }
                //备份下载记录
                $utfusername = $u['username'];
                BakDown($classid, $id, $pathid, $userid, $utfusername, $r[title], $showdown_r[3], 1);
            }
        }
        //更新用户下载次数
        if ($setuserday) {
            $usql = $empire->query($setuserday);
        }
    }
    //总下载数据增一
    $usql = $empire->query("update {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " set totaldown=totaldown+1 where id='{$id}'");
    //选择播放器
    $ftype = GetFiletype($showdown_r[1]);
    if (strstr($ecms_config['sets']['realplayertype'], ',' . $ftype . ',')) {
        Header("Content-Type: audio/x-pn-realaudio");
    } else {
        Header("Content-Type: video/x-ms-asf");
    }
    $downurl = stripSlashes($showdown_r[1]);
    $downurlr = ReturnDownQzPath($downurl, $showdown_r[4]);
    $downurl = $downurlr['repath'];
    //防盗链
    @(include ECMS_PATH . DASHBOARD . "/DownSys/class/enpath.php");
    $downurl = DoEnOnlinepath($downurl);
    db_close();
    $empire = null;
    echo $downurl;
    exit;
}
예제 #21
0
function sys_ResizeImg($file, $width, $height, $docut = 0, $target_filename = '')
{
    global $public_r, $tranpicturetype;
    if (!$file || !$width || !$height) {
        return $file;
    }
    //扩展名
    $filetype = GetFiletype($file);
    if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
        return $file;
    }
    $efileurl = eReturnFileUrl();
    if (strstr($file, $efileurl)) {
        $file = str_replace($efileurl, '/d/file/', $file);
    }
    if (strstr($file, '://')) {
        return $file;
    }
    $filename = ECMS_PATH . substr($file, 1);
    if (!file_exists($filename)) {
        return $file;
    }
    if ($target_filename) {
        $newfilename = $target_filename;
    } else {
        $newfilename = md5($file . '-' . $width . '-' . $height . '-' . $docut);
    }
    $newname = ECMS_PATH . 'e/data/tmp/titlepic/' . $newfilename;
    if (empty($target_filename) && file_exists($newname . $filetype)) {
        return $public_r['newsurl'] . 'e/data/tmp/titlepic/' . $newfilename . $filetype;
    }
    if (!defined('InEmpireCMSGd')) {
        include_once ECMS_PATH . 'e/class/gd.php';
    }
    $filer = ResizeImage($filename, $newname, $width, $height, $docut);
    $fileurl = $public_r['newsurl'] . 'e/data/tmp/titlepic/' . $newfilename . $filer['filetype'];
    return $fileurl;
}
예제 #22
0
 $pathfile = $openpath . "/" . $file;
 if (is_dir($pathfile)) {
     $filelink = "'FilePath.php?filepath=" . $truefile . "'";
     $filename = $file;
     $img = "../../data/images/dir/folder.gif";
     $checkbox = "";
     $target = "";
     //发布时间
     $ftime = @filemtime($pathfile);
     $filetime = date("Y-m-d H:i:s", $ftime);
     $filesize = '<目录>';
     $filetype = '文件夹';
 } else {
     $filelink = "'../../../d/file/" . $truefile . "'";
     $filename = $file;
     $ftype = GetFiletype($file);
     $img = '../../data/images/dir/' . substr($ftype, 1, strlen($ftype)) . "_icon.gif";
     if (!file_exists($img)) {
         $img = '../../data/images/dir/unknown_icon.gif';
     }
     $checkbox = "<input name='filename[]' type='checkbox' value='" . $truefile . "'>";
     $target = " target='_blank'";
     //发布时间
     $ftime = @filemtime($pathfile);
     $filetime = date("Y-m-d H:i:s", $ftime);
     //文件大小
     $fsize = @filesize($pathfile);
     $filesize = ChTheFilesize($fsize);
     //文件类型
     if (strstr($tranpicturetype, ',' . $ftype . ',')) {
         $filetype = '图片';
예제 #23
0
function ReturnDoMemberF($fid, $add, $mr, $ecms = 0, $username = '', $admin = 0)
{
    global $empire, $dbtbpre, $tranpicturetype, $public_r;
    $pr = $empire->fetch1("select openmembertranimg,memberimgsize,memberimgtype,openmembertranfile,memberfilesize,memberfiletype from {$dbtbpre}enewspublic limit 1");
    $formr = $empire->fetch1("select fid,enter,mustenter,filef,imgf,canaddf,caneditf,checkboxf from {$dbtbpre}enewsmemberform where fid='{$fid}'");
    //检测必填字段
    $mustr = explode(",", $formr['mustenter']);
    $mustcount = count($mustr);
    for ($i = 1; $i < $mustcount - 1; $i++) {
        $mf = $mustr[$i];
        if (strstr($formr['filef'], "," . $mf . ",") || strstr($formr['imgf'], "," . $mf . ",")) {
            $mfilef = $mf . "file";
            //上传文件
            if ($_FILES[$mfilef]['name']) {
                if (strstr($formr['imgf'], "," . $mf . ",")) {
                    if (!$pr['openmembertranimg']) {
                        printerror("CloseQTranPic", "", 1);
                    }
                } else {
                    if (!$pr['openmembertranfile']) {
                        printerror("CloseQTranFile", "", 1);
                    }
                }
            } elseif (!trim($add[$mf]) && !$mr[$mf]) {
                printerror("EmptyQMustF", "", 1);
            }
        } else {
            $chmustval = ReturnMCheckboxAddF($add[$mf], $mf, $formr['checkboxf']);
            if (!trim($chmustval)) {
                printerror("EmptyQMustF", "", 1);
            }
        }
    }
    //字段处理
    $dh = "";
    $tranf = "";
    $record = "<!--record-->";
    $field = "<!--field--->";
    $fr = explode($record, $formr['enter']);
    $count = count($fr);
    for ($i = 0; $i < $count - 1; $i++) {
        $fr1 = explode($field, $fr[$i]);
        $f = $fr1[1];
        if ($admin == 0 && ($ecms == 0 && !strstr($formr['canaddf'], ',' . $f . ',') || $ecms == 1 && !strstr($formr['caneditf'], ',' . $f . ','))) {
            continue;
        }
        //附件
        $add[$f] = str_replace('[!#@-', '', $add[$f]);
        if (strstr($formr['filef'], "," . $f . ",") || strstr($formr['imgf'], "," . $f . ",")) {
            //上传附件
            $filetf = $f . "file";
            if ($_FILES[$filetf]['name']) {
                $filetype = GetFiletype($_FILES[$filetf]['name']);
                //取得文件类型
                if (CheckSaveTranFiletype($filetype)) {
                    printerror("NotQTranFiletype", "", 1);
                }
                if (strstr($formr['imgf'], "," . $f . ",")) {
                    if (!$pr['openmembertranimg']) {
                        printerror("CloseQTranPic", "", 1);
                    }
                    if (!strstr($pr['memberimgtype'], "|" . $filetype . "|")) {
                        printerror("NotQTranFiletype", "", 1);
                    }
                    if ($_FILES[$filetf]['size'] > $pr['memberimgsize'] * 1024) {
                        printerror("TooBigQTranFile", "", 1);
                    }
                    if (!strstr($tranpicturetype, ',' . $filetype . ',')) {
                        printerror("NotQTranFiletype", "", 1);
                    }
                } else {
                    if (!$pr['openmembertranfile']) {
                        printerror("CloseQTranFile", "", 1);
                    }
                    if (!strstr($pr['memberfiletype'], "|" . $filetype . "|")) {
                        printerror("NotQTranFiletype", "", 1);
                    }
                    if ($_FILES[$filetf]['size'] > $pr['memberfilesize'] * 1024) {
                        printerror("TooBigQTranFile", "", 1);
                    }
                }
                $tranf .= $dh . $f;
                $dh = ",";
                $fval = "[!#@-" . $f . "-@!]";
            } else {
                $fval = $add[$f];
                if ($ecms == 1 && $mr[$f] && !trim($fval)) {
                    $fval = $mr[$f];
                }
            }
        } else {
            $add[$f] = ReturnMCheckboxAddF($add[$f], $f, $formr['checkboxf']);
            $fval = $add[$f];
        }
        $fval = DoMemberFValue($fval);
        $fval = RepPostStr2($fval);
        $fval = addslashes($fval);
        if ($ecms == 0) {
            $ret_r[0] .= ",`" . $f . "`";
            $ret_r[1] .= ",'" . $fval . "'";
        } else {
            $ret_r[0] .= ",`" . $f . "`='" . $fval . "'";
        }
    }
    //上传附件
    if ($tranf) {
        $infoid = 0;
        $filepass = 0;
        $classid = 0;
        $tranr = explode(",", $tranf);
        $count = count($tranr);
        for ($i = 0; $i < $count; $i++) {
            $tf = $tranr[$i];
            $tffile = $tf . "file";
            $tfr = DoTranFile($_FILES[$tffile]['tmp_name'], $_FILES[$tffile]['name'], $_FILES[$tffile]['type'], $_FILES[$tffile]['size'], $classid);
            if ($tfr['tran']) {
                if (strstr($formr['imgf'], "," . $tf . ",")) {
                    $type = 1;
                } else {
                    $type = 0;
                }
                //写入数据库
                $filetime = date("Y-m-d H:i:s");
                $filesize = (int) $_FILES[$tffile]['size'];
                $sql = $empire->query("insert into {$dbtbpre}enewsfile(filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,fpath) values('{$tfr['filename']}',{$filesize},'[EditInfo]" . $username . "','{$tfr['filepath']}','{$filetime}',{$classid},'Member[" . $tf . "]',{$type},{$infoid},{$filepass},'{$public_r['fpath']}');");
                //删除旧文件
                if ($ecms == 1 && $mr[$tf]) {
                    DelYMemberTranFile($mr[$tf], $tf, $username);
                }
                $repfval = $tfr['url'];
            } else {
                $repfval = $mr[$tf];
            }
            if ($ecms == 0) {
                $ret_r[1] = str_replace("[!#@-" . $tf . "-@!]", $repfval, $ret_r[1]);
            } else {
                $ret_r[0] = str_replace("[!#@-" . $tf . "-@!]", $repfval, $ret_r[0]);
            }
        }
    }
    return $ret_r;
}
예제 #24
0
    <td height="25">FLASH</td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <tr class="header"> 
    <td width="4%"><div align="center"></div></td>
    <td width="8%"><div align="center">ID</div></td>
    <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>
  <?php 
while ($r = $empire->fetch($sql)) {
    $filesize = ChTheFilesize($r[filesize]);
    $filetype = substr(GetFiletype($r[filename]), 1);
    //取得文件类型
    //文件
    $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
    $filepath = $r[path] ? $r[path] . '/' : $r[path];
    $file = $fspath['fileurl'] . $filepath . $r[filename];
    $buttonr = ToReturnDoFileButton($doing, $tranfrom, $field, $file, $r[filename], $r[fileid], $filesize, $filetype, $r[no], $type);
    $button = $buttonr['button'];
    $buttonurl = $buttonr['bturl'];
    ?>
  <tr> 
    <td bgcolor="#FFFFFF"><div align="center"> 
        <input type=checkbox name=fileid[] value="<?php 
    echo $r[fileid];
    ?>
">
예제 #25
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);
    }
}
예제 #26
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', '', '');
    }
}