From 8075c3d2d82b8dc40819e6df4a82389797d184fa Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 11 May 2020 13:11:07 +0800 Subject: [PATCH 01/12] if no disktag 302 to 1st disk --- common.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common.php b/common.php index 33fe6e4..2ae7073 100644 --- a/common.php +++ b/common.php @@ -153,6 +153,7 @@ function main($path) global $exts; global $constStr; + $path = path_format($path); if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) { $constStr['language'] = $_SERVER['firstacceptlanguage']; } else { @@ -216,10 +217,14 @@ function main($path) // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); - $_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); + $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; + //$pos = strpos($path, '/'); + //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); + if (!in_array($_SERVER['disktag'], $disktags)) { + $tmp = path_format($_SERVER['base_path'].'/'.$disktags[0].'/'.$path); + return output('Please visit '.$tmp.'.', 302, [ 'Location' => $tmp ]); + //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 8836da84328c4a23db9be9a8538fa8bdfa326925 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 11 May 2020 13:12:19 +0800 Subject: [PATCH 02/12] if no disktag 302 to 1st disk --- theme/classic.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/classic.html b/theme/classic.html index a3a21f7..066d8d4 100644 --- a/theme/classic.html +++ b/theme/classic.html @@ -21,8 +21,8 @@ - - + + From 788df4b518ec70cca4b1e1a9a43231baafa4544e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 11 May 2020 15:17:05 +0800 Subject: [PATCH 04/12] fix: proxy remote addr --- platform/normal.php | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/normal.php b/platform/normal.php index 432211d..c56577b 100644 --- a/platform/normal.php +++ b/platform/normal.php @@ -3,6 +3,7 @@ function getpath() { $_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]); + if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/'); $p = strpos($_SERVER['REQUEST_URI'],'?'); if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p); From 938d7cfda11e8b91379f16c495f4d70324947c4f Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 12 May 2020 14:13:46 +0800 Subject: [PATCH 05/12] fix: output guest upload in encrypted folder --- common.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/common.php b/common.php index 2ae7073..e29c121 100644 --- a/common.php +++ b/common.php @@ -1879,7 +1879,7 @@ function render_list($path = '', $files = '') $html = str_replace('', '', $html); } } - if ($_SERVER['is_guestup_path']||$_SERVER['admin']) { + if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&isset($files['folder'])&&$_SERVER['ishidden']<4 )) { while (strpos($html, '')) { $html = str_replace('', '', $html); $html = str_replace('', '', $html); @@ -1926,10 +1926,13 @@ function render_list($path = '', $files = '') $html = str_replace('', '', $html); $html = str_replace('', '', $html); } - /*while (strpos($html, '')) { - $html = str_replace('', '', $html); - $html = str_replace('', '', $html); - }*/ + $tmp[1] = 'a'; + while ($tmp[1]!='') { + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + $html .= $tmp[1]; + } } if (isset($files['children'])) { @@ -2162,9 +2165,7 @@ function render_list($path = '', $files = '') while (strpos($html, '')) $html = str_replace('', $_SERVER['base_path'], $html); while (strpos($html, '')) $html = str_replace('', str_replace('%23', '#', str_replace('&','&', $path)), $html); while (strpos($html, '')) $html = str_replace('', getconstStr('Home'), $html); - - while (strpos($html, '')) $html = str_replace('', $_SERVER['timezone'], $html); - + $html = str_replace('', getConfig('customCss'), $html); $html = str_replace('', getConfig('customScript'), $html); @@ -2404,6 +2405,12 @@ function render_list($path = '', $files = '') } $html .= $tmp[1]; + $tmp = splitfirst($html, ''); + $html = $tmp[0]; + $tmp = splitfirst($tmp[1], ''); + if (!isset($_COOKIE['timezone'])) $html .= str_replace('', $_SERVER['timezone'], $tmp[0]); + $html .= $tmp[1]; + while (strpos($html, '')) $html = str_replace('', $_SERVER['timezone'], $html); // 最后清除换行 while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html); From 3b8c0d82ad39a46dba7a8a8d30ed24a11147d3d1 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 14 May 2020 18:05:43 +0800 Subject: [PATCH 06/12] add runtime mem in foot string --- common.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common.php b/common.php index e29c121..60f61bd 100644 --- a/common.php +++ b/common.php @@ -153,6 +153,7 @@ function main($path) global $exts; global $constStr; + $_SERVER['php_starttime'] = microtime(true); $path = path_format($path); if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) { $constStr['language'] = $_SERVER['firstacceptlanguage']; @@ -1737,7 +1738,7 @@ function render_list($path = '', $files = '') date_default_timezone_set(get_timezone($_SERVER['timezone'])); $authinfo = ''; $theme = getConfig('theme'); @@ -2005,8 +2006,10 @@ function render_list($path = '', $files = '') if ($ext==$key1) { $FolderListStr = str_replace('', $value1, $FolderListStr); } + //error_log('file:'.$file['name'].':'.$key1); + if (!strpos($FolderListStr, '')) break; } - $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr); + if (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $IconValues['default'], $FolderListStr); while (strpos($FolderListStr, '')) $FolderListStr = str_replace('', $filenum, $FolderListStr); $html .= $FolderListStr; } @@ -2196,9 +2199,6 @@ function render_list($path = '', $files = '') while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFile'), $html); while (strpos($html, '')) $html = str_replace('', getconstStr('UploadFolder'), $html); while (strpos($html, '')) $html = str_replace('', (isset($_GET['preview'])?'?preview&':'?'), $html); - - - $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'], $html); $tmp = splitfirst($html, ''); $html = $tmp[0]; @@ -2415,9 +2415,11 @@ function render_list($path = '', $files = '') // 最后清除换行 while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html); //while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html); - + + $exetime = round(microtime(true)-$_SERVER['php_starttime'],3); + $html = str_replace('', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html); } - + $html = $authinfo . $html; if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]); return output($html,$statusCode); From 902488ebd076ff035e006e6fe17cb59bd36d28b8 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 14 May 2020 18:12:51 +0800 Subject: [PATCH 07/12] Update conststr.php --- conststr.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conststr.php b/conststr.php index 1dffcc5..4a28a9a 100644 --- a/conststr.php +++ b/conststr.php @@ -1,7 +1,7 @@ '对一个Onedrive文件夹共享,允许所有人编辑,然后将共享链接填在下方', ], 'CustomIdSecret' => [ - 'en-us' => 'Use custom client id & secret', - 'zh-cn' => '自己申请应用ID与机密', + 'en-us' => 'Use custom client id & secret instead of OneManager default', + 'zh-cn' => '自己申请应用ID与机密,不用OneManager默认的', 'ja' => 'アプリケーションIDとシークレットを自分で申請する', 'ko-kr' => '응용 프로그램 ID 및 비밀 신청', 'fa' => 'به طور پیش فرض اما از شناسه برنامه و سکرت استفاده کنید', From 44caac5cec1d0dd9dc89c4d7c7ebc0bfeda2ccf7 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 14 May 2020 18:25:52 +0800 Subject: [PATCH 08/12] Update common.php --- common.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common.php b/common.php index 60f61bd..e1f1ffb 100644 --- a/common.php +++ b/common.php @@ -1378,10 +1378,17 @@ function get_refresh_token() $tmp['Drive_custom'] = $_POST['Drive_custom']; $tmp['client_id'] = $_POST['client_id']; $tmp['client_secret'] = $_POST['client_secret']; + } else { + $tmp['Drive_custom'] = ''; + $tmp['client_id'] = ''; + $tmp['client_secret'] = ''; } if ($_POST['usesharepoint']=='on') { $tmp['usesharepoint'] = $_POST['usesharepoint']; $tmp['sharepointSiteAddress'] = $_POST['sharepointSiteAddress']; + } else { + $tmp['usesharepoint'] = ''; + $tmp['sharepointSiteAddress'] = ''; } } $response = setConfigResponse( setConfig($tmp, $_COOKIE['disktag']) ); From 9a101d78c79345ed477b2c459abdd03ba954a966 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 14 May 2020 18:26:19 +0800 Subject: [PATCH 09/12] Update conststr.php --- conststr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 4a28a9a..7f638a9 100644 --- a/conststr.php +++ b/conststr.php @@ -1,7 +1,7 @@ Date: Fri, 15 May 2020 20:20:59 +0800 Subject: [PATCH 10/12] Create nexmoe.html --- theme/nexmoe.html | 326 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 theme/nexmoe.html diff --git a/theme/nexmoe.html b/theme/nexmoe.html new file mode 100644 index 0000000..10e58aa --- /dev/null +++ b/theme/nexmoe.html @@ -0,0 +1,326 @@ + +{ + "music":"audiotrack", + "video":"ondemand_video", + "img":"image", + "default":"insert_drive_file" +} + + + + + + + <!--Title--> + + + + + +
+
+
+ +
+
+ + +
+ +
+ +
+
+ https + + +
+
+ +
+
+ + + +
+
+ + +--> + + +
+ + +
+ + + +
+ +
+ + +
+
+
+ + +
+ +
+ + +
+ +
+ + + + +
+
+
+ + + +
+ + file_download + + + +
+
+ +
+
+ +
+ + +
+ + + format_list_bulleted + + + + + + From f986460bbaa1024d2cd3c0bba13efa8b059684aa Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 15 May 2020 20:22:35 +0800 Subject: [PATCH 11/12] Update common.php --- common.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/common.php b/common.php index e1f1ffb..c9d7944 100644 --- a/common.php +++ b/common.php @@ -2138,6 +2138,7 @@ function render_list($path = '', $files = '') $html = str_replace('', '', $html); } while (strpos($html, '')) $html = str_replace('', $files[$_SERVER['DownurlStrName']], $html); + while (strpos($html, '')) $html = str_replace('', path_format($_SERVER['base_disk_path'] . '/' . $path), $html); while (strpos($html, '')) $html = str_replace('', $files['name'], $html); $html = str_replace('', urlencode($files[$_SERVER['DownurlStrName']]), $html); $html = str_replace('', getconstStr('ClicktoEdit'), $html); @@ -2162,13 +2163,17 @@ function render_list($path = '', $files = '') $html = str_replace('', $title, $html); $keywords = $n_path; - if ($p_path!='') $keywords .= ',' . $p_path; - $keywords .= ',' . $_SERVER['sitename'] . ',OneManager'; + if ($p_path!='') $keywords .= ', ' . $p_path; + if ($_SERVER['sitename']!='OneManager') $keywords .= ', ' . $_SERVER['sitename'] . ', OneManager'; + else $keywords .= ', OneManager'; $html = str_replace('', $keywords, $html); - if ($_GET['preview']) $description = 'Preview of '.$n_path.'. '; - elseif (isset($files['folder'])) $description = 'List of '.$n_path.'. '; - $description .= 'In '.$_SERVER['sitename']; + if ($_GET['preview']) { + $description = $n_path.', '.getconstStr('Preview');//'Preview of '. + } elseif (isset($files['folder'])) { + $description = $n_path.', '.getconstStr('List');//'List of '.$n_path.'. '; + } + //$description .= 'In '.$_SERVER['sitename']; $html = str_replace('', $description, $html); while (strpos($html, '')) $html = str_replace('', $_SERVER['base_disk_path'], $html); @@ -2258,7 +2263,7 @@ function render_list($path = '', $files = '') $html = $tmp[0]; $tmp = splitfirst($tmp[1], ''); if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) { - $html .= $tmp[0] . $tmp[1]; + $html .= str_replace('', getconstStr('OriginalPic'), $tmp[0]) . $tmp[1]; } else $html .= $tmp[1]; } $imgextstr = ''; From c5cf5b7fae6ded2daf3d11fcc3908edf1a80b3dc Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 15 May 2020 20:23:57 +0800 Subject: [PATCH 12/12] Update conststr.php --- conststr.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 7f638a9..135a4fa 100644 --- a/conststr.php +++ b/conststr.php @@ -4,7 +4,7 @@ $exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff' $exts['music'] = ['mp3', 'wma', 'flac', 'wav', 'ogg', 'm4a']; $exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']; $exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'json', 'html', 'c', 'md', 'py', 'omf']; -$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8']; +$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', 'rmvb']; $exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar']; $constStr = [ @@ -259,6 +259,14 @@ $constStr = [ 'ko-kr' => '홈', 'fa' => 'خانه', ], + 'Preview' => [ + 'en-us' => 'Preview', + 'zh-cn' => '预览', + ], + 'List' => [ + 'en-us' => 'List', + 'zh-cn' => '列表', + ], 'NeedUpdate' => [ 'en-us' => 'Program can update
Click setup in Operate at top.', 'zh-cn' => '可以升级程序
在上方管理菜单中
进入设置页面升级', @@ -329,6 +337,10 @@ $constStr = [ 'ko-kr' => '사진 섬네일', 'fa' => 'تصویر بندانگشتی', ], + 'OriginalPic' => [ + 'en-us' => 'OriginalPic', + 'zh-cn' => '原图', + ], 'CopyAllDownloadUrl' => [ 'en-us' => 'CopyAllDownloadUrl', 'zh-cn' => '复制所有下载链接',