preview前缀相关支持

This commit is contained in:
zyx0814 2024-09-29 21:59:54 +08:00
parent 50af954621
commit f61cfa2cc6
2 changed files with 8 additions and 1 deletions

View File

@ -190,6 +190,9 @@ class io_dzz extends io_api
public function getFileUri($path, $fop = '')
{
global $_G;
if (strpos($path, 'preview_') === 0) {
$path = preg_replace('/^preview_/', '', $path);
}
if (strpos($path, 'attach::') === 0) {
$attach = C::t('attachment')->fetch(intval(str_replace('attach::', '', $path)));
Hook::listen('io_dzz_getstream_attach',$attach);//挂载点
@ -442,6 +445,9 @@ class io_dzz extends io_api
public function setFileContent($rid, $fileContent, $force = false, $nocover = true)
{
global $_G;
if (strpos($rid, 'preview_') === 0) {
$rid = preg_replace('/^preview_/', '', $rid);
}
if (!$icoarr = C::t('resources')->fetch_by_rid($rid)) {
return array('error' => lang('file_not_exist'));
}

View File

@ -75,7 +75,8 @@ if($_GET['a']=='down'){
}, $url);
//添加path参数
if(strpos($url,'?')!==false && strpos($url,'path=')===false){
$url.='&path='.$icoarr['icoid'];
$path = $path ? $path : $_GET['s'];
$url.='&path=' . dzzencode('preview_' . $path);
}
$url = $_G['siteurl'].$url;
@header("Location: $url");