Files
Pichome/dzz/pichome/download.php
2021-12-09 21:00:09 +08:00

20 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if (!defined('IN_OAOOA')) {//所有的php文件必须加上此句防止被外部调用
exit('Access Denied');
}
$path = dzzdecode($_GET['dpath'],'',0);
if(!$path) exit(json_encode(array('error'=>'dpath is must')));
$resourcesdata = C::t('pichome_resources')->fetch($path);
$resourcesdata['name'] = '"' . (strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'Edge') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($resourcesdata['name']) : ($resourcesdata['name'])) . '"';
$attach = DB::fetch_first("select path,appid from %t where rid = %s",array('pichome_resources_attr',$path));
$librarydata = DB::fetch_first("select path,iswebsitefile from %t where appid = %s",array('pichome_vapp',$attach['appid']));
if($librarydata['iswebsitefile']){
$realpath = $librarydata['path'].'./'.$attach['path'];
$attachurl= getglobal('siteurl') . 'index.php?mod=io&op=getImg&path=' . dzzencode($realpath);
}else{
$attachurl = $librarydata['path'].'./'.$attach['path'];
}
$d = new FileDownload();
$d->download($attachurl, $resourcesdata['name'], $resourcesdata['size'], 0, true);
exit();