From 57e17ab8039d509ce42ba40f6350654d4e40646f Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 26 Feb 2020 18:01:38 +0800 Subject: [PATCH 001/120] Update conststr.php --- conststr.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conststr.php b/conststr.php index b57666e..df9ed6d 100644 --- a/conststr.php +++ b/conststr.php @@ -268,6 +268,12 @@ $constStr = [ 'ja' => '画像のサムネイル', 'ko-kr' => '사진 섬네일', ], + 'CopyAllDownloadUrl' => [ + 'en-us' => 'CopyAllDownloadUrl', + 'zh-cn' => '复制所有下载链接', + 'ja' => 'すべてのダウンロードリンクをコピー', + 'ko-kr' => '모든 다운로드 링크 복사', + ], 'EditTime' => [ 'en-us' => 'EditTime', 'zh-cn' => '修改时间', From 97d041ab36ebc7066618ee8131783f68ce4fc4e1 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 26 Feb 2020 18:02:49 +0800 Subject: [PATCH 002/120] add a button to copy all download links --- theme/classic.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index 23e50ba..1a844d3 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -205,7 +205,7 @@ $readme = false; ?> - + @@ -283,7 +283,7 @@ - + @@ -681,7 +681,6 @@ } - var sort=0; function showthumbnails(obj) { var files=document.getElementsByName('filelist'); for ($i=0;$i; i++) document.getElementById('tr'+i).parentNode.insertBefore(document.getElementById('tr'+i),document.getElementById('tr'+(i-1)).nextSibling); From e6d2344312386beec3ee6187bcc296c7c1c9547a Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 27 Feb 2020 09:54:18 +0800 Subject: [PATCH 003/120] Update and rename black.php to whiteblue.php --- theme/{black.php => whiteblue.php} | 90 +++++++++++++++++------------- 1 file changed, 51 insertions(+), 39 deletions(-) rename theme/{black.php => whiteblue.php} (92%) diff --git a/theme/black.php b/theme/whiteblue.php similarity index 92% rename from theme/black.php rename to theme/whiteblue.php index 2292087..a298925 100644 --- a/theme/black.php +++ b/theme/whiteblue.php @@ -1,3 +1,4 @@ + @@ -9,47 +10,46 @@ +
      
- - - + + + "> @@ -541,7 +542,7 @@ function setTime() { var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); - var time = year+"年"+$(month)+'月'+$(day)+"日"+$(hour)+":"+$(minute)+":"+$(second); + var time = year+"/"+$(month)+'/'+$(day)+" "+$(hour)+":"+$(minute)+":"+$(second); document.getElementById("date1").innerHTML=time; } setTime(); @@ -551,7 +552,7 @@ setInterval('setTime()',500); @@ -582,7 +583,7 @@ echo '当前IP地址: ' ,$ip, "\n"; e.innerHTML += paths[paths.length - 1]; e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '') }); - + function changelanguage(str) { if (str=='Language') str = ''; @@ -599,7 +600,6 @@ echo '当前IP地址: ' ,$ip, "\n"; if ($readme) { $readme.innerHTML = marked(document.getElementById('readme-md').innerText); } - var $url = document.getElementById('url'); @@ -712,7 +712,6 @@ echo '当前IP地址: ' ,$ip, "\n"; } - var sort=0; function showthumbnails(obj) { var files=document.getElementsByName('filelist'); for ($i=0;$i; i++) document.getElementById('tr'+i).parentNode.insertBefore(document.getElementById('tr'+i),document.getElementById('tr'+(i-1)).nextSibling); @@ -1262,4 +1274,4 @@ echo '当前IP地址: ' ,$ip, "\n"; - \ No newline at end of file + From 4a16b6281237b6762883bd7ae13a2f2434880c3d Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 12:53:30 +0800 Subject: [PATCH 004/120] some config can input Special symbols now --- function/scf.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/function/scf.php b/function/scf.php index 9c4c996..f344ed8 100644 --- a/function/scf.php +++ b/function/scf.php @@ -54,16 +54,20 @@ function GetPathSetting($event, $context) function getConfig($str, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; if (in_array($str, $InnerEnv)) { - return json_decode(getenv($disktag), true)[$str]; + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1)); + else return json_decode(getenv($disktag), true)[$str]; } - return getenv($str); + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1)); + else return getenv($str); } function setConfig($arr, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; $disktags = explode("|",getConfig('disktag')); $diskconfig = json_decode(getenv($disktag), true); @@ -72,7 +76,8 @@ function setConfig($arr, $disktag = '') $oparetdisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - $diskconfig[$k] = $v; + if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v)); + else $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { array_push($disktags, $v); @@ -82,7 +87,8 @@ function setConfig($arr, $disktag = '') $tmp[$v] = ''; $oparetdisk = 1; } else { - $tmp[$k] = $v; + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + else $tmp[$k] = $v; } } if ($indisk) { @@ -180,8 +186,7 @@ function get_refresh_token() $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; if ($_POST['Onedrive_ver']=='MSC') { $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = equal_replace(base64_encode($_POST['client_secret'])); - //$_POST['client_secret']; + $tmp['client_secret'] = $_POST['client_secret']; } $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; $title = getconstStr('MayinEnv'); @@ -276,7 +281,6 @@ namespace:' . $_SERVER['namespace'] . '
$trynum = 0; while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo ' '.++$trynum; - //$response = json_decode( updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; if (needUpdate()) { updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); return message('update to github version, reinstall.', 'Program updating', 201); From 9bf3969242789c62237706d2af02e53a3f356c1a Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 12:54:20 +0800 Subject: [PATCH 005/120] some config can input Special symbols now --- function/normal.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/function/normal.php b/function/normal.php index 7821695..0aa46e5 100644 --- a/function/normal.php +++ b/function/normal.php @@ -39,6 +39,7 @@ function getGET() function getConfig($str, $disktag = '') { global $InnerEnv; + global $Base64Env; //include 'config.php'; if ($disktag=='') $disktag = $_SERVER['disktag']; $s = file_get_contents('config.php'); @@ -46,8 +47,12 @@ function getConfig($str, $disktag = '') if ($configs!='') { $envs = json_decode($configs, true); if (in_array($str, $InnerEnv)) { - if (isset($envs[$disktag][$str])) return $envs[$disktag][$str]; - } else if (isset($envs[$str])) return $envs[$str]; + if (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$disktag][$str],1)); + else return $envs[$disktag][$str]; + } else { + if (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$str],1)); + else return $envs[$str]; + } } return ''; } @@ -55,6 +60,7 @@ function getConfig($str, $disktag = '') function setConfig($arr, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; //include 'config.php'; $s = file_get_contents('config.php'); @@ -65,7 +71,8 @@ function setConfig($arr, $disktag = '') $operatedisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - $envs[$disktag][$k] = $v; + if (in_array($k, $Base64Env)) $envs[$disktag][$k] = equal_replace(base64_encode($v)); + else $envs[$disktag][$k] = $v; /*$diskconfig[$k] = $v; $indisk = 1;*/ } elseif ($k=='disktag_add') { @@ -76,7 +83,8 @@ function setConfig($arr, $disktag = '') $envs[$v] = ''; $operatedisk = 1; } else { - $envs[$k] = $v; + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + else $tmp[$k] = $v; } } /*if ($indisk) { @@ -171,8 +179,7 @@ function get_refresh_token() $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; if ($_POST['Onedrive_ver']=='MSC') { $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = equal_replace(base64_encode($_POST['client_secret'])); - //$_POST['client_secret']; + $tmp['client_secret'] = $_POST['client_secret']; } $response = setConfig($tmp, $_COOKIE['disktag']); $title = getconstStr('MayinEnv'); From 07b89f0a0bc23f7b76b5401e9788ae156da49b46 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 12:55:07 +0800 Subject: [PATCH 006/120] some config can input Special symbols now --- function/heroku.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/function/heroku.php b/function/heroku.php index 7957b8c..d24e752 100644 --- a/function/heroku.php +++ b/function/heroku.php @@ -40,16 +40,20 @@ function getGET() function getConfig($str, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; if (in_array($str, $InnerEnv)) { - return json_decode(getenv($disktag), true)[$str]; + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1)); + else return json_decode(getenv($disktag), true)[$str]; } - return getenv($str); + if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1)); + else return getenv($str); } function setConfig($arr, $disktag = '') { global $InnerEnv; + global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; $disktags = explode("|",getConfig('disktag')); $diskconfig = json_decode(getenv($disktag), true); @@ -58,7 +62,8 @@ function setConfig($arr, $disktag = '') $oparetdisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - $diskconfig[$k] = $v; + if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v)); + else $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { array_push($disktags, $v); @@ -68,7 +73,8 @@ function setConfig($arr, $disktag = '') $tmp[$v] = ''; $oparetdisk = 1; } else { - $tmp[$k] = $v; + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + else $tmp[$k] = $v; } } if ($indisk) { @@ -158,7 +164,7 @@ function get_refresh_token() $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; if ($_POST['Onedrive_ver']=='MSC') { $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = equal_replace(base64_encode($_POST['client_secret'])); + $tmp['client_secret'] = $_POST['client_secret']; //$_POST['client_secret']; } $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; From c92ced6dc7d3296d00844d6d05bdf5e932df2187 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 12:58:31 +0800 Subject: [PATCH 007/120] some config can input Special symbols now --- function/common.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index b14dbc4..7102162 100644 --- a/function/common.php +++ b/function/common.php @@ -1,5 +1,30 @@ Date: Sat, 29 Feb 2020 13:01:44 +0800 Subject: [PATCH 008/120] Update version --- version | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/version b/version index a813a8f..6a2d5b4 100644 --- a/version +++ b/version @@ -1,7 +1,10 @@ +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,修复断网续传的问题。 - 20200222-2130.11 you can set background now. fix bug: 2nd disk upload. 可以设置背景图片了。第2个盘上传后链接不对。 From 4610d37976cd3b54f2575ada74ee1456ec14e1b8 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 13:56:35 +0800 Subject: [PATCH 009/120] fix bug --- function/scf.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/function/scf.php b/function/scf.php index f344ed8..3e62265 100644 --- a/function/scf.php +++ b/function/scf.php @@ -57,10 +57,10 @@ function getConfig($str, $disktag = '') global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; if (in_array($str, $InnerEnv)) { - if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1)); + if (in_array($str, $Base64Env)) return equal_replace(json_decode(getenv($disktag), true)[$str],1); else return json_decode(getenv($disktag), true)[$str]; } - if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1)); + if (in_array($str, $Base64Env)) return equal_replace(getenv($str),1); else return getenv($str); } @@ -76,7 +76,7 @@ function setConfig($arr, $disktag = '') $oparetdisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v); else $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { @@ -87,7 +87,7 @@ function setConfig($arr, $disktag = '') $tmp[$v] = ''; $oparetdisk = 1; } else { - if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v); else $tmp[$k] = $v; } } From 832e3b5d7f6ccc45669fa8ead68d5ef1c25faa6a Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 13:59:50 +0800 Subject: [PATCH 010/120] fix bug --- function/normal.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/function/normal.php b/function/normal.php index 0aa46e5..52e7476 100644 --- a/function/normal.php +++ b/function/normal.php @@ -47,10 +47,10 @@ function getConfig($str, $disktag = '') if ($configs!='') { $envs = json_decode($configs, true); if (in_array($str, $InnerEnv)) { - if (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$disktag][$str],1)); + if (in_array($str, $Base64Env)) return equal_replace($envs[$disktag][$str],1); else return $envs[$disktag][$str]; } else { - if (in_array($str, $Base64Env)) return base64_decode(equal_replace($envs[$str],1)); + if (in_array($str, $Base64Env)) return equal_replace($envs[$str],1); else return $envs[$str]; } } @@ -71,7 +71,7 @@ function setConfig($arr, $disktag = '') $operatedisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - if (in_array($k, $Base64Env)) $envs[$disktag][$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $envs[$disktag][$k] = equal_replace($v); else $envs[$disktag][$k] = $v; /*$diskconfig[$k] = $v; $indisk = 1;*/ @@ -83,7 +83,7 @@ function setConfig($arr, $disktag = '') $envs[$v] = ''; $operatedisk = 1; } else { - if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v); else $tmp[$k] = $v; } } From 7022a9c6b969272e8fab973f9209b01765b5b70a Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 14:01:38 +0800 Subject: [PATCH 011/120] fix bug --- function/heroku.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/function/heroku.php b/function/heroku.php index d24e752..3e3af96 100644 --- a/function/heroku.php +++ b/function/heroku.php @@ -43,10 +43,10 @@ function getConfig($str, $disktag = '') global $Base64Env; if ($disktag=='') $disktag = $_SERVER['disktag']; if (in_array($str, $InnerEnv)) { - if (in_array($str, $Base64Env)) return base64_decode(equal_replace(json_decode(getenv($disktag), true)[$str],1)); + if (in_array($str, $Base64Env)) return equal_replace(json_decode(getenv($disktag), true)[$str],1); else return json_decode(getenv($disktag), true)[$str]; } - if (in_array($str, $Base64Env)) return base64_decode(equal_replace(getenv($str),1)); + if (in_array($str, $Base64Env)) return equal_replace(getenv($str),1); else return getenv($str); } @@ -62,7 +62,7 @@ function setConfig($arr, $disktag = '') $oparetdisk = 0; foreach ($arr as $k => $v) { if (in_array($k, $InnerEnv)) { - if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $diskconfig[$k] = equal_replace($v); else $diskconfig[$k] = $v; $indisk = 1; } elseif ($k=='disktag_add') { @@ -73,7 +73,7 @@ function setConfig($arr, $disktag = '') $tmp[$v] = ''; $oparetdisk = 1; } else { - if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace(base64_encode($v)); + if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v); else $tmp[$k] = $v; } } From 7f566bcc0d6b455cd81d32bcd4ad31aaa20d48f4 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 14:02:13 +0800 Subject: [PATCH 012/120] fix bug --- function/common.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/function/common.php b/function/common.php index 7102162..43302eb 100644 --- a/function/common.php +++ b/function/common.php @@ -191,7 +191,9 @@ function equal_replace($str, $add = false) { if ($add) { while(strlen($str)%4) $str .= '='; + $str = urldecode(base64_decode($str)); } else { + $str = base64_encode(urlencode($str)); while(substr($str,-1)=='=') $str=substr($str,0,-1); } return $str; From e33f3ee059e8d4073e181e3556b78e7d85a63360 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 29 Feb 2020 18:57:33 +0800 Subject: [PATCH 013/120] fix bug! --- function/normal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function/normal.php b/function/normal.php index 52e7476..1953922 100644 --- a/function/normal.php +++ b/function/normal.php @@ -83,8 +83,8 @@ function setConfig($arr, $disktag = '') $envs[$v] = ''; $operatedisk = 1; } else { - if (in_array($k, $Base64Env)) $tmp[$k] = equal_replace($v); - else $tmp[$k] = $v; + if (in_array($k, $Base64Env)) $envs[$k] = equal_replace($v); + else $envs[$k] = $v; } } /*if ($indisk) { From 030d26e074d8fdc7ed17351946e8f08348445bb7 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 1 Mar 2020 13:02:20 +0800 Subject: [PATCH 014/120] Update common.php --- function/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 43302eb..f9b87e6 100644 --- a/function/common.php +++ b/function/common.php @@ -280,14 +280,14 @@ function gethiddenpass($path,$passfile) $passwordf=explode("\n",$arr['body']); $password=$passwordf[0]; $password=md5($password); - savecache($path . '/password', $password); + savecache('path_' . $path . '/?password', $password); return $password; } else { //return md5('DefaultP@sswordWhenNetworkError'); return md5( md5(time()).rand(1000,9999) ); } } else { - savecache($path . '/password', 'null'); + savecache('path_' . $path . '/?password', 'null'); if ($path !== '' ) { $path = substr($path,0,strrpos($path,'/')); return gethiddenpass($path,$passfile); From 6bec40d7869cb306f31052a49399035617314a4e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Mon, 2 Mar 2020 17:10:00 +0800 Subject: [PATCH 015/120] differentiate current disk --- theme/classic.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index 1a844d3..ba0753d 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -10,7 +10,7 @@ + + + +
+ + + +
    • + +
    • +
    • +
    • + +
    • +
    • +
  • + + +
    + +
    + +

    + +

    +1) { ?> +
    +
    +
    +
    +=strlen(path_format($_SERVER['base_path'].'/'.$disk))){ + if(substr($_SERVER['REQUEST_URI'],0,strlen(path_format($_SERVER['base_path'].'/'.$disk)))===path_format($_SERVER['base_path'].'/'.$disk)) + echo ''.$diskname.''; + else + echo ''.$diskname.''; + } + else + echo ''.$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').''; + } ?> +
    +
    + +
          
    -
  • +
    • @@ -228,7 +229,7 @@
    -
  •     + @@ -253,14 +254,14 @@
    -
  • +
    -
  •     + @@ -285,7 +286,7 @@ - +
    + + + + + + + + + + + + +'; + 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; + } + } ?> +
    +
    +
    + + + +
    + + + + + + +
    + + + +
    +
    Powred by 逸笙 | Theme by 若离
    + + + + + + + + + + From 1a7358672c9c9250e6e0bdf1184a598a49f04419 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 3 Mar 2020 15:17:38 +0800 Subject: [PATCH 024/120] try to fix encrypt cache --- function/common.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/function/common.php b/function/common.php index 7381c7d..effc37a 100644 --- a/function/common.php +++ b/function/common.php @@ -270,7 +270,8 @@ function encode_str_replace($str) function gethiddenpass($path,$passfile) { - $password=getcache('path_' . $path . '/?password'); + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + $password = getcache('path_' . $path1 . '/?password'); if ($password=='') { $ispassfile = fetch_files(spurlencode(path_format($path . '/' . $passfile),'/')); //echo $path . '
    ' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '
    '; @@ -280,14 +281,14 @@ function gethiddenpass($path,$passfile) $passwordf=explode("\n",$arr['body']); $password=$passwordf[0]; $password=md5($password); - savecache('path_' . $path . '/?password', $password); + savecache('path_' . $path1 . '/?password', $password); return $password; } else { //return md5('DefaultP@sswordWhenNetworkError'); return md5( md5(time()).rand(1000,9999) ); } } else { - savecache('path_' . $path . '/?password', 'null'); + savecache('path_' . $path1 . '/?password', 'null'); if ($path !== '' ) { $path = substr($path,0,strrpos($path,'/')); return gethiddenpass($path,$passfile); @@ -793,8 +794,8 @@ function adminoperate($path) return output($result['body'], $result['stat']); } if ($_GET['RefreshCache']) { + $path1 = path_format($_SERVER['list_path'] . path_format($path)); savecache('path_' . $path1 . '/?password', '', 1); - savecache('path_' . $path . '/?password', '', 1); return message('', getconstStr('RefreshCache'), 302); } return $tmparr; From 4aff58c777a959771c16a36da79a6de5ca68bd67 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:45:33 +0800 Subject: [PATCH 025/120] 2nd try to fix encrypt cache --- function/common.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/function/common.php b/function/common.php index effc37a..8c50136 100644 --- a/function/common.php +++ b/function/common.php @@ -271,16 +271,16 @@ function encode_str_replace($str) function gethiddenpass($path,$passfile) { $path1 = path_format($_SERVER['list_path'] . path_format($path)); - $password = getcache('path_' . $path1 . '/?password'); + $password=getcache('path_' . $path1 . '/?password'); if ($password=='') { - $ispassfile = fetch_files(spurlencode(path_format($path . '/' . $passfile),'/')); + $ispassfile = fetch_files(path_format($path . '/' . urlencode($passfile))); //echo $path . '
    ' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '
    '; if (isset($ispassfile['file'])) { $arr = curl_request($ispassfile['@microsoft.graph.downloadUrl']); if ($arr['stat']==200) { $passwordf=explode("\n",$arr['body']); $password=$passwordf[0]; - $password=md5($password); + if ($password!='') $password=md5($password); savecache('path_' . $path1 . '/?password', $password); return $password; } else { @@ -395,6 +395,7 @@ function passhidden($path) $path = str_replace('+','%2B',$path); $path = str_replace('&','&', path_format(urldecode($path))); if (getConfig('passfile') != '') { + $path = spurlencode($path,'/'); if (substr($path,-1)=='/') $path=substr($path,0,-1); $hiddenpass=gethiddenpass($path,getConfig('passfile')); if ($hiddenpass != '') { @@ -707,7 +708,8 @@ function adminoperate($path) $filename = path_format($path1 . '/' . $foldername . '/' . getConfig('passfile')); //echo $foldername; $result = MSAPI('PUT', $filename, $_GET['encrypt_newpass'], $_SERVER['access_token']); - //savecache('path_' . $path1, json_decode('{}',true), 1); + $path1 = path_format($path1 . '/' . $foldername ); + savecache('path_' . $path1 . '/?password', '', 1); return output($result['body'], $result['stat']); } if ($_GET['move_folder']!='') { From be2f353639b55ae1177faf24399348184e797934 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 4 Mar 2020 10:42:01 +0800 Subject: [PATCH 026/120] switch, can downloaded or not while encrpyt --- function/common.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/function/common.php b/function/common.php index 8c50136..afb5efa 100644 --- a/function/common.php +++ b/function/common.php @@ -8,7 +8,9 @@ $Base64Env = [ //'admin', //'adminloginpage', 'background', + 'diskname', //'disktag', + //'downloadencrypt', //'function_name', // used in heroku. //'language', //'passfile', @@ -19,7 +21,6 @@ $Base64Env = [ 'client_secret', 'domain_path', 'guestup_path', - 'diskname', 'public_path', //'refresh_token', //'token_expires', @@ -61,9 +62,10 @@ $InnerEnv = [ 'Onedrive_ver', 'client_id', 'client_secret', - 'domain_path', - 'guestup_path', 'diskname', + 'domain_path', + 'downloadencrypt', + 'guestup_path', 'public_path', 'refresh_token', 'token_expires', @@ -73,9 +75,10 @@ $ShowedInnerEnv = [ //'Onedrive_ver', //'client_id', //'client_secret', - 'domain_path', - 'guestup_path', 'diskname', + 'domain_path', + 'downloadencrypt', + 'guestup_path', 'public_path', //'refresh_token', //'token_expires', @@ -613,7 +616,7 @@ function main($path) $files = list_files($path); if (isset($files['file']) && !$_GET['preview']) { // is file && not preview mode - if ($_SERVER['ishidden']<4) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); + if ( $_SERVER['ishidden']<4 || (getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); } if ( isset($files['folder']) || isset($files['file']) ) { return render_list($path, $files); @@ -628,8 +631,8 @@ function list_files($path) $path = path_format($path); if ($_SERVER['is_guestup_path']&&!$_SERVER['admin']) { $files = json_decode('{"folder":{}}', true); - } elseif ($_SERVER['ishidden']==4) { - $files = json_decode('{"folder":{}}', true); + } elseif (!getConfig('downloadencrypt')) { + if ($_SERVER['ishidden']==4) $files = json_decode('{"folder":{}}', true); } else { $files = fetch_files($path); } From fcfc50d4b8adaa2c756757551a11aa74d72552e3 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 4 Mar 2020 11:50:01 +0800 Subject: [PATCH 027/120] fix download encrypt file --- function/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index afb5efa..a60a01f 100644 --- a/function/common.php +++ b/function/common.php @@ -616,7 +616,7 @@ function main($path) $files = list_files($path); if (isset($files['file']) && !$_GET['preview']) { // is file && not preview mode - if ( $_SERVER['ishidden']<4 || (getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); + if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); } if ( isset($files['folder']) || isset($files['file']) ) { return render_list($path, $files); @@ -633,6 +633,7 @@ function list_files($path) $files = json_decode('{"folder":{}}', true); } elseif (!getConfig('downloadencrypt')) { if ($_SERVER['ishidden']==4) $files = json_decode('{"folder":{}}', true); + else $files = fetch_files($path); } else { $files = fetch_files($path); } From 9ef2fa5c51194ce4f668686a653255939e19eb32 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 4 Mar 2020 12:47:13 +0800 Subject: [PATCH 028/120] Update conststr.php --- conststr.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 9a494c3..2be8e31 100644 --- a/conststr.php +++ b/conststr.php @@ -3,7 +3,7 @@ $exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp']; $exts['music'] = ['mp3', 'wma', 'flac', 'wav', 'ogg']; $exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']; -$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'json', 'html', 'c', 'md']; +$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'json', 'html', 'c', 'md', 'py']; $exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8']; $exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar']; @@ -69,6 +69,7 @@ $constStr = [ 'domain_path' => 'more custom domain, format is a1.com:/dirto/path1|b2.com:/path2', 'diskname' => 'The disk name you want show.', 'disktag' => 'A tag used in store config and url.', + '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.', 'passfile' => 'The password of dir will save in this file.', @@ -82,6 +83,7 @@ $constStr = [ 'domain_path' => '使用多个自定义域名时,指定每个域名看到的目录。格式为a1.com:/dirto/path1|b1.com:/path2,比private_path优先。', 'diskname' => '这个盘你想显示什么名称。', 'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。', + 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', 'background' => '设置一个url作为背景,或者在你显示的目录放一个background.jpg文件。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', @@ -95,6 +97,7 @@ $constStr = [ 'domain_path' => '複数のカスタムドメイン名を使用する場合、各ドメイン名に表示されるディレクトリを指定します。形式はa1.com:/dirto/path1|b1.com:/path2で、private_pathよりも優先されます。', 'diskname' => '', 'disktag' => '', + 'downloadencrypt' => '', 'background' => '', 'guestup_path' => 'マップベッドのパスを設定します。この値が設定されていない場合、ディレクトリの内容は通常ファイルにリストされ、設定後はアップロードインターフェイスのみが表示されます。', 'passfile' => 'カスタムパスワードファイルの名前は、\'pppppp \'、\'aaaa.txt \'などの場合があります。ディレクトリをリストするときには表示されません。パスワードを知っている場合にのみ、このファイルを表示またはダウンロードできます。 パスワードはこのファイルの内容であり、スペースまたは漢字を使用できます。', @@ -108,6 +111,7 @@ $constStr = [ 'domain_path' => '여러 개의 사용자 정의 도메인 이름을 사용하는 경우 각 도메인 이름에 표시되는 디렉토리를 지정하십시오. 형식은 a1.com:/dirto/path1|b1.com:/path2이며 private_path보다 우선합니다.', 'diskname' => '이 디스크에 어떤 이름을 표시 하시겠습니까?', 'disktag' => '레이블은 구성을 저장하는 데 사용되며 디스크가 여러 개인 경우 URL에 표시됩니다.', + 'downloadencrypt' => '', 'background' => 'URL을 배경으로 설정하거나 표시하는 디렉토리에 background.jpg 파일을 넣으십시오.', 'guestup_path' => '방문자의 업로드 경로 (맵 베드 경로)를 설정합니다.이 값을 설정하지 않으면 디렉토리의 내용이 파일로 표시되고 설정 후에는 업로드 인터페이스 만 표시되고 파일은 표시되지 않습니다 (로그인 후 표시).', 'passfile' => '사용자 정의 비밀번호 파일의 이름은 \'pppppp\' \'aaaa.txt \'등이 될 수 있으며 디렉토리가 나열되어 있으면 표시되지 않으며 비밀번호를 알고있는 경우에만이 파일을 보거나 다운로드 할 수 있습니다. 암호는이 파일의 내용이며 공백이거나 한국어 일 수 있습니다.', @@ -121,6 +125,7 @@ $constStr = [ 'domain_path' => 'تنظیم دامنه سفارشی، به صورت a1.com:/dirto/path1|b2.com:/path2', 'diskname' => 'نام دیسک که می‌خواهید نشان دهید.', 'disktag' => 'تگی که در ذخیره پیکربندی و نشانی اینترنتی استفاده می‌شود.', + 'downloadencrypt' => '', 'background' => 'تنظیم عکس پشت زمینه به صورت url یا قرار دادن بک گراند به صورت دستی در مسیر نشان داده شده.', 'guestup_path' => 'قبل از تنظیم این گزینه ، فایل آپلود guest را تنظیم کنید ، پرونده های موجود در این حالت به صورت عادی نشان داده می شوند.', 'passfile' => 'رمز عبور dir در این فایل ذخیره می شود.', From 7b8b41abbbedfe6dcb11b1615bd82ab5ef20e32c Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 4 Mar 2020 12:48:58 +0800 Subject: [PATCH 029/120] Create lybwb.php --- theme/lybwb.php | 1278 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1278 insertions(+) create mode 100644 theme/lybwb.php diff --git a/theme/lybwb.php b/theme/lybwb.php new file mode 100644 index 0000000..42eb992 --- /dev/null +++ b/theme/lybwb.php @@ -0,0 +1,1278 @@ + + + + + <?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; + } + } ?> +
    +
    +
    + + + +
    + + + + + + +
    + + + +
    + + + + +
    + + + + + + + + + + From a30eb7650f2edadaa2ff2c3c8a5e9c491c725ee4 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 4 Mar 2020 12:54:50 +0800 Subject: [PATCH 030/120] Delete whiteblue.php --- theme/whiteblue.php | 1277 ------------------------------------------- 1 file changed, 1277 deletions(-) delete mode 100644 theme/whiteblue.php diff --git a/theme/whiteblue.php b/theme/whiteblue.php deleted file mode 100644 index a298925..0000000 --- a/theme/whiteblue.php +++ /dev/null @@ -1,1277 +0,0 @@ - - - - - <?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; - } - } ?> -
    -
    -
    - - - -
    - - - - - - -
    - - - -
    - - - - -
    - - - - - - - - - - From 8e7c16305f8de227e2e806d279d7df445d6562c2 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 10:56:58 +0800 Subject: [PATCH 031/120] Create update.sh --- update.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 update.sh diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..f4cc597 --- /dev/null +++ b/update.sh @@ -0,0 +1,12 @@ +#!bash + +gitsource='https://github.com/qkqpttgf/OneManager-php' + +git clone ${gitsource} +\mv -b config.php OneManager-php/ +\mv -b OneManager-php/* ./ +\mv -b OneManager-php/.[^.]* ./ +rm -rf *~ +rm -rf .[^.]*~ +rm -rf OneManager-php +chmod 666 config.php From 284e080ae75abd6d0c0b2b74b0f705dce5c714e4 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:02:49 +0800 Subject: [PATCH 032/120] Update update.sh --- update.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/update.sh b/update.sh index f4cc597..cb2c7ff 100644 --- a/update.sh +++ b/update.sh @@ -2,6 +2,9 @@ gitsource='https://github.com/qkqpttgf/OneManager-php' +OneManagerPath=`cd $(dirname $0);pwd -P` +cd ${OneManagerPath} + git clone ${gitsource} \mv -b config.php OneManager-php/ \mv -b OneManager-php/* ./ @@ -10,3 +13,4 @@ rm -rf *~ rm -rf .[^.]*~ rm -rf OneManager-php chmod 666 config.php + From 2bd06bc0355c025b2f7bfb124be156d31eacae46 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:37:52 +0800 Subject: [PATCH 033/120] move get token function oprate function --- function/common.php | 298 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 297 insertions(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index a60a01f..dc18bec 100644 --- a/function/common.php +++ b/function/common.php @@ -540,7 +540,7 @@ function main($path) if ($_GET['setup']) if ($_SERVER['admin']) { // setup Environments. 设置,对环境变量操作 - return EnvOpt($_SERVER['function_name'], $_SERVER['needUpdate']); + return EnvOpt($_SERVER['needUpdate']); } else { $url = path_format($_SERVER['PHP_SELF'] . '/'); return output('', 302, [ 'Location' => $url ]); @@ -1089,3 +1089,299 @@ function render_list($path = '', $files = '') if ($_SERVER['Set-Cookie']!='') return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]); return output($html,$statusCode); } + +function get_refresh_token() +{ + global $constStr; + global $CommonEnv; + foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', '; + $url = path_format($_SERVER['PHP_SELF'] . '/'); + if ($_GET['authorization_code'] && isset($_GET['code'])) { + $_SERVER['disktag'] = $_COOKIE['disktag']; + config_oauth(); + $tmp = curl_request($_SERVER['oauth_url'] . 'token', 'client_id=' . $_SERVER['client_id'] .'&client_secret=' . $_SERVER['client_secret'] . '&grant_type=authorization_code&requested_token_use=on_behalf_of&redirect_uri=' . $_SERVER['redirect_uri'] .'&code=' . $_GET['code']); + if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true); + if (isset($ret['refresh_token'])) { + $tmptoken = $ret['refresh_token']; + $str = ' + refresh_token :
    '; + $str .= ' +

    + '.getconstStr('SavingToken').' + '; + setConfig([ 'refresh_token' => $tmptoken, 'token_expires' => time()+30*24*60*60 ], $_COOKIE['disktag']); + savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60); + //WaitSCFStat(); + $str .= ' + '; + return message($str, getconstStr('WaitJumpIndex')); + } + return message('
    ' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '
    ', $tmp['stat']); + //return message('
    ' . json_encode($ret, JSON_PRETTY_PRINT) . '
    ', 500); + } + if ($_GET['install1']) { + $_SERVER['disk_oprating'] = $_COOKIE['disktag']; + $_SERVER['disktag'] = $_COOKIE['disktag']; + config_oauth(); + if (getConfig('Onedrive_ver')=='MS' || getConfig('Onedrive_ver')=='CN' || getConfig('Onedrive_ver')=='MSC') { + return message(' + '.getconstStr('JumptoOffice').' + + ', getconstStr('Wait').' 1s', 201); + } else { + return message('something error, try after a few seconds.', 'retry', 201); + } + } + if ($_GET['install0']) { + if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { + if (in_array($_COOKIE['disktag'], $CommonEnv)) { + return message('Do not input ' . $envs . '
    ', 'Error', 201); + } + $_SERVER['disktag'] = $_COOKIE['disktag']; + $tmp['disktag_add'] = $_POST['disktag_add']; + $tmp['diskname'] = $_POST['diskname']; + $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; + if ($_POST['Onedrive_ver']=='MSC') { + $tmp['client_id'] = $_POST['client_id']; + $tmp['client_secret'] = $_POST['client_secret']; + } + $response = setConfigResponse( setConfig($tmp, $_COOKIE['disktag']) ); + $title = getconstStr('MayinEnv'); + $html = getconstStr('Wait') . ' 3s'; + if (api_error($response)) { + $html = api_error_msg($response); + $title = 'Error'; + } + return message($html, $title, 201); + } + } + + if ($constStr['language']!='zh-cn') { + $linklang='en-us'; + } else $linklang='zh-cn'; + $ru = "https://developer.microsoft.com/".$linklang."/graph/quick-start?appID=_appId_&appName=_appName_&redirectUrl=".$_SERVER['redirect_uri']."&platform=option-php"; + $deepLink = "/quickstart/graphIO?publicClientSupport=false&appName=OneManager&redirectUrl=".$_SERVER['redirect_uri']."&allowImplicitFlow=false&ru=".urlencode($ru); + $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink); + $html = ' +
    + '.getconstStr('OnedriveDiskTag').':
    + '.getconstStr('OnedriveDiskName').':
    + Onedrive_Ver:
    +
    +
    +
    + +
    + '; + $title = 'Bind Onedrive'; + return message($html, $title, 201); +} + +function EnvOpt($needUpdate = 0) +{ + global $constStr; + global $ShowedCommonEnv; + global $ShowedInnerEnv; + asort($ShowedCommonEnv); + asort($ShowedInnerEnv); + $html = 'OneManager '.getconstStr('Setup').''; + if ($_POST['updateProgram']==getconstStr('updateProgram')) { + $response = OnekeyUpate(); + if (api_error($response)) { + $html = api_error_msg($response); + $title = 'Error'; + } else { + //WaitSCFStat(); + $html .= getconstStr('UpdateSuccess') . '
    +'; + $title = getconstStr('Setup'); + } + return message($html, $title); + } + if ($_POST['submit1']) { + $_SERVER['disk_oprating'] = ''; + foreach ($_POST as $k => $v) { + if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') { + $tmp[$k] = $v; + } + if ($k == 'disk') $_SERVER['disk_oprating'] = $v; + } + /*if ($tmp['domain_path']!='') { + $tmp1 = explode("|",$tmp['domain_path']); + $tmparr = []; + foreach ($tmp1 as $multidomain_paths){ + $pos = strpos($multidomain_paths,":"); + if ($pos>0) $tmparr[substr($multidomain_paths, 0, $pos)] = path_format(substr($multidomain_paths, $pos+1)); + } + $tmp['domain_path'] = $tmparr; + }*/ + $response = setConfigResponse( setConfig($tmp, $_SERVER['disk_oprating']) ); + if (api_error($response)) { + $html = api_error_msg($response); + $title = 'Error'; + } else { + //WaitSCFStat(); + //sleep(3); + $html .= 'Success!
    +'; + $title = getconstStr('Setup'); + } + return message($html, $title); + } + if ($_GET['preview']) { + $preurl = $_SERVER['PHP_SELF'] . '?preview'; + } else { + $preurl = path_format($_SERVER['PHP_SELF'] . '/'); + } + $html .= ' +'.getconstStr('Back').'   '.getconstStr('Back').getconstStr('Home').'
    +Github
    '; + if (!$_SERVER['USER']==='qcloud'&&!$_SERVER['HEROKU_APP_DIR']==='/app') { + $html .= ' +In VPS, can not update by a click!
    '; + } else { + $html .= ' +
    +'; + if ($needUpdate) { + $html .= '
    ' . $_SERVER['github_version'] . '
    '; + } else { + $html .= getconstStr('NotNeedUpdate'); + } + $html .= ' + +
    '; + } + $html .= ' + + + + + '; + foreach ($ShowedCommonEnv as $key) { + if ($key=='language') { + $html .= ' + + + + '; + } elseif ($key=='theme') { + $theme_arr = scandir('theme'); + $html .= ' + + + + '; + } /*elseif ($key=='domain_path') { + $tmp = getConfig($key); + $domain_path = ''; + foreach ($tmp as $k1 => $v1) { + $domain_path .= $k1 . ':' . $v1 . '|'; + } + $domain_path = substr($domain_path, 0, -1); + $html .= ' + + + + '; + }*/ else $html .= ' + + + + '; + } + $html .= ' + + +
    '.getconstStr('PlatformConfig').'
    + +
    + +

    '; + foreach (explode("|",getConfig('disktag')) as $disktag) { + if ($disktag!='') { + $html .= ' + + + + + + '; + if (getConfig('refresh_token', $disktag)!='') { + $html .= ' + + '; + foreach ($ShowedInnerEnv as $key) { + $html .= ' + + + + '; + } + $html .= ' + + '; + } + $html .= ' +
    '.$disktag.': + + +

    '; + } + } + $html .= ' +'.getconstStr('AddDisk').''; + return message($html, getconstStr('Setup')); +} From 942da1570f7e35fa45caa514be3b04cdb3aa0f4e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:39:04 +0800 Subject: [PATCH 034/120] move get token function oprate function --- function/heroku.php | 330 +++----------------------------------------- 1 file changed, 22 insertions(+), 308 deletions(-) diff --git a/function/heroku.php b/function/heroku.php index f1c0c6c..32f3b1e 100644 --- a/function/heroku.php +++ b/function/heroku.php @@ -93,141 +93,6 @@ function setConfig($arr, $disktag = '') return setHerokuConfig($tmp, getConfig('function_name'), getConfig('APIKey')); } -function get_refresh_token() -{ - global $constStr; - global $CommonEnv; - foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', '; - $url = path_format($_SERVER['PHP_SELF'] . '/'); - if ($_GET['authorization_code'] && isset($_GET['code'])) { - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - $tmp = curl_request($_SERVER['oauth_url'] . 'token', 'client_id=' . $_SERVER['client_id'] .'&client_secret=' . $_SERVER['client_secret'] . '&grant_type=authorization_code&requested_token_use=on_behalf_of&redirect_uri=' . $_SERVER['redirect_uri'] .'&code=' . $_GET['code']); - if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true); - if (isset($ret['refresh_token'])) { - $tmptoken = $ret['refresh_token']; - $str = ' - refresh_token :
    '; - /*for ($i=1;strlen($tmptoken)>0;$i++) { - $t['t' . $i] = substr($tmptoken,0,128); - $str .= ' - t' . $i . ':

    '; - $tmptoken=substr($tmptoken,128); - } - $str .= ' - Add t1-t'.--$i.' to environments.*/ - $str .= ' -

    - '.getconstStr('SavingToken').' - '; - setConfig([ 'refresh_token' => $tmptoken, 'token_expires' => time()+30*24*60*60 ], $_COOKIE['disktag']); - savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60); - $str .= ' - '; - return message($str, getconstStr('WaitJumpIndex')); - } - return message('
    ' . $tmp['body'] . '
    ', $tmp['stat']); - //return message('
    ' . json_encode($ret, JSON_PRETTY_PRINT) . '
    ', 500); - } - if ($_GET['install1']) { - $_SERVER['disk_oprating'] = $_COOKIE['disktag']; - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - if (getConfig('Onedrive_ver')=='MS' || getConfig('Onedrive_ver')=='CN' || getConfig('Onedrive_ver')=='MSC') { - return message(' - '.getconstStr('JumptoOffice').' - - ', getconstStr('Wait').' 1s', 201); - } - } - if ($_GET['install0']) { - if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { - if (in_array($_COOKIE['disktag'], $CommonEnv)) { - return message('Do not input ' . $envs . '
    ', 'Error', 201); - } - $_SERVER['disktag'] = $_COOKIE['disktag']; - $tmp['disktag_add'] = $_POST['disktag_add']; - $tmp['diskname'] = $_POST['diskname']; - $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; - if ($_POST['Onedrive_ver']=='MSC') { - $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = $_POST['client_secret']; - //$_POST['client_secret']; - } - $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; - $title = getconstStr('MayinEnv'); - $html = getconstStr('Wait') . ' 3s'; - if (isset($response['id'])&&isset($response['message'])) { - $html = $response['id'] . '
    -' . $response['message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -'; - $title = 'Error'; - } - return message($html, $title, 201); - } - } - - if ($constStr['language']!='zh-cn') { - $linklang='en-us'; - } else $linklang='zh-cn'; - $ru = "https://developer.microsoft.com/".$linklang."/graph/quick-start?appID=_appId_&appName=_appName_&redirectUrl=".$_SERVER['redirect_uri']."&platform=option-php"; - $deepLink = "/quickstart/graphIO?publicClientSupport=false&appName=OneManager&redirectUrl=".$_SERVER['redirect_uri']."&allowImplicitFlow=false&ru=".urlencode($ru); - $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink); - $html = ' -
    - '.getconstStr('OnedriveDiskTag').':
    - '.getconstStr('OnedriveDiskName').':
    - Onedrive_Ver:
    -
    -
    -
    - -
    - '; - $title = 'Bind Onedrive'; - return message($html, $title, 201); -} - function install() { global $constStr; @@ -249,11 +114,8 @@ function install() $tmp['function_name'] = $function_name; } $response = json_decode(setHerokuConfig($tmp, $function_name, $APIKey)['body'], true); - if (isset($response['id'])&&isset($response['message'])) { - $html = $response['id'] . '
    -' . $response['message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -'; + if (api_error($response)) { + $html = api_error_msg($response); $title = 'Error'; } else { return output('Jump', 302); @@ -358,173 +220,25 @@ function updateHerokuapp($function_name, $apikey) return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $function_name . '/builds', $data, $apikey); } -function EnvOpt($function_name, $needUpdate = 0) +function api_error($response) { - global $constStr; - global $ShowedCommonEnv; - global $ShowedInnerEnv; - asort($ShowedCommonEnv); - asort($ShowedInnerEnv); - $html = 'OneManager '.getconstStr('Setup').''; - if ($_POST['updateProgram']==getconstStr('updateProgram')) { - $response = json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true); - if (isset($response['id'])&&isset($response['message'])) { - $html = $response['id'] . '
    -' . $response['message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -'; - $title = 'Error'; - } else { - $html .= getconstStr('UpdateSuccess') . '
    -'; - $title = getconstStr('Setup'); - } - return message($html, $title); - } - if ($_POST['submit1']) { - foreach ($_POST as $k => $v) { - if (in_array($k, $constEnv)) { - if (!(getConfig($k)==''&&$v=='')) $tmp[$k] = $v; - } - } - $_SERVER['disk_oprating'] = ''; - foreach ($_POST as $k => $v) { - if (in_array($k, $ShowedCommonEnv)) { - if (!(getConfig($k)==''&&$v=='')) $tmp[$k] = $v; - } - if (in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') { - $tmp[$k] = $v; - } - if ($k == 'disk') $_SERVER['disk_oprating'] = $v; - } - /*if ($tmp['domain_path']!='') { - $tmp1 = explode("|",$tmp['domain_path']); - $tmparr = []; - foreach ($tmp1 as $multidomain_paths){ - $pos = strpos($multidomain_paths,":"); - if ($pos>0) $tmparr[substr($multidomain_paths, 0, $pos)] = path_format(substr($multidomain_paths, $pos+1)); - } - $tmp['domain_path'] = $tmparr; - }*/ - $response = json_decode(setConfig($tmp, $_SERVER['disk_oprating'])['body'], true); - if (isset($response['id'])&&isset($response['message'])) { - $html = $response['id'] . '
    -' . $response['message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -'; - $title = 'Error'; - } else { - $html .= ''; - } - } - if ($_GET['preview']) { - $preurl = $_SERVER['PHP_SELF'] . '?preview'; - } else { - $preurl = path_format($_SERVER['PHP_SELF'] . '/'); - } - $html .= ' -'.getconstStr('Back').'   '.getconstStr('Back').getconstStr('Home').'
    -Github
    -
    -'; - if ($needUpdate) { - $html .= '
    ' . $_SERVER['github_version'] . '
    '; - } else { - $html .= getconstStr('NotNeedUpdate'); - } - $html .= ' - -
    - - - - - '; - foreach ($ShowedCommonEnv as $key) { - if ($key=='language') { - $html .= ' - - - - '; - } elseif ($key=='theme') { - $theme_arr = scandir('theme'); - $html .= ' - - - - '; - } /*elseif ($key=='domain_path') { - $tmp = getConfig($key); - $domain_path = ''; - foreach ($tmp as $k1 => $v1) { - $domain_path .= $k1 . ':' . $v1 . '|'; - } - $domain_path = substr($domain_path, 0, -1); - $html .= ' - - - - '; - }*/ else $html .= ' - - - - '; - } - $html .= ' - - -
    '.getconstStr('PlatformConfig').'
    - -
    - -

    '; - foreach (explode("|",getConfig('disktag')) as $disktag) { - if ($disktag!='') { - $html .= ' - - - - - - '; - if (getConfig('refresh_token', $disktag)!='') { - $html .= ' - - '; - foreach ($ShowedInnerEnv as $key) { - $html .= ' - - - - '; - } - $html .= ' - - '; - } - $html .= ' -
    '.$disktag.': - - -

    '; - } - } - $html .= ' -'.getconstStr('AddDisk').''; - return message($html, getconstStr('Setup')); + return isset($response['id'])&&isset($response['message']); +} + +function api_error_msg($response) +{ + return $response['id'] . '
    +' . $response['message'] . '

    +function_name:' . $_SERVER['function_name'] . '
    +'; +} + +function OnekeyUpate() +{ + return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true); +} + +function setConfigResponse($response) +{ + return json_decode( $response['body'], true ); } From 75d3f0371d31244c3f7011bfa3d5d324577d4383 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:39:50 +0800 Subject: [PATCH 035/120] move get token function oprate function --- function/normal.php | 320 ++++---------------------------------------- 1 file changed, 23 insertions(+), 297 deletions(-) diff --git a/function/normal.php b/function/normal.php index 7cf20b3..e6a4d95 100644 --- a/function/normal.php +++ b/function/normal.php @@ -108,139 +108,6 @@ function setConfig($arr, $disktag = '') return file_put_contents('config.php', $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr); } -function get_refresh_token() -{ - global $constStr; - global $CommonEnv; - foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', '; - $url = path_format($_SERVER['PHP_SELF'] . '/'); - if ($_GET['authorization_code'] && isset($_GET['code'])) { - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - $tmp = curl_request($_SERVER['oauth_url'] . 'token', 'client_id=' . $_SERVER['client_id'] .'&client_secret=' . $_SERVER['client_secret'] . '&grant_type=authorization_code&requested_token_use=on_behalf_of&redirect_uri=' . $_SERVER['redirect_uri'] .'&code=' . $_GET['code']); - if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true); - if (isset($ret['refresh_token'])) { - $tmptoken = $ret['refresh_token']; - $str = ' - refresh_token :
    '; - /*for ($i=1;strlen($tmptoken)>0;$i++) { - $t['t' . $i] = substr($tmptoken,0,128); - $str .= ' - t' . $i . ':

    '; - $tmptoken=substr($tmptoken,128); - } - $str .= ' - Add t1-t'.--$i.' to environments.*/ - $str .= ' -

    - '.getconstStr('SavingToken').' - '; - setConfig([ 'refresh_token' => $tmptoken, 'token_expires' => time()+30*24*60*60 ], $_COOKIE['disktag']); - savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60); - $str .= ' - '; - return message($str, getconstStr('WaitJumpIndex')); - } - return message('
    ' . $tmp['body'] . '
    ', $tmp['stat']); - //return message('
    ' . json_encode($ret, JSON_PRETTY_PRINT) . '
    ', 500); - } - if ($_GET['install1']) { - $_SERVER['disk_oprating'] = $_COOKIE['disktag']; - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - if (getConfig('Onedrive_ver')=='MS' || getConfig('Onedrive_ver')=='CN' || getConfig('Onedrive_ver')=='MSC') { - return message(' - '.getconstStr('JumptoOffice').' - - ', getconstStr('Wait').' 1s', 201); - } - } - if ($_GET['install0']) { - if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { - if (in_array($_COOKIE['disktag'], $CommonEnv)) { - return message('Do not input ' . $envs . '
    ', 'Error', 201); - } - $_SERVER['disktag'] = $_COOKIE['disktag']; - $tmp['disktag_add'] = $_POST['disktag_add']; - $tmp['diskname'] = $_POST['diskname']; - $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; - if ($_POST['Onedrive_ver']=='MSC') { - $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = $_POST['client_secret']; - } - $response = setConfig($tmp, $_COOKIE['disktag']); - $title = getconstStr('MayinEnv'); - $html = getconstStr('Wait') . ' 3s'; - if (!$response) { - $html = $response . '
    -Can not write config to file.
    -'; - $title = 'Error'; - } - return message($html, $title, 201); - } - } - - if ($constStr['language']!='zh-cn') { - $linklang='en-us'; - } else $linklang='zh-cn'; - $ru = "https://developer.microsoft.com/".$linklang."/graph/quick-start?appID=_appId_&appName=_appName_&redirectUrl=".$_SERVER['redirect_uri']."&platform=option-php"; - $deepLink = "/quickstart/graphIO?publicClientSupport=false&appName=OneManager&redirectUrl=".$_SERVER['redirect_uri']."&allowImplicitFlow=false&ru=".urlencode($ru); - $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink); - $html = ' -
    - '.getconstStr('OnedriveDiskTag').':
    - '.getconstStr('OnedriveDiskName').':
    - Onedrive_Ver:
    -
    -
    -
    - -
    - '; - $title = 'Bind Onedrive'; - return message($html, $title, 201); -} - function install() { global $constStr; @@ -249,10 +116,8 @@ function install() $tmp['admin'] = $_POST['admin']; $tmp['language'] = $_POST['language']; $response = setConfig($tmp); - if (!$response) { - $html = $response . '
    -Can not write config to file.
    -'; + if (api_error($response)) { + $html = api_error_msg($response); $title = 'Error'; return message($html, $title, 201); } else { @@ -309,10 +174,11 @@ language:
    '; function ConfigWriteable() { $t = md5( md5(time()).rand(1000,9999) ); - setConfig([ 'tmp' => $t ]); + $r = setConfig([ 'tmp' => $t ]); $tmp = getConfig('tmp'); setConfig([ 'tmp' => '' ]); if ($tmp == $t) return true; + if ($r) return true; return false; } @@ -327,164 +193,24 @@ function RewriteEngineOn() return false; } -function EnvOpt($function_name, $needUpdate = 0) +function api_error($response) { - global $constStr; - global $ShowedCommonEnv; - global $ShowedInnerEnv; - asort($ShowedCommonEnv); - asort($ShowedInnerEnv); - $html = 'OneManager '.getconstStr('Setup').''; - /*if ($_POST['updateProgram']==getconstStr('updateProgram')) { - $response = json_decode(updataProgram($function_name, $Region, $namespace), true)['Response']; - if (isset($response['Error'])) { - $html = $response['Error']['Code'] . '
    -' . $response['Error']['Message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -Region:' . $_SERVER['Region'] . '
    -namespace:' . $namespace . '
    -'; - $title = 'Error'; - } else { - $html .= getconstStr('UpdateSuccess') . '
    -'; - $title = getconstStr('Setup'); - } - return message($html, $title); - }*/ - if ($_POST['submit1']) { - $_SERVER['disk_oprating'] = ''; - foreach ($_POST as $k => $v) { - if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') { - $tmp[$k] = $v; - } - if ($k == 'disk') $_SERVER['disk_oprating'] = $v; - } - /*if ($tmp['domain_path']!='') { - $tmp1 = explode("|",$tmp['domain_path']); - $tmparr = []; - foreach ($tmp1 as $multidomain_paths){ - $pos = strpos($multidomain_paths,":"); - if ($pos>0) $tmparr[substr($multidomain_paths, 0, $pos)] = path_format(substr($multidomain_paths, $pos+1)); - } - $tmp['domain_path'] = $tmparr; - }*/ - $response = setConfig($tmp, $_SERVER['disk_oprating']); - if (!$response) { - $html = $response . '
    -'; - $title = 'Error'; - } else { - $html .= ''; - } - } - if ($_GET['preview']) { - $preurl = $_SERVER['PHP_SELF'] . '?preview'; - } else { - $preurl = path_format($_SERVER['PHP_SELF'] . '/'); - } - $html .= ' -'.getconstStr('Back').'   '.getconstStr('Back').getconstStr('Home').'
    -Github
    '; - /*if ($needUpdate) { - $html .= '
    ' . $_SERVER['github_version'] . '
    -
    - -
    '; - } else { - $html .= getconstStr('NotNeedUpdate'); - }*/ - $html .= 'Can not update by a click!
    - - - - - '; - foreach ($ShowedCommonEnv as $key) { - if ($key=='language') { - $html .= ' - - - - '; - } elseif ($key=='theme') { - $theme_arr = scandir('theme'); - $html .= ' - - - - '; - } /*elseif ($key=='domain_path') { - $tmp = getConfig($key); - $domain_path = ''; - foreach ($tmp as $k1 => $v1) { - $domain_path .= $k1 . ':' . $v1 . '|'; - } - $domain_path = substr($domain_path, 0, -1); - $html .= ' - - - - '; - }*/ else $html .= ' - - - - '; - } - $html .= ' - - -
    '.getconstStr('PlatformConfig').'
    - -
    - -

    '; - foreach (explode("|",getConfig('disktag')) as $disktag) { - if ($disktag!='') { - $html .= ' - - - - - - '; - if (getConfig('refresh_token', $disktag)!='') { - $html .= ' - - '; - foreach ($ShowedInnerEnv as $key) { - $html .= ' - - - - '; - } - $html .= ' - - '; - } - $html .= ' -
    '.$disktag.': - - -

    '; - } - } - $html .= ' -'.getconstStr('AddDisk').''; - return message($html, getconstStr('Setup')); + return !$response; +} + +function api_error_msg($response) +{ + return $response . '
    +Can not write config to file.
    +'; +} + +function OnekeyUpate() +{ + return json_decode(updateHerokuapp(getConfig('function_name'), getConfig('APIKey'))['body'], true); +} + +function setConfigResponse($response) +{ + return $response; } From a323a5af8d0cf771d44286112974b6dc629c1a10 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:41:09 +0800 Subject: [PATCH 036/120] move get token function oprate function --- function/scf.php | 328 +++-------------------------------------------- 1 file changed, 20 insertions(+), 308 deletions(-) diff --git a/function/scf.php b/function/scf.php index 02d3cf3..a4e40ae 100644 --- a/function/scf.php +++ b/function/scf.php @@ -117,143 +117,6 @@ function WaitSCFStat() '.++$trynum; } -function get_refresh_token() -{ - global $constStr; - global $CommonEnv; - foreach ($CommonEnv as $env) $envs .= '\'' . $env . '\', '; - $url = path_format($_SERVER['PHP_SELF'] . '/'); - if ($_GET['authorization_code'] && isset($_GET['code'])) { - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - $tmp = curl_request($_SERVER['oauth_url'] . 'token', 'client_id=' . $_SERVER['client_id'] .'&client_secret=' . $_SERVER['client_secret'] . '&grant_type=authorization_code&requested_token_use=on_behalf_of&redirect_uri=' . $_SERVER['redirect_uri'] .'&code=' . $_GET['code']); - if ($tmp['stat']==200) $ret = json_decode($tmp['body'], true); - if (isset($ret['refresh_token'])) { - $tmptoken = $ret['refresh_token']; - $str = ' - refresh_token :
    '; - /*for ($i=1;strlen($tmptoken)>0;$i++) { - $t['t' . $i] = substr($tmptoken,0,128); - $str .= ' - t' . $i . ':

    '; - $tmptoken=substr($tmptoken,128); - } - $str .= ' - Add t1-t'.--$i.' to environments.*/ - $str .= ' -

    - '.getconstStr('SavingToken').' - '; - setConfig([ 'refresh_token' => $tmptoken, 'token_expires' => time()+30*24*60*60 ], $_COOKIE['disktag']); - savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60); - WaitSCFStat(); - $str .= ' - '; - return message($str, getconstStr('WaitJumpIndex')); - } - return message('
    ' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '
    ', $tmp['stat']); - //return message('
    ' . json_encode($ret, JSON_PRETTY_PRINT) . '
    ', 500); - } - if ($_GET['install1']) { - $_SERVER['disk_oprating'] = $_COOKIE['disktag']; - $_SERVER['disktag'] = $_COOKIE['disktag']; - config_oauth(); - if (getConfig('Onedrive_ver')=='MS' || getConfig('Onedrive_ver')=='CN' || getConfig('Onedrive_ver')=='MSC') { - return message(' - '.getconstStr('JumptoOffice').' - - ', getconstStr('Wait').' 1s', 201); - } - } - if ($_GET['install0']) { - if ($_POST['disktag_add']!='' && ($_POST['Onedrive_ver']=='MS' || $_POST['Onedrive_ver']=='CN' || $_POST['Onedrive_ver']=='MSC')) { - if (in_array($_COOKIE['disktag'], $CommonEnv)) { - return message('Do not input ' . $envs . '
    ', 'Error', 201); - } - $_SERVER['disktag'] = $_COOKIE['disktag']; - $tmp['disktag_add'] = $_POST['disktag_add']; - $tmp['diskname'] = $_POST['diskname']; - $tmp['Onedrive_ver'] = $_POST['Onedrive_ver']; - if ($_POST['Onedrive_ver']=='MSC') { - $tmp['client_id'] = $_POST['client_id']; - $tmp['client_secret'] = $_POST['client_secret']; - } - $response = json_decode( setConfig($tmp, $_COOKIE['disktag']), true )['Response']; - $title = getconstStr('MayinEnv'); - $html = getconstStr('Wait') . ' 3s'; - if (isset($response['Error'])) { - $html = $response['Error']['Code'] . '
    -' . $response['Error']['Message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -Region:' . $_SERVER['Region'] . '
    -namespace:' . $_SERVER['namespace'] . '
    -'; - $title = 'Error'; - } - return message($html, $title, 201); - } - } - - if ($constStr['language']!='zh-cn') { - $linklang='en-us'; - } else $linklang='zh-cn'; - $ru = "https://developer.microsoft.com/".$linklang."/graph/quick-start?appID=_appId_&appName=_appName_&redirectUrl=".$_SERVER['redirect_uri']."&platform=option-php"; - $deepLink = "/quickstart/graphIO?publicClientSupport=false&appName=OneManager&redirectUrl=".$_SERVER['redirect_uri']."&allowImplicitFlow=false&ru=".urlencode($ru); - $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink); - $html = ' -
    - '.getconstStr('OnedriveDiskTag').':
    - '.getconstStr('OnedriveDiskName').':
    - Onedrive_Ver:
    -
    -
    -
    - -
    - '; - $title = 'Bind Onedrive'; - return message($html, $title, 201); -} - function install() { global $constStr; @@ -272,12 +135,9 @@ function install() $tmp['SecretKey'] = $SecretKey; } $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; - if (isset($response['Error'])) { - $html = $response['Error']['Code'] . '
    -' . $response['Error']['Message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -Region:' . $_SERVER['Region'] . '
    -namespace:' . $_SERVER['namespace'] . '
    + if (api_error($response)) { + $html = api_error_msg($response); + $html .= '
    '; $title = 'Error'; } else { @@ -500,175 +360,27 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe return post2url('https://'.$host, $data.'&Signature='.urlencode($signStr)); } - -function EnvOpt($function_name, $needUpdate = 0) +function api_error($response) { - global $constStr; - global $ShowedCommonEnv; - global $ShowedInnerEnv; - asort($ShowedCommonEnv); - asort($ShowedInnerEnv); - $html = 'OneManager '.getconstStr('Setup').''; - if ($_POST['updateProgram']==getconstStr('updateProgram')) { - $response = json_decode(updateProgram($function_name, $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')), true)['Response']; - if (isset($response['Error'])) { - $html = $response['Error']['Code'] . '
    -' . $response['Error']['Message'] . '

    -function_name:' . $_SERVER['function_name'] . '
    -Region:' . $_SERVER['Region'] . '
    -namespace:' . $namespace . '
    -'; - $title = 'Error'; - } else { - WaitSCFStat(); - $html .= getconstStr('UpdateSuccess') . '
    -'; - $title = getconstStr('Setup'); - } - return message($html, $title); - } - if ($_POST['submit1']) { - $_SERVER['disk_oprating'] = ''; - foreach ($_POST as $k => $v) { - if (in_array($k, $ShowedCommonEnv)||in_array($k, $ShowedInnerEnv)||$k=='disktag_del' || $k=='disktag_add') { - $tmp[$k] = $v; - } - if ($k == 'disk') $_SERVER['disk_oprating'] = $v; - } - /*if ($tmp['domain_path']!='') { - $tmp1 = explode("|",$tmp['domain_path']); - $tmparr = []; - foreach ($tmp1 as $multidomain_paths){ - $pos = strpos($multidomain_paths,":"); - if ($pos>0) $tmparr[substr($multidomain_paths, 0, $pos)] = path_format(substr($multidomain_paths, $pos+1)); - } - $tmp['domain_path'] = $tmparr; - }*/ - $response = json_decode( setConfig($tmp, $_SERVER['disk_oprating']), true )['Response']; - if (isset($response['Error'])) { - $html = $response['Error']['Code'] . '
    + return isset($response['Error']); +} + +function api_error_msg($response) +{ + return $response['Error']['Code'] . '
    ' . $response['Error']['Message'] . '

    function_name:' . $_SERVER['function_name'] . '
    Region:' . $_SERVER['Region'] . '
    namespace:' . $_SERVER['namespace'] . '
    '; - $title = 'Error'; - } else { - WaitSCFStat(); - //sleep(3); - $html .= json_encode($response,JSON_PRETTY_PRINT).''; - $title = getconstStr('Setup'); - } - return message($html, $title); - } - if ($_GET['preview']) { - $preurl = $_SERVER['PHP_SELF'] . '?preview'; - } else { - $preurl = path_format($_SERVER['PHP_SELF'] . '/'); - } - $html .= ' -'.getconstStr('Back').'   '.getconstStr('Back').getconstStr('Home').'
    -Github
    -
    -'; - if ($needUpdate) { - $html .= '
    ' . $_SERVER['github_version'] . '
    '; - } else { - $html .= getconstStr('NotNeedUpdate'); - } - $html .= ' - -
    - - - - - '; - foreach ($ShowedCommonEnv as $key) { - if ($key=='language') { - $html .= ' - - - - '; - } elseif ($key=='theme') { - $theme_arr = scandir('theme'); - $html .= ' - - - - '; - } /*elseif ($key=='domain_path') { - $tmp = getConfig($key); - $domain_path = ''; - foreach ($tmp as $k1 => $v1) { - $domain_path .= $k1 . ':' . $v1 . '|'; - } - $domain_path = substr($domain_path, 0, -1); - $html .= ' - - - - '; - }*/ else $html .= ' - - - - '; - } - $html .= ' - - -
    '.getconstStr('PlatformConfig').'
    - -
    - -

    '; - foreach (explode("|",getConfig('disktag')) as $disktag) { - if ($disktag!='') { - $html .= ' - - - - - - '; - if (getConfig('refresh_token', $disktag)!='') { - $html .= ' - - '; - foreach ($ShowedInnerEnv as $key) { - $html .= ' - - - - '; - } - $html .= ' - - '; - } - $html .= ' -
    '.$disktag.': - - -

    '; - } - } - $html .= ' -'.getconstStr('AddDisk').''; - return message($html, getconstStr('Setup')); +} + +function OnekeyUpate() +{ + return json_decode(updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')), true)['Response']; +} + +function setConfigResponse($response) +{ + return json_decode( $response, true )['Response']; } From fc97b2269d55d108a584f42e048eaa7904c3581a Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 12:37:10 +0800 Subject: [PATCH 037/120] Update common.php --- function/common.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index dc18bec..973b410 100644 --- a/function/common.php +++ b/function/common.php @@ -355,6 +355,7 @@ function message($message, $title = 'Message', $statusCode = 200) +

    ' . $title . '

    @@ -1275,9 +1276,9 @@ function EnvOpt($needUpdate = 0) $html .= ' '.getconstStr('Back').'   '.getconstStr('Back').getconstStr('Home').'
    Github
    '; - if (!$_SERVER['USER']==='qcloud'&&!$_SERVER['HEROKU_APP_DIR']==='/app') { + if (!($_SERVER['USER']==='qcloud'||$_SERVER['HEROKU_APP_DIR']==='/app')) { $html .= ' -In VPS, can not update by a click!
    '; +In VPS can not update by a click!
    '; } else { $html .= '

    From f8c8d80e0456e5e72db8eef073e2498d36a5b0ce Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 8 Mar 2020 16:52:24 +0800 Subject: [PATCH 038/120] Update lybwb.php --- theme/lybwb.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/theme/lybwb.php b/theme/lybwb.php index 42eb992..a6d611d 100644 --- a/theme/lybwb.php +++ b/theme/lybwb.php @@ -10,7 +10,12 @@ 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 050/120] 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 051/120] 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 052/120] 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 053/120] 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 054/120] 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 055/120] 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 056/120] 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 065/120] 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 066/120] 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 067/120] 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 068/120] 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 069/120] 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 070/120] 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 071/120] 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 072/120] 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]; +?> + +
    +
    + + +
    + + + + + + + + + From 89546eb76a2f30df9369e38fd05ca6540bb3cd78 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 18 Mar 2020 18:47:16 +0800 Subject: [PATCH 073/120] try fix retry 3 time when net err --- function/common.php | 199 +++++++++++++++++++++++--------------------- 1 file changed, 106 insertions(+), 93 deletions(-) diff --git a/function/common.php b/function/common.php index 41e9ecf..bb15dbb 100644 --- a/function/common.php +++ b/function/common.php @@ -255,7 +255,7 @@ function curl_request($url, $data = false, $headers = []) $response['body'] = curl_exec($ch); $response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE); curl_close($ch); - if ($response['stat']==0) return curl_request($url, $data, $headers); + //if ($response['stat']==0) return curl_request($url, $data, $headers); return $response; } @@ -515,11 +515,11 @@ function main($path) $disktags = explode("|",getConfig('disktag')); // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { - if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['PHP_SELF'].'/'.$disktags[0]) ]); + 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); + 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]; @@ -574,90 +574,90 @@ function main($path) if (!$refresh_token) { return render_list(); } else { - if (!($_SERVER['access_token'] = getcache('access_token'))) { - $response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token ); - if ($response['stat']==200) $ret = json_decode($response['body'], true); - if (!isset($ret['access_token'])) { - error_log($_SERVER['oauth_url'] . 'token'.'?client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token); - error_log('failed to get access_token. response' . json_encode($ret)); - throw new Exception($response['stat'].', failed to get access_token.'.$response['body']); - } - 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()+7*24*60*60 ]); - } - - $_SERVER['retry'] = 0; - if ($_SERVER['ajax']) { - if ($_GET['action']=='del_upload_cache'&&substr($_GET['filename'],-4)=='.tmp') { - // del '.tmp' without login. 无需登录即可删除.tmp后缀文件 - error_log('del.tmp:GET,'.json_encode($_GET,JSON_PRETTY_PRINT)); - $tmp = MSAPI('DELETE',path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . spurlencode($_GET['filename']) ),'',$_SERVER['access_token']); - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - savecache('path_' . $path1, json_decode('{}',true), 1); - return output($tmp['body'],$tmp['stat']); - } - if ($_GET['action']=='uploaded_rename') { - // rename .scfupload file without login. - // 无需登录即可重命名.scfupload后缀文件,filemd5为用户提交,可被构造,问题不大,以后处理 - $oldname = spurlencode($_GET['filename']); - $pos = strrpos($oldname, '.'); - if ($pos>0) $ext = strtolower(substr($oldname, $pos)); - $oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname . '.scfupload' ); - $data = '{"name":"' . $_GET['filemd5'] . $ext . '"}'; - //echo $oldname .'
    '. $data; - $tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']); - if ($tmp['stat']==409) MSAPI('DELETE',$oldname,'',$_SERVER['access_token'])['body']; - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - savecache('path_' . $path1, json_decode('{}',true), 1); - return output($tmp['body'],$tmp['stat']); - } - if ($_GET['action']=='upbigfile') return bigfileupload($path); - } - if ($_SERVER['admin']) { - $tmp = adminoperate($path); - if ($tmp['statusCode'] > 0) { - $path1 = path_format($_SERVER['list_path'] . path_format($path)); - savecache('path_' . $path1, json_decode('{}',true), 1); - return $tmp; - } - } else { - if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401); - } - $_SERVER['ishidden'] = passhidden($path); - if (isset($_GET['thumbnails'])) { - if ($_SERVER['ishidden']<4) { - if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) { - return get_thumbnails_url($path); - } else return output(json_encode($exts['img']),400); - } else return output('',401); - } - - $files = list_files($path); - //echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT); - if (isset($_GET['random'])&&$_GET['random']!=='') { - if ($_SERVER['ishidden']<4) { - $tmp = []; - foreach (array_keys($files['children']) as $filename) { - if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; + if (!($_SERVER['access_token'] = getcache('access_token'))) { + $response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token ); + if ($response['stat']==200) $ret = json_decode($response['body'], true); + if (!isset($ret['access_token'])) { + error_log($_SERVER['oauth_url'] . 'token'.'?client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token); + error_log('failed to get access_token. response' . json_encode($ret)); + throw new Exception($response['stat'].', failed to get access_token.'.$response['body']); } - $tmp = array_values($tmp); - 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']) && !isset($_GET['preview'])) { - // is file && not preview mode - if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); - } - if ( isset($files['folder']) || isset($files['file']) ) { - return render_list($path, $files); - } else { - return message(''.getconstStr('Back').getconstStr('Home').'
    ' . $files['error']['message'] . '
    '.getconstStr('Back').'', $files['error']['code'], $files['error']['stat']); - } + 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()+7*24*60*60 ]); + } + + $_SERVER['retry'] = 0; + if ($_SERVER['ajax']) { + if ($_GET['action']=='del_upload_cache'&&substr($_GET['filename'],-4)=='.tmp') { + // del '.tmp' without login. 无需登录即可删除.tmp后缀文件 + error_log('del.tmp:GET,'.json_encode($_GET,JSON_PRETTY_PRINT)); + $tmp = MSAPI('DELETE',path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . spurlencode($_GET['filename']) ),'',$_SERVER['access_token']); + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + savecache('path_' . $path1, json_decode('{}',true), 1); + return output($tmp['body'],$tmp['stat']); + } + if ($_GET['action']=='uploaded_rename') { + // rename .scfupload file without login. + // 无需登录即可重命名.scfupload后缀文件,filemd5为用户提交,可被构造,问题不大,以后处理 + $oldname = spurlencode($_GET['filename']); + $pos = strrpos($oldname, '.'); + if ($pos>0) $ext = strtolower(substr($oldname, $pos)); + $oldname = path_format(path_format($_SERVER['list_path'] . path_format($path)) . '/' . $oldname . '.scfupload' ); + $data = '{"name":"' . $_GET['filemd5'] . $ext . '"}'; + //echo $oldname .'
    '. $data; + $tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']); + if ($tmp['stat']==409) MSAPI('DELETE',$oldname,'',$_SERVER['access_token'])['body']; + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + savecache('path_' . $path1, json_decode('{}',true), 1); + return output($tmp['body'],$tmp['stat']); + } + if ($_GET['action']=='upbigfile') return bigfileupload($path); + } + if ($_SERVER['admin']) { + $tmp = adminoperate($path); + if ($tmp['statusCode'] > 0) { + $path1 = path_format($_SERVER['list_path'] . path_format($path)); + savecache('path_' . $path1, json_decode('{}',true), 1); + return $tmp; + } + } else { + if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401); + } + $_SERVER['ishidden'] = passhidden($path); + if (isset($_GET['thumbnails'])) { + if ($_SERVER['ishidden']<4) { + if (in_array(strtolower(substr($path, strrpos($path, '.') + 1)), $exts['img'])) { + return get_thumbnails_url($path); + } else return output(json_encode($exts['img']),400); + } else return output('',401); + } + + $files = list_files($path); + //echo json_encode(array_keys($files['children']), JSON_PRETTY_PRINT); + if (isset($_GET['random'])&&$_GET['random']!=='') { + if ($_SERVER['ishidden']<4) { + $tmp = []; + foreach (array_keys($files['children']) as $filename) { + if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; + } + $tmp = array_values($tmp); + 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']) && !isset($_GET['preview'])) { + // is file && not preview mode + if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt')&&$files['name']!=getConfig('passfile')) ) return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]); + } + if ( isset($files['folder']) || isset($files['file']) ) { + return render_list($path, $files); + } else { + return message(''.getconstStr('Back').getconstStr('Home').'
    ' . $files['error']['message'] . '
    '.getconstStr('Back').'', $files['error']['code'], $files['error']['stat']); + } } } @@ -672,7 +672,8 @@ function list_files($path) } else { $files = fetch_files($path); } - if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) { + return $files; + /*if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) { return $files; } else { error_log( json_encode($files) . ' Network Error
    ' ); @@ -680,7 +681,7 @@ function list_files($path) if ($_SERVER['retry'] < 3) { return list_files($path); } else return $files; - } + }*/ } function adminform($name = '', $pass = '', $path = '') @@ -950,7 +951,10 @@ function fetch_files($path = '/') if (substr($url,-1)=='/') $url=substr($url,0,-1); } $url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl)'; - $arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]); + while ($retry<3&&!$arr['stat']) { + $arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]); + $retry++; + } if ($arr['stat']<500) { $files = json_decode($arr['body'], true); // echo $path . '
    ' . json_encode($files, JSON_PRETTY_PRINT) . '
    '; @@ -972,8 +976,17 @@ function fetch_files($path = '/') $files['error']['stat'] = $arr['stat']; } } else { - error_log($arr['body']); - $files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true); + //error_log($arr['body']); + $files = json_decode($arr['body'], true); + if (isset($files['error'])) { + $files['error']['stat'] = $arr['stat']; + } else { + $files['error']['stat'] = 503; + $files['error']['code'] = 'unknownError'; + $files['error']['message'] = 'unknownError'; + } + //$files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true); + //error_log(json_encode($files, JSON_PRETTY_PRINT)); } } @@ -1016,9 +1029,9 @@ function fetch_files_children($files, $path, $page) if ($path !== '/') { $url .= ':' . $path; if (substr($url,-1)=='/') $url=substr($url,0,-1); - $url .= ':/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime'; + $url .= ':/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl'; } else { - $url .= '/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime'; + $url .= '/children?$select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl'; } $children = json_decode(curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']])['body'], true); // echo $url . '
    ' . json_encode($children, JSON_PRETTY_PRINT) . '
    '; From 7c3232d0e5279350302ef539c9f86673f90f4686 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 18 Mar 2020 18:49:15 +0800 Subject: [PATCH 074/120] add diskname in title --- theme/classic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/classic.php b/theme/classic.php index f42c76e..f1e00b8 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -2,7 +2,7 @@ - <?php echo $pretitle;?> - <?php echo $_SERVER['sitename'];?> + <?php echo $pretitle; if ($_SERVER['base_disk_path']!=$_SERVER['base_path']) echo ' - ' . getConfig('diskname');?> - <?php echo $_SERVER['sitename'];?> From 9c9d761c5302cb37fa43b8727f323cf6676da919 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 18 Mar 2020 19:23:30 +0800 Subject: [PATCH 075/120] list exist disktags in AddDisk --- function/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index bb15dbb..1430b79 100644 --- a/function/common.php +++ b/function/common.php @@ -1240,7 +1240,7 @@ function get_refresh_token() $app_url = "https://apps.dev.microsoft.com/?deepLink=".urlencode($deepLink); $html = '
    - '.getconstStr('OnedriveDiskTag').':
    + '.getconstStr('OnedriveDiskTag').': ('.getConfig('disktag').')
    '.getconstStr('OnedriveDiskName').':
    Onedrive_Ver:

    From 93c70319410d69fb4c724fcb7ea3df8d8fa81443 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:05:57 +0800 Subject: [PATCH 076/120] in upload, not open new window, add copy button --- theme/classic.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index f1e00b8..f59ae1d 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -209,7 +209,7 @@ else $filenum = 0; ?> - + @@ -712,17 +712,18 @@ } else console.log(xhr.status+'\n'+xhr.responseText); } } - function CopyAllDownloadUrl() { + function CopyAllDownloadUrl(str) { var tmptextarea=document.createElement('textarea'); document.body.appendChild(tmptextarea); tmptextarea.setAttribute('style','position:absolute;left:-100px;width:0px;height:0px;'); - document.querySelectorAll('.download').forEach(function (e) { + document.querySelectorAll(str).forEach(function (e) { tmptextarea.innerHTML+=e.href+"\r\n"; }); tmptextarea.select(); tmptextarea.setSelectionRange(0, tmptextarea.value.length); document.execCommand("copy"); alert(tmptextarea.innerHTML); + //alert('Success'); } var sort=0; function sortby(string) { @@ -1001,8 +1002,9 @@ xhr4.onload = function(e){ console.log(xhr4.responseText+','+xhr4.status); var filename; - if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; - if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + //if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; + //if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + filename = JSON.parse(xhr4.responseText)['name']; if (filename=='') { alert(''); uploadbuttonshow(); @@ -1011,8 +1013,9 @@ var lasturl = location.href; if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/'; lasturl += filename + '?preview'; - //alert(lasturl); - window.open(lasturl); + //window.open(lasturl); + document.getElementById('upfile_a_'+tdnum).href = lasturl; + document.getElementById('upfile_a1_'+tdnum).href = filename; } EndTime=new Date(); @@ -1022,7 +1025,7 @@ } else { MiddleStr += ':'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s
    '; } - document.getElementById('upfile_td1_'+tdnum).innerHTML=''+filemd5+'
    '+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
    '; + document.getElementById('upfile_td1_'+tdnum).innerHTML='
    '+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
    '; label.innerHTML=StartStr+MiddleStr; uploadbuttonshow(); From 0fad2cb0fc1268fcd565b50c7b1297d31b6f0868 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:06:47 +0800 Subject: [PATCH 077/120] in upload, not open new window, add copy button --- conststr.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 65a3dea..2afa21c 100644 --- a/conststr.php +++ b/conststr.php @@ -688,7 +688,14 @@ $constStr = [ 'ko-kr' => '다시 쓰기 (의사 정적) 기능이 활성화되어 있는지 확인하십시오.', 'fa' => 'لطفاً مطمئن شوید که RewriteEngine روشن است.', ], - + 'CopyUrl' => [ + 'en-us' => 'Copy URL', + 'zh-cn' => '复制链接', + ], + 'Success' => [ + 'en-us' => 'Success', + 'zh-cn' => '成功', + ], 'Refresh' => [ 'en-us' => 'Refresh', 'zh-cn' => '刷新', From 3f4eab57cd59f0ba34637041323184e501185b95 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:08:02 +0800 Subject: [PATCH 078/120] in upload, not open new window, add copy button --- function/common.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/function/common.php b/function/common.php index 1430b79..cc5dc0a 100644 --- a/function/common.php +++ b/function/common.php @@ -608,7 +608,12 @@ function main($path) $data = '{"name":"' . $_GET['filemd5'] . $ext . '"}'; //echo $oldname .'
    '. $data; $tmp = MSAPI('PATCH',$oldname,$data,$_SERVER['access_token']); - if ($tmp['stat']==409) MSAPI('DELETE',$oldname,'',$_SERVER['access_token'])['body']; + if ($tmp['stat']==409) { + MSAPI('DELETE',$oldname,'',$_SERVER['access_token']); + $tmpbody = json_decode($tmp['body'], true); + $tmpbody['name'] = $_GET['filemd5'] . $ext; + $tmp['body'] = json_encode($tmpbody); + } $path1 = path_format($_SERVER['list_path'] . path_format($path)); savecache('path_' . $path1, json_decode('{}',true), 1); return output($tmp['body'],$tmp['stat']); From 283b046b8038471617225b954cbc4ac16cc30d2e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 18:46:53 +0800 Subject: [PATCH 079/120] remove empty config --- function/heroku.php | 1 + 1 file changed, 1 insertion(+) diff --git a/function/heroku.php b/function/heroku.php index 6c4e2dc..ba91f84 100644 --- a/function/heroku.php +++ b/function/heroku.php @@ -93,6 +93,7 @@ function setConfig($arr, $disktag = '') if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1); else $tmp['disktag'] = ''; } + foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null; // echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).' //'; return setHerokuConfig($tmp, getConfig('function_name'), getConfig('APIKey')); From 385b5e2c1c7137abdd68220e5942563c5e3d53a8 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 19 Mar 2020 23:11:55 +0800 Subject: [PATCH 080/120] change install --- function/scf.php | 51 ++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/function/scf.php b/function/scf.php index fb98be5..978eaac 100644 --- a/function/scf.php +++ b/function/scf.php @@ -112,7 +112,9 @@ function setConfig($arr, $disktag = '') } // echo '正式设置:'.json_encode($tmp,JSON_PRETTY_PRINT).' //'; - return updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')); + $response = updateEnvironment($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], getConfig('SecretId'), getConfig('SecretKey')); + WaitSCFStat(); + return $response; } function WaitSCFStat() @@ -125,9 +127,17 @@ function WaitSCFStat() function install() { global $constStr; + if ($_GET['install2']) { + $tmp['admin'] = $_POST['admin']; + setConfig($tmp); + if (needUpdate()) { + updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); + return message('update to github version, reinstall.', 'Program updating', 201); + } + return output('Jump', 302); + } if ($_GET['install1']) { - if ($_POST['admin']!='') { - $tmp['admin'] = $_POST['admin']; + //if ($_POST['admin']!='') { $tmp['language'] = $_POST['language']; $SecretId = getConfig('SecretId'); if ($SecretId=='') { @@ -145,18 +155,27 @@ function install() $html .= '
    '; $title = 'Error'; + return message($html, $title, 201); } else { - $trynum = 0; - while( json_decode(getfunctioninfo($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey),true)['Response']['Status']!='Active' ) echo ' -'.++$trynum; - if (needUpdate()) { - updateProgram($_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey); - return message('update to github version, reinstall.', 'Program updating', 201); - } - return output('Jump', 302); + $html .= ' + +
    + + + '; + $title = getconstStr('SetAdminPassword'); + return message($html, $title, 201); + } + //} } if ($_GET['install0']) { $html .= ' @@ -171,8 +190,6 @@ language:
    ';

    '; $html .= ' -
    '; - $html .= ' -
    @@ -594,9 +575,10 @@ echo 'IPv4: ' ,$ip, "\n";
    + @@ -643,7 +625,7 @@ echo 'IPv4: ' ,$ip, "\n"; $readme.innerHTML = marked(document.getElementById('readme-md').innerText); } + if (isset($_GET['preview'])) { //is preview mode. 在预览时处理 ?> var $url = document.getElementById('url'); if ($url) { $url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML; @@ -781,17 +763,18 @@ echo 'IPv4: ' ,$ip, "\n"; } else console.log(xhr.status+'\n'+xhr.responseText); } } - function CopyAllDownloadUrl() { + function CopyAllDownloadUrl(str) { var tmptextarea=document.createElement('textarea'); document.body.appendChild(tmptextarea); tmptextarea.setAttribute('style','position:absolute;left:-100px;width:0px;height:0px;'); - document.querySelectorAll('.download').forEach(function (e) { + document.querySelectorAll(str).forEach(function (e) { tmptextarea.innerHTML+=e.href+"\r\n"; }); tmptextarea.select(); tmptextarea.setSelectionRange(0, tmptextarea.value.length); document.execCommand("copy"); alert(tmptextarea.innerHTML); + //alert('Success'); } var sort=0; function sortby(string) { @@ -892,7 +875,7 @@ echo 'IPv4: ' ,$ip, "\n"; location.href=location.protocol + "//" + location.host + "" ; } 200) { // more than 200. 有下一页 ?> + if (isset($files['folder']['childCount'])&&$files['folder']['childCount']>200) { // more than 200. 有下一页 ?> function nextpage(num) { document.getElementById('pagenum').value=num; document.getElementById('nextpageform').submit(); @@ -1070,8 +1053,9 @@ echo 'IPv4: ' ,$ip, "\n"; xhr4.onload = function(e){ console.log(xhr4.responseText+','+xhr4.status); var filename; - if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; - if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + //if (xhr4.status==200) filename = JSON.parse(xhr4.responseText)['name']; + //if (xhr4.status==409) filename = filemd5 + file.name.substr(file.name.indexOf('.')); + filename = JSON.parse(xhr4.responseText)['name']; if (filename=='') { alert(''); uploadbuttonshow(); @@ -1080,8 +1064,9 @@ echo 'IPv4: ' ,$ip, "\n"; var lasturl = location.href; if (lasturl.substr(lasturl.length-1)!='/') lasturl += '/'; lasturl += filename + '?preview'; - //alert(lasturl); - window.open(lasturl); + //window.open(lasturl); + document.getElementById('upfile_a_'+tdnum).href = lasturl; + document.getElementById('upfile_a1_'+tdnum).href = filename; } EndTime=new Date(); @@ -1091,7 +1076,7 @@ echo 'IPv4: ' ,$ip, "\n"; } else { MiddleStr += ':'+size_format((totalsize-newstartsize)*1000/(EndTime.getTime()-StartTime.getTime()))+'/s
    '; } - document.getElementById('upfile_td1_'+tdnum).innerHTML=''+filemd5+'
    '+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
    '; + document.getElementById('upfile_td1_'+tdnum).innerHTML='
    '+document.getElementById('upfile_td1_'+tdnum).innerHTML+'
    '; label.innerHTML=StartStr+MiddleStr; uploadbuttonshow(); @@ -1133,7 +1118,7 @@ echo 'IPv4: ' ,$ip, "\n"; document.cookie = "admin=; path=/"; location.href = location.href; } - + function showdiv(event,action,num) { var $operatediv=document.getElementsByName('operatediv'); for ($i=0;$i<$operatediv.length;$i++) { From 7f19d2ea2b8b101374b5e1326fc871516960204c Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 20 Mar 2020 12:29:21 +0800 Subject: [PATCH 083/120] Update ly_white.php --- theme/ly_white.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/theme/ly_white.php b/theme/ly_white.php index 37e137e..2645546 100644 --- a/theme/ly_white.php +++ b/theme/ly_white.php @@ -9,10 +9,7 @@ -
    - -
    - @@ -28,7 +31,7 @@
  • -
  • +
  • + if (isset($_SERVER['needUpdate'])&&$_SERVER['needUpdate']) { ?>

    @@ -67,7 +70,20 @@ + if ($files) { + if (isset($files['children']['head.md'])) { ?> +
    +
    +
    +
    + +
    +
    +
    +
    +
    @@ -91,6 +107,8 @@
    @@ -113,8 +131,6 @@
    document.getElementById(\'url\').offsetWidth) this.style.width=\'100%\';" /> '; @@ -160,12 +176,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; ?>

           
    - + @@ -200,13 +216,7 @@ 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 ($_SERVER['admin'] or !isHideFile($file['name'])) { $filenum++; ?>
           
    @@ -307,25 +317,7 @@ echo 'Unknown path or file.'; echo json_encode($files, JSON_PRETTY_PRINT); } - if ($head) { - echo ' - - - -
    -
    -
    -
    - - -
    -'; - } - if ($readme) { + if (isset($files['children']['readme.md'])) { echo '
    @@ -334,11 +326,8 @@
    -
    - +
    '; @@ -364,7 +353,7 @@ + if (!isset($_GET['preview'])) { ?>