Example #1
0
function QDownLoadFile($file)
{
    global $public_r;
    if (strstr($file, "\\")) {
        $exp = "\\";
    } elseif (strstr($file, "/")) {
        $exp = "/";
    } else {
        Header("Location:{$file}");
        exit;
    }
    if (strstr($file, $exp . "e" . $exp) || strstr($file, "..") || strstr($file, "?") || strstr($file, "#")) {
        Header("Location:{$file}");
        exit;
    }
    $efileurl = eReturnFileUrl();
    if (strstr($file, $efileurl)) {
        $file = str_replace($efileurl, '/data/', $file);
    }
    if (!strstr($file, "://")) {
        if (!file_exists($file)) {
            $file = eReturnEcmsMainPortPath() . substr($file, 1);
        }
    }
    $filename = GetDownurlFilename($file, $exp);
    if (empty($filename)) {
        Header("Location:{$file}");
        exit;
    }
    //下载
    Header("Content-type: application/octet-stream");
    //Header("Accept-Ranges: bytes");
    //Header("Accept-Length: ".$filesize);
    Header("Content-Disposition: attachment; filename=" . $filename);
    echo ReadFiletext($file);
}
Example #2
0
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;
}
Example #3
0
$filepass=(int)$_GET['filepass'];
$type=(int)$_GET['type'];
$modtype=(int)$_GET['modtype'];
$fstb=(int)$_GET['fstb'];
$doing=(int)$_GET['doing'];
$field=RepPostVar($_GET['field']);
$tranfrom=ehtmlspecialchars($_GET['tranfrom']);
$fileno=ehtmlspecialchars($_GET['fileno']);
if(empty($field))
{
	$field="ecms";
}
$search="&classid=$classid&infoid=$infoid&filepass=$filepass&type=$type&modtype=$modtype&fstb=$fstb&doing=$doing&tranfrom=$tranfrom&field=$field&fileno=$fileno".$ecms_hashur['ehref'];

