From 4630971e5cf69131fc19d094e5ec634578500377 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:05:21 +0800 Subject: [PATCH 01/28] cache 30m, refresh token 7d --- function/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 35b7672..813eb83 100644 --- a/function/common.php +++ b/function/common.php @@ -91,7 +91,7 @@ function getcache($str) return $cache->fetch($str); } -function savecache($key, $value, $exp = 3300) +function savecache($key, $value, $exp = 1800) { $cache = null; $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']); @@ -566,7 +566,7 @@ function main($path) error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT)); $_SERVER['access_token'] = $ret['access_token']; savecache('access_token', $_SERVER['access_token'], $ret['expires_in'] - 300); - if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+30*24*60*60 ]); + if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ]); } $_SERVER['retry'] = 0; From a39089355aa17d1464407355adb60470395361b6 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:16:01 +0800 Subject: [PATCH 02/28] Update common.php --- function/common.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 813eb83..393f994 100644 --- a/function/common.php +++ b/function/common.php @@ -624,8 +624,10 @@ function main($path) if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; } $tmp = array_values($tmp); - if (count($tmp)>0) return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]); - else return output('',404); + if (count($tmp)>0) { + if (isset($_GET['url'])) return output($tmp[rand(0,count($tmp)-1)], 200); + return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]); + } else return output('',404); } else return output('',401); } if (isset($files['file']) && !$_GET['preview']) { From f0e25b9ef5174bfeafcbde51cc80280bfbec9301 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 18:42:47 +0800 Subject: [PATCH 03/28] Update conststr.php --- conststr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 2be8e31..550bc65 100644 --- a/conststr.php +++ b/conststr.php @@ -13,7 +13,7 @@ $constStr = [ 'zh-cn' => '中文', 'ja' => '日本語', 'ko-kr' => '한국어', - 'fa' => 'Persian', + 'fa' => 'فارسی', ], 'Week' => [ 'en-us' => [ From 43b8d4f59bb862bdaf9d030bd358441020e5a021 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 21:10:51 +0800 Subject: [PATCH 04/28] Update .htaccess --- .htaccess | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.htaccess b/.htaccess index 7444332..45b9c2a 100644 --- a/.htaccess +++ b/.htaccess @@ -1,2 +1,13 @@ +# apache RewriteEngine On RewriteRule ^(.*) index.php?/$1 [L] + +#----------------------------------- +# nginx +# rewrite ^(.*) index.php?/$1 last; + +# caddy (not sure) +# rewrite { +# to /index.php?/$1 +# } +#----------------------------------- From 47b4db12fbea80049a2e35aa9771b70c58e5d724 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 21:40:01 +0800 Subject: [PATCH 05/28] hide time and size in mobile --- theme/classic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/classic.php b/theme/classic.php index ba0753d..cf70706 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -51,6 +51,7 @@ .list-wrapper{width:95%; margin-bottom:24px;} .list-table {padding:8px} .list-table td, .list-table th{white-space:nowrap;overflow:auto;max-width:80px} + .size, .updated_at{display:none} } From c809291686d627e94f4e0b094fe832408ff84f68 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 21:58:26 +0800 Subject: [PATCH 06/28] Update version --- version | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/version b/version index 6a2d5b4..47d021d 100644 --- a/version +++ b/version @@ -1,7 +1,14 @@ +20200311-2150.14 +Add a switch, can download a known file or not, while the folder is encrypted. +Hide time and size in mobile. +Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after the folder. +增加一个开关,在目录加密后能否下载其中的某个文件。 +在手机上浏览时,隐藏修改时间跟大小。 +加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。 + 20200229-1300.13 In SCF, some config can input Special symbols now, like ?&= 。 在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。 - 20200225-1310.12 Can update by one click any time. fix bugs: special tag, reupload. 可以不管版本直接一键更新(覆盖)了。修复可以使用特殊onedrive标签的bug,修复断网续传的问题。 From a3c15960ecd932ed16a3fa1519f74e5f51e196bb Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 12 Mar 2020 14:20:59 +0800 Subject: [PATCH 07/28] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 689958b..28e1350 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,7 @@ Official: https://cloud.tencent.com/product/scf ~~How to Install: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/%E6%97%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%87%BD%E6%95%B0SCF%E6%90%AD%E5%BB%BAOneDrive.mp4?preview~~ -先在环境变量添加Region,ap-hongkong或ap-guangzhou之类,再安装。 +先手动在环境变量添加Region,ap-hongkong或ap-guangzhou之类,具体看 https://cloud.tencent.com/document/api/583/17238 最底下,然后再安装。 添加网盘时,SCF反应不过来,会添加失败,请不要删除,再添加一次相同的就可以了。 DEMO: https://service-pgxgvop2-1258064400.ap-hongkong.apigateway.myqcloud.com/test/abcdef/ From 4e28e64867c85a1e8b88ed05330b42e8e55c9371 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 13 Mar 2020 10:53:19 +0800 Subject: [PATCH 08/28] Update common.php --- function/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index 393f994..555a847 100644 --- a/function/common.php +++ b/function/common.php @@ -364,7 +364,8 @@ function message($message, $title = 'Message', $statusCode = 200)

-', $statusCode); + +', $statusCode); } function needUpdate() From 8bb735ef61b8b07154e5efa51eeb1d4852eb0b9c Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:03:16 +0800 Subject: [PATCH 09/28] Update .htaccess --- .htaccess | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index 45b9c2a..f75587a 100644 --- a/.htaccess +++ b/.htaccess @@ -1,13 +1,15 @@ # apache +# LoadModule rewrite_module modules/mod_rewrite.so +# AllowOverride All RewriteEngine On RewriteRule ^(.*) index.php?/$1 [L] #----------------------------------- # nginx # rewrite ^(.*) index.php?/$1 last; - +# # caddy (not sure) # rewrite { -# to /index.php?/$1 +# to index.php?/$1 # } #----------------------------------- From 51a485b01e21664b1ffef67585d7b1c89715a873 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 13 Mar 2020 11:32:39 +0800 Subject: [PATCH 10/28] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 28e1350..ca4f48a 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ How to Install: 1.Start web service on your server (httpd or other), make sure you can visit it. 启动web服务器,确保你能访问到。 2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php. - 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix自行转换,我们的目的是不管访问什么都让index.php来处理。 + 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。 3.Upload code. 上传好代码。 4.Change the file config.php can be read&write (666 is suggested). @@ -41,7 +41,7 @@ The XXX_path in setting is the path in Onedrive, not in url, program will find t LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited. 网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。 Program will show content of 'readme.md' & 'head.md'. -可以在文件列表下面显示readme.md文件的内容。 +可以在文件列表显示head.md跟readme.md文件的内容。 guest up path, is a folder that the guest can upload files, but can not be list (exclude admin). 游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。 If there is 'index.html' file, program will only show the content of 'index.html', not list the files. From d832c33206bc1a62949f9f40ba5fd7fcc88abced Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 13 Mar 2020 20:35:28 +0800 Subject: [PATCH 11/28] Update index.php --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index c53a035..ff1cac9 100644 --- a/index.php +++ b/index.php @@ -4,9 +4,9 @@ include 'conststr.php'; include 'function/common.php'; //echo '
'. json_encode($_SERVER, JSON_PRETTY_PRINT).'
'; -if ($_SERVER['USER']==='qcloud') { +if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { include 'function/scf.php'; -} elseif ($_SERVER['HEROKU_APP_DIR']==='/app') { +} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { include 'function/heroku.php'; $path = getpath(); //echo 'path:'. $path; From d69cfbf49480b6786e617dc7d5a0e8c53e22b653 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 13 Mar 2020 20:37:27 +0800 Subject: [PATCH 12/28] Update classic.php --- theme/classic.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index cf70706..896b0e1 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -70,7 +70,7 @@
  • -
  • +
  • + if (isset($_SERVER['needUpdate'])&&$_SERVER['needUpdate']) { ?>

    @@ -133,6 +133,10 @@
    @@ -155,8 +159,6 @@
    document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" /> '; @@ -202,12 +204,12 @@
    + if (isset($_POST['filenum'])) $filenum = $_POST['filenum']; + if (!isset($filenum) and isset($files['folder']['page'])) $filenum = ($files['folder']['page']-1)*200; + else $filenum = 0; ?> - + @@ -406,7 +408,7 @@ + if (!isset($_GET['preview'])) { ?>
          
    + + + + + + + + + + + + +'; + foreach ($files['children'] as $file) { + // Files + if (isset($file['file'])) { + if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) { + if (strtolower($file['name']) === 'head.md') $head = $file; + if (strtolower($file['name']) === 'readme.md') $readme = $file; + if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) { + $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body']; + return output($html,200); + } + $filenum++; ?> + + + + + + +
       
    + +
  • +
      +
    • +
    • +
    • +
    • +
    • +
    +
  • + + + +
    + +
  • +
      +
    • +
    • +
    • +
    • +
    +
  • + + + + + + + + + + + + + + + + + + + + + + + +
    +200) { + $pagenum = $files['folder']['page']; + $maxpage = ceil($files['folder']['childCount']/200); + $prepagenext = ' + + + + + + + + +
    '; + if ($pagenum!=1) { + $prepagenum = $pagenum-1; + $prepagenext .= ' + '.getconstStr('PrePage').''; + } + $prepagenext .= ' + '; + for ($page=1;$page<=$maxpage;$page++) { + if ($page == $pagenum) { + $prepagenext .= ' + ' . $page . ' '; + } else { + $prepagenext .= ' + ' . $page . ' '; + } + } + $prepagenext = substr($prepagenext,0,-1); + $prepagenext .= ' + '; + if ($pagenum!=$maxpage) { + $nextpagenum = $pagenum+1; + $prepagenext .= ' + '.getconstStr('NextPage').''; + } + $prepagenext .= ' +
    + '; + echo $prepagenext; + } + if ($_SERVER['admin']) { ?> +
    +
    + + +
    +
    + + + +
    +
    +
    +
    + + +
    +'; + } + if ($readme) { + echo ' +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +'; + } + } + } else { + echo ' +
    +
    +
    + + +
    +
    +
    '; + $statusCode = 401; + } + } ?> +
    +
    +
    + + + +
    + + + + + + +
    + + + +
    + + + + + + + + + + From 447cc7468ac697a9541d9b1370253c0ae4568078 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 15 Mar 2020 20:50:29 +0800 Subject: [PATCH 21/28] try to fix random jpg >200 --- function/common.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/function/common.php b/function/common.php index 9bca61c..cfd4fef 100644 --- a/function/common.php +++ b/function/common.php @@ -938,18 +938,15 @@ function fetch_files($path = '/') // echo $path . '
    ' . json_encode($files, JSON_PRETTY_PRINT) . '
    '; if (isset($files['folder'])) { if ($files['folder']['childCount']>200) { - // files num > 200 , then get nextlink + // files num > 200 , then get nextlink $page = $_POST['pagenum']==''?1:$_POST['pagenum']; - $files=fetch_files_children($files, $path1, $page); + if ($page>1) $files=fetch_files_children($files, $path1, $page); + $files['children'] = children_name($files['children']); } else { // files num < 200 , then cache - if (isset($files['children'])) { - $tmp = []; - foreach ($files['children'] as $file) { - $tmp[$file['name']] = $file; - } - $files['children'] = $tmp; - } + //if (isset($files['children'])) { + $files['children'] = children_name($files['children']); + //} savecache('path_' . $path, $files); } } @@ -965,6 +962,15 @@ function fetch_files($path = '/') return $files; } +function children_name($children) +{ + $tmp = []; + foreach ($children as $file) { + $tmp[$file['name']] = $file; + } + return $tmp; +} + function fetch_files_children($files, $path, $page) { $path1 = path_format($path); From 916a2499e3ee1378c824b8ca2d330d5dd7ed4ae0 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 16 Mar 2020 14:31:24 +0800 Subject: [PATCH 22/28] in multi-disk, robot try to visit like /robot.txt will return 404 not 200 --- function/common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/function/common.php b/function/common.php index cfd4fef..16fe26e 100644 --- a/function/common.php +++ b/function/common.php @@ -502,6 +502,7 @@ function main($path) $_SERVER['disktag'] = $path; $pos = strpos($path, '/'); if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); + if (!in_array($_SERVER['disktag'], $disktags)) return message('Please visit from Home Page.', 'Error', 404); $path = substr($path, strlen('/'.$_SERVER['disktag'])); if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path']. '/' . $_SERVER['disktag'] . '/'); } else $_SERVER['disktag'] = $disktags[0]; From 2ca2c88cf360161eb244fcef0f064efb6b5c1ea6 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 16 Mar 2020 15:04:48 +0800 Subject: [PATCH 23/28] Update common.php --- function/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index 16fe26e..bc42d08 100644 --- a/function/common.php +++ b/function/common.php @@ -502,7 +502,7 @@ function main($path) $_SERVER['disktag'] = $path; $pos = strpos($path, '/'); if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); - if (!in_array($_SERVER['disktag'], $disktags)) return message('Please visit from Home Page.', 'Error', 404); + if (!in_array($_SERVER['disktag'], $disktags)) return message('Please visit from Home Page.', 'Error', 404); $path = substr($path, strlen('/'.$_SERVER['disktag'])); if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path']. '/' . $_SERVER['disktag'] . '/'); } else $_SERVER['disktag'] = $disktags[0]; From 7ccf99312bd40fb98237578860e1da7f62e225ea Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 17 Mar 2020 11:36:49 +0800 Subject: [PATCH 24/28] add hideFunctionalityFile --- conststr.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conststr.php b/conststr.php index 550bc65..90b5342 100644 --- a/conststr.php +++ b/conststr.php @@ -72,6 +72,7 @@ $constStr = [ 'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password', 'background' => 'Set an url as background photo, or put a \'background.jpg\' at showed path.', 'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.', + 'hideFunctionalityFile' = '0 or 1. if 1, some file will not show in list to guest, like readme.md', 'passfile' => 'The password of dir will save in this file.', 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.', 'sitename' => 'sitename', @@ -86,6 +87,7 @@ $constStr = [ 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'background' => '设置一个url作为背景,或者在你显示的目录放一个background.jpg文件。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', + 'hideFunctionalityFile' = '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', 'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。', 'sitename' => '网站的名称', From 4a8bd8aa9044ec54828f40a76bb3a48054b46439 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 17 Mar 2020 11:38:16 +0800 Subject: [PATCH 25/28] add hideFunctionalityFile --- theme/classic.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index 896b0e1..f42c76e 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -244,13 +244,13 @@ foreach ($files['children'] as $file) { // Files if (isset($file['file'])) { - if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) { - if (strtolower($file['name']) === 'head.md') $head = $file; - if (strtolower($file['name']) === 'readme.md') $readme = $file; - if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) { - $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body']; - return output($html,200); - } + if (strtolower($file['name']) === 'head.md') $head = $file; + if (strtolower($file['name']) === 'readme.md') $readme = $file; + if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) { + $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body']; + return output($html,200); + } + if ($_SERVER['admin'] or !isHideFile($file['name'])) { $filenum++; ?> From 6cf4f4187eac75a6bab3cf792ac16eb75926f1ef Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 17 Mar 2020 11:39:16 +0800 Subject: [PATCH 26/28] add hideFunctionalityFile --- function/common.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/function/common.php b/function/common.php index bc42d08..41e9ecf 100644 --- a/function/common.php +++ b/function/common.php @@ -12,6 +12,7 @@ $Base64Env = [ //'disktag', //'downloadencrypt', //'function_name', // used in heroku. + //'hideFunctionalityFile', //'language', //'passfile', 'sitename', @@ -36,6 +37,7 @@ $CommonEnv = [ 'background', 'disktag', 'function_name', // used in heroku. + 'hideFunctionalityFile', 'language', 'passfile', 'sitename', @@ -52,6 +54,7 @@ $ShowedCommonEnv = [ 'background', //'disktag', //'function_name', // used in heroku. + 'hideFunctionalityFile', 'language', 'passfile', 'sitename', @@ -84,6 +87,20 @@ $ShowedInnerEnv = [ //'token_expires', ]; +function isHideFile($name) +{ + $FunctionalityFile = [ + 'head.md', + 'readme.md', + 'favicon.ico', + ]; + + if ($name == getConfig('passfile')) return true; + if (substr($name,0,1) == '.') return true; + if (getConfig('hideFunctionalityFile')) if (in_array(strtolower($name), $FunctionalityFile)) return true; + return false; +} + function getcache($str) { //$cache = null; From 0076548c3a3980753ac3125e83cf66740e5bfd6b Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 17 Mar 2020 11:43:43 +0800 Subject: [PATCH 27/28] add hideFunctionalityFile --- conststr.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conststr.php b/conststr.php index 90b5342..65a3dea 100644 --- a/conststr.php +++ b/conststr.php @@ -72,7 +72,7 @@ $constStr = [ 'downloadencrypt' => '0 or 1. if 1, the files in encrypt folder can be downloaded without password', 'background' => 'Set an url as background photo, or put a \'background.jpg\' at showed path.', 'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.', - 'hideFunctionalityFile' = '0 or 1. if 1, some file will not show in list to guest, like readme.md', + 'hideFunctionalityFile' => '0 or 1. if 1, some file will not show in list to guest, like readme.md', 'passfile' => 'The password of dir will save in this file.', 'public_path' => 'Show this Onedrive dir when through the long url of API Gateway; public show files less than private.', 'sitename' => 'sitename', @@ -87,7 +87,7 @@ $constStr = [ 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'background' => '设置一个url作为背景,或者在你显示的目录放一个background.jpg文件。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', - 'hideFunctionalityFile' = '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md', + 'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', 'public_path' => '使用API长链接访问时,显示网盘文件的路径,不设置时默认为根目录;不能是private_path的上级(public看到的不能比private多,要么看到的就不一样)。', 'sitename' => '网站的名称', From 634be2876913cdd8b7149d4b5bb6da6fc2a45c78 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 18 Mar 2020 11:21:00 +0800 Subject: [PATCH 28/28] Add files via upload --- theme/ly_white.php | 1319 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1319 insertions(+) create mode 100644 theme/ly_white.php diff --git a/theme/ly_white.php b/theme/ly_white.php new file mode 100644 index 0000000..64f4f09 --- /dev/null +++ b/theme/ly_white.php @@ -0,0 +1,1319 @@ + + + + + <?php echo $pretitle;?> - <?php echo $_SERVER['sitename'];?> + + + + + + +
    + +
    + + + +
    + + + +
    • + +
    • +
    • +
    • + +
    • +
    • +
  • + +   + +
    + +
    + +

    + +

    +1) { ?> +
    +
    +
    +
    +'.$diskname.' +'; + } ?> +
    +
    +
    +
    + +
    +
    +
    + + + + + +

    +
    +
    + +
    +
    + + +
    +
    +' . $files['error']['message'] . '
    '; + $statusCode=404; + } else { + if (isset($files['file'])) { +?> +
    +
    + +   +
    +
    +document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" /> +'; + } elseif (in_array($ext, $exts['video'])) { + //echo ''; + $DPvideo=$files['@microsoft.graph.downloadUrl']; + echo '
    +'; + } elseif (in_array($ext, $exts['music'])) { + echo ' +'; + } elseif (in_array($ext, ['pdf'])) { + /*echo ' + +';*/ + $pdfurl = $files['@microsoft.graph.downloadUrl']; + echo '
    +'; + } elseif (in_array($ext, $exts['office'])) { + echo ' +'; + } elseif (in_array($ext, $exts['txt'])) { + $txtstr = htmlspecialchars(curl_request($files['@microsoft.graph.downloadUrl'])['body']); +?> +
    + +
    + +     + + + +'; ?> +
    + + +
    +'; + }*/ else { + echo ''.getconstStr('FileNotSupport').''; + } ?> +
    +
    + + + + + + + + + + + + + + +'; + foreach ($files['children'] as $file) { + // Files + if (isset($file['file'])) { + if ($_SERVER['admin'] or (substr($file['name'],0,1) !== '.' and $file['name'] !== getConfig('passfile') ) ) { + if (strtolower($file['name']) === 'head.md') $head = $file; + if (strtolower($file['name']) === 'readme.md') $readme = $file; + if (strtolower($file['name']) === 'index.html' && !$_SERVER['admin']) { + $html = curl_request(fetch_files(spurlencode(path_format($path . '/' .$file['name']),'/'))['@microsoft.graph.downloadUrl'])['body']; + return output($html,200); + } + $filenum++; ?> + + + + + + +
       
    + +
  • +
      +
    • +
    • +
    • +
    • +
    • +
    +
  • + + + +
    + +
  • +
      +
    • +
    • +
    • +
    • +
    +
  • + + + + + + + + + + + + + + + + + + + + + + + +
    +200) { + $pagenum = $files['folder']['page']; + $maxpage = ceil($files['folder']['childCount']/200); + $prepagenext = ' + + + + + + + + +
    '; + if ($pagenum!=1) { + $prepagenum = $pagenum-1; + $prepagenext .= ' + '.getconstStr('PrePage').''; + } + $prepagenext .= ' + '; + for ($page=1;$page<=$maxpage;$page++) { + if ($page == $pagenum) { + $prepagenext .= ' + ' . $page . ' '; + } else { + $prepagenext .= ' + ' . $page . ' '; + } + } + $prepagenext = substr($prepagenext,0,-1); + $prepagenext .= ' + '; + if ($pagenum!=$maxpage) { + $nextpagenum = $pagenum+1; + $prepagenext .= ' + '.getconstStr('NextPage').''; + } + $prepagenext .= ' +
    + '; + echo $prepagenext; + } + if ($_SERVER['admin']) { ?> +
    +
    + + +
    +
    + +
    + +
    +
    +
    +
    + + +
    +'; + } + if ($readme) { + echo ' +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +'; + } + } + } else { + echo ' +
    +
    +
    + + +
    +
    +
    '; + $statusCode = 401; + } + } ?> +
    +
    +
    + + + +
    + + + + + + +
    + + + + + + +
    + + + + +"日)", + "1"=>"一)", + "2"=>"二)", + "3"=>"三)", + "4"=>"四)", + "5"=>"五)", + "6"=>"六)" +); +echo '(星期'.$week[$w]; +?> + +
    +
    + + +
    + + + + + + + + +