From f2d53d45af076a7a866b4a509137d6fd35838061 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 9 Jan 2022 16:07:59 +0800 Subject: [PATCH] Allow Preview when enable downloadencrypt #506 , --- common.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common.php b/common.php index efb0cb6..a09d1f3 100644 --- a/common.php +++ b/common.php @@ -2225,7 +2225,18 @@ function render_list($path = '', $files = []) while (strpos($html, '')) $html = str_replace('', '', $html); } - if ($_SERVER['ishidden']==4) { + if ($_SERVER['ishidden']<4 || ($files['type']=='file'&&getConfig('downloadencrypt', $_SERVER['disktag']))) { + while (strpos($html, '')) { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } + while (strpos($html, '')) { + $html = str_replace('', '', $html); + $html = str_replace('', '', $html); + } + } else { // 加密状态 if (getConfig('useBasicAuth')) { // use Basic Auth @@ -2300,17 +2311,6 @@ function render_list($path = '', $files = []) $tmp = splitfirst($tmp[1], ''); $html .= $tmp[1]; } - } else { - while (strpos($html, '')) { - $tmp = splitfirst($html, ''); - $html = $tmp[0]; - $tmp = splitfirst($tmp[1], ''); - $html .= $tmp[1]; - } - while (strpos($html, '')) { - $html = str_replace('', '', $html); - $html = str_replace('', '', $html); - } } while (strpos($html, '')) $html = str_replace('', getconstStr('Download'), $html);