//基目录
$basepath=eReturnEcmsMainPortPath()."/data";//moreport
$filepath=ehtmlspecialchars($_GET['filepath']);
if(strstr($filepath,".."))
{
	$filepath="";
}
$filepath=eReturnCPath($filepath,'');
$openpath=$basepath."/".$filepath;
if(!file_exists($openpath))
{
	$openpath=$basepath;
}
$hand=@opendir($openpath);
db_close();
$empire=null;
?>
Example #4
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;
}
Example #5
0
function DodoInfo($add, $ecms = 0)
{
    global $empire, $public_r, $emod_r, $level_r, $class_r, $dbtbpre, $fun_r;
    //验证来源
    if ($ecms == 0 || $ecms == 1) {
        CheckCanPostUrl();
    }
    //开启投稿
    if ($public_r['addnews_ok']) {
        printerror("CloseQAdd", "", 1);
    }
    //验证本时间允许操作
    eCheckTimeCloseDo('info');
    $classid = (int) $add['classid'];
    $mid = (int) $class_r[$classid]['modid'];
    if (!$mid || !$classid) {
        printerror("EmptyQinfoCid", "", 1);
    }
    $tbname = $emod_r[$mid]['tbname'];
    $qenter = $emod_r[$mid]['qenter'];
    if (!$tbname || !$qenter || $qenter == ',') {
        printerror("ErrorUrl", "history.go(-1)", 1);
    }
    $muserid = (int) getcvar('mluserid');
    $musername = RepPostVar(getcvar('mlusername'));
    $mrnd = RepPostVar(getcvar('mlrnd'));
    //取得栏目信息
    $isadd = 0;
    if ($ecms == 0) {
        $isadd = 1;
    }
    $setuserday = '';
    $cr = DoQCheckAddLevel($classid, $muserid, $musername, $mrnd, $ecms, $isadd);
    $setuserday = $cr['checkaddnumquery'];
    $filepass = (int) $add['filepass'];
    $id = (int) $add['id'];
    $infor = array();
    //组合标题属性
    $titlecolor = RepPostStr(RepPhpAspJspcodeText($add[titlecolor]));
    $titlefont = TitleFont($add[titlefont], $titlecolor);
    $titlecolor = "";
    $titlefont = "";
    $ttid = (int) $add['ttid'];
    $keyboard = addslashes(RepPostStr(trim(DoReplaceQjDh($add[keyboard]))));
    $keyid = '';
    //返回关键字组合
    if ($keyboard && strstr($qenter, ',special.field,')) {
        $keyboard = str_replace('[!--f--!]', 'ecms', $keyboard);
        $keyid = GetKeyid($keyboard, $classid, $id, $class_r[$classid][link_num]);
    }
    //验证码
    $keyvname = 'checkinfokey';
    //moreport
    if (Moreport_ReturnMustDt()) {
        define('ECMS_SELFPATH', eReturnEcmsMainPortPath());
        Moreport_ResetMainTempGid();
    }
    //-----------------增加
    if ($ecms == 0) {
        //时间
        $lasttime = getcvar('lastaddinfotime');
        if ($lasttime) {
            if (time() - $lasttime < $public_r['readdinfotime']) {
                printerror("QAddInfoOutTime", "", 1);
            }
        }
        //验证码
        if ($cr['qaddshowkey']) {
            ecmsCheckShowKey($keyvname, $add['key'], 1);
        }
        //IP发布数限制
        $check_ip = egetip();
        $check_checked = $cr['wfid'] ? 0 : $cr['checkqadd'];
        eCheckIpAddInfoNum($check_ip, $tbname, $mid, $check_checked);
        //返回字段
        $ret_r = ReturnQAddinfoF($mid, $add, $infor, $classid, $filepass, $muserid, $musername, 0);
        $checked = $cr['checkqadd'];
        $havehtml = 0;
        $newspath = date($cr['newspath']);
        $truetime = time();
        $newstime = $truetime;
        $newstempid = $cr['newstempid'];
        $haveaddfen = 0;
        //强制签发
        $isqf = 0;
        if ($cr['wfid']) {
            $checked = 0;
            $isqf = 1;
        }
        //增扣点
        if ($checked && $muserid) {
            AddInfoFen($cr['addinfofen'], $muserid);
            $haveaddfen = 1;
        }
        if (empty($muserid)) {
            $musername = $fun_r['guest'];
        }
        //会员投稿数更新
        if ($setuserday) {
            $empire->query($setuserday);
        }
        //发布时间
        if (!strstr($qenter, ',newstime,')) {
            $ret_r[0] = ",newstime" . $ret_r[0];
            $ret_r[1] = ",'{$newstime}'" . $ret_r[1];
        } else {
            if ($add['newstime']) {
                $newstime = to_time($add['newstime']);
                $newstime = intval($newstime);
            }
        }
        //附加链接参数
        $addecmscheck = empty($checked) ? '&ecmscheck=1' : '';
        //索引表
        $indexsql = $empire->query("insert into {$dbtbpre}ecms_" . $tbname . "_index(classid,checked,newstime,truetime,lastdotime,havehtml) values('{$classid}','{$checked}','{$newstime}','{$truetime}','{$truetime}','{$havehtml}');");
        $id = $empire->lastid();
        //返回表信息
        $infotbr = ReturnInfoTbname($tbname, $checked, $ret_r[4]);
        //主表
        $sql = $empire->query("insert into " . $infotbr['tbname'] . "(id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard" . $ret_r[0] . ") values('{$id}','{$classid}','{$ttid}',0,0,0,'{$newspath}','','" . $muserid . "','" . addslashes($musername) . "',0,0,0,'{$isqf}',1,0,'{$truetime}','{$truetime}','{$havehtml}',0,0,'{$titlefont}','','{$ret_r['4']}','{$public_r['filedeftb']}','{$public_r['pldeftb']}','{$keyboard}'" . $ret_r[1] . ");");
        //副表
        $fsql = $empire->query("insert into " . $infotbr['datatbname'] . "(id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags" . $ret_r[2] . ") values('{$id}','{$classid}','{$keyid}',1,'{$newstempid}',0,'{$haveaddfen}',''" . $ret_r[3] . ");");
        //扣点记录
        if ($haveaddfen) {
            if ($cr['addinfofen'] < 0) {
                BakDown($classid, $id, 0, $muserid, $musername, RepPostStr($add[title]), abs($cr['addinfofen']), 3);
            }
        }
        //签发
        if ($isqf == 1) {
            InfoInsertToWorkflow($id, $classid, $cr['wfid'], $muserid, addslashes($musername));
        }
        //文件命名
        $filename = ReturnInfoFilename($classid, $id, '');
        //信息地址
        $infourl = GotoGetTitleUrl($classid, $id, $newspath, $filename, 0, 0, '');
        $usql = $empire->query("update " . $infotbr['tbname'] . " set filename='{$filename}',titleurl='{$infourl}' where id='{$id}'");
        //修改ispic
        UpdateTheIspic($classid, $id, $checked);
        //修改附件
        if ($filepass) {
            UpdateTheFile($id, $filepass, $classid, $public_r['filedeftb']);
        }
        //更新栏目信息数
        AddClassInfos($classid, '+1', '+1', $checked);
        //更新新信息数
        DoUpdateAddDataNum('info', $class_r[$classid]['tid'], 1);
        //清除验证码
        ecmsEmptyShowKey($keyvname);
        esetcookie("qeditinfo", "", 0);
        //生成页面
        if ($checked && !$cr['showdt']) {
            $titleurl = qAddGetHtml($classid, $id);
        }
        //生成列表
        if ($checked) {
            qAddListHtml($classid, $mid, $cr['qaddlist'], $cr['listdt']);
            //生成上一篇
            if ($cr['repreinfo']) {
                $prer = $empire->fetch1("select * from {$dbtbpre}ecms_" . $tbname . " where id<{$id} and classid='{$classid}' order by id desc limit 1");
                GetHtml($prer['classid'], $prer['id'], $prer, 1);
            }
        }
        if ($sql) {
            $reurl = DoingReturnUrl("AddInfo.php?classid={$classid}&mid={$mid}" . $addecmscheck, $add['ecmsfrom']);
            if ($add['gotoinfourl'] && $checked) {
                if ($cr['showdt'] == 1) {
                    $reurl = $public_r[newsurl] . "e/action/ShowInfo/?classid={$classid}&id={$id}";
                } elseif ($cr['showdt'] == 2) {
                    $rewriter = eReturnRewriteInfoUrl($classid, $id, 1);
                    $reurl = $rewriter['pageurl'];
                } else {
                    $reurl = $titleurl;
                }
            }
            esetcookie("lastaddinfotime", time(), time() + 3600 * 24);
            //设置最后发表时间
            printerror("AddQinfoSuccess", $reurl, 1);
        } else {
            printerror("DbError", "history.go(-1)", 1);
        }
    } elseif ($ecms == 1) {
        if (!$id) {
            printerror("ErrorUrl", "history.go(-1)", 1);
        }
        //检测权限
        $infor = CheckQdoinfo($classid, $id, $muserid, $tbname, $cr['adminqinfo'], 1);
        //检测时间
        if ($public_r['qeditinfotime']) {
            if (time() - $infor['truetime'] > $public_r['qeditinfotime'] * 60) {
                printerror("QEditInfoOutTime", "history.go(-1)", 1);
            }
        }
        $iaddfield = '';
        $addfield = '';
        $faddfield = '';
        //返回字段
        $ret_r = ReturnQAddinfoF($mid, $add, $infor, $classid, $filepass, $muserid, $musername, 1);
        if ($keyboard) {
            $addfield = ",keyboard='{$keyboard}'";
            $faddfield = ",keyid='{$keyid}'";
        }
        //时间
        if (strstr($qenter, ',newstime,')) {
            if ($add['newstime']) {
                $newstime = to_time($add['newstime']);
                $newstime = intval($newstime);
                $iaddfield .= ",newstime='{$newstime}'";
            }
        }
        //修改是否需要审核
        $ychecked = $infor['checked'];
        if ($cr['qeditchecked']) {
            $infor['checked'] = 0;
            $iaddfield .= ",checked=0";
            $relist = 1;
            //删除原页面
            DelNewsFile($infor[filename], $infor[newspath], $infor[classid], $infor[newstext], $infor[groupid]);
        }
        //会员投稿数更新
        if ($setuserday) {
            //$empire->query($setuserday);
        }
        $lastdotime = time();
        //附加链接参数
        $addecmscheck = empty($infor['checked']) ? '&ecmscheck=1' : '';
        //索引表
        $indexsql = $empire->query("update {$dbtbpre}ecms_" . $tbname . "_index set lastdotime={$lastdotime},havehtml=0" . $iaddfield . " where id='{$id}'");
        //返回表信息
        $infotbr = ReturnInfoTbname($tbname, $ychecked, $infor['stb']);
        //主表
        $sql = $empire->query("update " . $infotbr['tbname'] . " set lastdotime={$lastdotime},havehtml=0,ttid='{$ttid}'" . $addfield . $ret_r[0] . " where id={$id} and classid={$classid} and userid='{$muserid}' and ismember=1");
        //副表
        $fsql = $empire->query("update " . $infotbr['datatbname'] . " set classid='{$classid}'" . $faddfield . $ret_r[3] . " where id='{$id}'");
        //修改ispic
        UpdateTheIspic($classid, $id, $ychecked);
        //更新附件
        UpdateTheFileEdit($classid, $id, $infor['fstb']);
        //未审核信息互转
        if ($ychecked != $infor['checked']) {
            MoveCheckInfoData($tbname, $ychecked, $infor['stb'], "id='{$id}'");
            //更新栏目信息数
            if ($infor['checked']) {
                AddClassInfos($classid, '', '+1');
            } else {
                AddClassInfos($classid, '', '-1');
            }
        }
        esetcookie("qeditinfo", "", 0);
        //生成页面
        if ($infor['checked'] && !$cr['showdt']) {
            $titleurl = qAddGetHtml($classid, $id);
        }
        //生成列表
        if ($infor['checked'] || $relist == 1) {
            qAddListHtml($classid, $mid, $cr['qaddlist'], $cr['listdt']);
        }
        //生成上一篇
        if ($cr['repreinfo'] && $infor['checked']) {
            $prer = $empire->fetch1("select * from {$dbtbpre}ecms_" . $tbname . " where id<{$id} and classid='{$classid}' order by id desc limit 1");
            GetHtml($prer['classid'], $prer['id'], $prer, 1);
        }
        if ($sql) {
            $reurl = DoingReturnUrl("ListInfo.php?mid={$mid}" . $addecmscheck, $add['ecmsfrom']);
            if ($add['editgotoinfourl'] && $infor['checked']) {
                if ($cr['showdt'] == 1) {
                    $reurl = $public_r[newsurl] . "e/action/ShowInfo/?classid={$classid}&id={$id}";
                } elseif ($cr['showdt'] == 2) {
                    $rewriter = eReturnRewriteInfoUrl($classid, $id, 1);
                    $reurl = $rewriter['pageurl'];
                } else {
                    $reurl = $titleurl;
                }
            }
            printerror("EditQinfoSuccess", $reurl, 1);
        } else {
            printerror("DbError", "history.go(-1)", 1);
        }
    } elseif ($ecms == 2) {
        if (!$id) {
            printerror("ErrorUrl", "history.go(-1)", 1);
        }
        //检测权限
        $r = CheckQdoinfo($classid, $id, $muserid, $tbname, $cr['adminqinfo'], 2);
        //附加链接参数
        $addecmscheck = empty($r['checked']) ? '&ecmscheck=1' : '';
        //返回表信息
        $infotbr = ReturnInfoTbname($tbname, $r['checked'], $r['stb']);
        $stf = $emod_r[$mid]['savetxtf'];
        $pf = $emod_r[$mid]['pagef'];
        //分页字段
        if ($pf) {
            if (strstr($emod_r[$mid]['tbdataf'], ',' . $pf . ',')) {
                $finfor = $empire->fetch1("select " . $pf . " from " . $infotbr['datatbname'] . " where id='{$id}' limit 1");
                $r[$pf] = $finfor[$pf];
            }
        }
        //存文本
        if ($stf) {
            $newstextfile = $r[$stf];
            $r[$stf] = GetTxtFieldText($r[$stf]);
            //删除文件
            DelTxtFieldText($newstextfile);
        }
        //删除信息文件
        DelNewsFile($r[filename], $r[newspath], $classid, $r[$pf], $r[groupid]);
        $indexsql = $empire->query("delete from {$dbtbpre}ecms_" . $tbname . "_index where id='{$id}'");
        $sql = $empire->query("delete from " . $infotbr['tbname'] . " where id={$id} and classid={$classid} and userid='{$muserid}' and ismember=1");
        $fsql = $empire->query("delete from " . $infotbr['datatbname'] . " where id={$id}");
        esetcookie("qdelinfo", "", 0);
        //更新栏目信息数
        AddClassInfos($classid, '-1', '-1', $r['checked']);
        //删除其它表记录和附件
        DelSingleInfoOtherData($classid, $id, $r, 0, 0);
        //生成列表
        if ($r['checked']) {
            qAddListHtml($classid, $mid, $cr['qaddlist'], $cr['listdt']);
            //生成上一篇
            if ($cr['repreinfo']) {
                $prer = $empire->fetch1("select * from {$dbtbpre}ecms_" . $tbname . " where id<{$id} and classid='{$classid}' order by id desc limit 1");
                GetHtml($prer['classid'], $prer['id'], $prer, 1);
                //下一篇
                $nextr = $empire->fetch1("select * from {$dbtbpre}ecms_" . $tbname . " where id>{$id} and classid='{$classid}' order by id limit 1");
                if ($nextr['id']) {
                    GetHtml($nextr['classid'], $nextr['id'], $nextr, 1);
                }
            }
        }
        if ($sql) {
            $reurl = DoingReturnUrl("ListInfo.php?mid={$mid}", $add['ecmsfrom']);
            printerror("DelQinfoSuccess", $reurl, 1);
        } else {
            printerror("DbError", "history.go(-1)", 1);
        }
    } else {
        printerror("ErrorUrl", "", 1);
    }
}
Example #6
0
function GetFpicToTpic($classid, $id, $num = 1, $getfirsttitlespic = 0, $swidth = 0, $sheight = 0, $fstb = 1)
{
    global $empire, $dbtbpre, $public_r, $class_r;
    $pubid = ReturnInfoPubid($classid, $id);
    $num = (int) $num;
    $num = $num - 1;
    $picr = $empire->fetch1("select fileid,filename,path,id,classid,no,fpath from {$dbtbpre}enewsfile_{$fstb} where pubid='{$pubid}' 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 = eReturnEcmsMainPortPath() . $fspath['filepath'] . $rpath;
            //moreport
            $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, $id, $add['filepass'], $userid, $username, 0, $fstb);
            $firsttitlepic = $fspath['fileurl'] . $rpath . "small" . $insertfile . $sfiler['filetype'];
        } else {
            $firsttitlepic = $fspath['fileurl'] . $rpath . $picr[filename];
        }
    }
    return $firsttitlepic;
}
Example #7
0
function DoMarkSmallPic($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre, $public_r, $efileftp_fr;
    //导入gd处理文件
    if ($add['getsmall'] || $add['getmark']) {
        @(include ECMS_PATH . DASHBOARD . "/class/gd.php");
    } else {
        printerror("EmptyDopicFileid", "history.go(-1)");
    }
    $fileid = $add['fileid'];
    $count = count($fileid);
    if ($count == 0) {
        printerror("EmptyDopicFileid", "history.go(-1)");
    }
    $add['classid'] = (int) $add['classid'];
    $modtype = (int) $add['modtype'];
    $fstb = (int) $add['fstb'];
    $fstb = eReturnFileStb($fstb);
    for ($i = 0; $i < $count; $i++) {
        $fileid[$i] = intval($fileid[$i]);
        $r = $empire->fetch1("select classid,filename,path,no,fpath from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid[$i]}'");
        $rpath = $r['path'] ? $r['path'] . '/' : $r['path'];
        $fspath = ReturnFileSavePath($r[classid], $r[fpath]);
        $path = eReturnEcmsMainPortPath() . $fspath['filepath'] . $rpath;
        //moreport
        $yname = $path . $r[filename];
        //缩略图
        if ($add['getsmall']) {
            $filetype = GetFiletype($r[filename]);
            $insertfile = substr($r[filename], 0, strlen($r[filename]) - strlen($filetype)) . time();
            $name = $path . "small" . $insertfile;
            GetMySmallImg($add['classid'], $r[no], $insertfile, $r[path], $yname, $add[width], $add[height], $name, $add['filepass'], $add['filepass'], $userid, $username, $modtype, $fstb);
        }
        //水印
        if ($add['getmark']) {
            GetMyMarkImg($yname);
            //FileServer
            if ($public_r['openfileserver']) {
                $efileftp_fr[] = $yname;
            }
        }
    }
    printerror("DoMarkSmallPicSuccess", $_SERVER['HTTP_REFERER']);
}
Example #8
0
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;
    }
}
Example #9
0
$infoid = (int) $_GET['infoid'];
$modtype = (int) $_GET['modtype'];
if (empty($fileid)) {
    printerror('NotCropImage', 'history.go(-1)');
}
$fstb = 0;
if (empty($modtype)) {
    $fstb = GetInfoTranFstb($classid, $infoid, 0);
}
$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
$imgurl = $fspath['fileurl'] . $path . $filer['filename'];
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)');
}
db_close();
$empire = null;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>