From 22259708d5c812aa542910ea2bf54ba3899079f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=83=A1?= <3203164629@qq.com> Date: Thu, 10 Oct 2024 02:21:51 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9C=A8=E7=BA=BF=E6=89=93=E5=BC=80=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=92=8C=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小胡 <3203164629@qq.com> --- dzz/shares/function/function_common.php | 29 +++++++++++++++++-------- dzz/shares/scripts/mobile/share.js | 8 +++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/dzz/shares/function/function_common.php b/dzz/shares/function/function_common.php index 17c0a81..4fb49ae 100644 --- a/dzz/shares/function/function_common.php +++ b/dzz/shares/function/function_common.php @@ -40,24 +40,31 @@ function checkShare($share){ } //获取文件的打开方式 function getOpenUrl($icoarr,$share){ - static $extall=array(); $ext=$icoarr['ext']; $dpath=$icoarr['dpath'];//(array('path'=>$icoarr['rid'],'perm'=>$share['perm'])); + $canedit=0; + if($share['perm'] & 64){ + $canedit=1; + } + $candownload=0; + if($share['perm'] & 256){ + $candownload=1; + } $extall=C::t('app_open')->fetch_all_ext(); $exts=array(); - $extarr=array(); + $bzarr=explode(':',$icoarr['rbz']?$icoarr['rbz']:$icoarr['bz']); + $bz=($bzarr[0]) ? $bzarr[0]:'dzz'; foreach($extall as $value){ - if(!isset($exts[$value['ext']]) || $value['isdefault']) $exts[$value['ext']]=$value; - } + if(!isset($exts[$value['ext']]) || $value['isdefault']) $exts[$value['ext']]=$value; + } + if(isset($exts[$bz.':'.$ext])){ $data=$exts[$bz.':'.$ext]; }elseif($exts[$ext]){ $data=$exts[$ext]; }elseif($exts[$icoarr['type']]){ $data=$exts[$icoarr['type']]; - }else { - $data=array(); - } + }else $data=array(); if($data){ $url=$data['url']; if($icoarr['type']=='image' || strpos($url,'dzzjs:OpenPicWin')!==false){//dzzjs形式时 @@ -78,7 +85,7 @@ function getOpenUrl($icoarr,$share){ }, $url); //添加path参数; if(strpos($url,'?')!==false && strpos($url,'path=')===false){ - $url.='&path='.$dpath; + $url.='&path=' . dzzencode('preview_' . $icoarr['rid']); } //$url = $_G['siteurl'].$url; return array('type'=>'attach','url'=>$url,'canedit'=>$data['canedit']); @@ -86,7 +93,11 @@ function getOpenUrl($icoarr,$share){ }else{//没有可用的打开方式,转入下载; $sid=dzzencode($share['id'],'',0,0); - return array('type'=>'download','url'=>'index.php?mod=shares&op=download&operation=download&sid='.$sid.'&filename='.$icoarr['name'].'&path='.$dpath); + if($candownload){ + return array('type'=>'download','url'=>'index.php?mod=shares&op=download&operation=download&sid='.$sid.'&filename='.$icoarr['name'].'&path='.$dpath); + }else{ + return array('type'=>'download','url'=>'index.php?mod=shares&op=download&operation=download&sid='.$sid.'&filename='.$icoarr['name'].'&path='.$dpath); + } //IO::download($path,$_GET['filename']); } } \ No newline at end of file diff --git a/dzz/shares/scripts/mobile/share.js b/dzz/shares/scripts/mobile/share.js index 45449e0..29a4997 100644 --- a/dzz/shares/scripts/mobile/share.js +++ b/dzz/shares/scripts/mobile/share.js @@ -25,8 +25,9 @@ $(document).off('tap.openfile').on('tap.openfile', '.filelist', function () { }); pb.open(index); }else if(type=='download'){ - var path=obj.data('dpath'); - if(obj.data('url')) downfile(path); + var path=obj.data('dpath'); + var href = DZZSCRIPT + '?mod=io&op=download&checkperm=false'+ '&path=' + path; + if(obj.data('url')) downfile(href); } else { if (is_wxwork) { @@ -198,5 +199,4 @@ $(document).off('tap.down').on('tap.down', '.downfile', function () { } href = href + '&path=' + rids; downfile(href); -}) - +}) \ No newline at end of file