From d4d58954556641655c8d630e625701f3ed41be1b Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 26 Mar 2020 17:39:17 +0800 Subject: [PATCH 1/9] Update classic.php --- theme/classic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/theme/classic.php b/theme/classic.php index b6aee69..3603ef9 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -705,8 +705,7 @@ tmptextarea.select(); tmptextarea.setSelectionRange(0, tmptextarea.value.length); document.execCommand("copy"); - //alert(tmptextarea.innerHTML); - alert('Success'); + alert(tmptextarea.innerHTML+'Success'); } var sort=0; function sortby(string) { From 858fa2811a0eea3d6999320ecae776d54f2ad455 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 26 Mar 2020 17:47:18 +0800 Subject: [PATCH 2/9] Update classic.php --- theme/classic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/classic.php b/theme/classic.php index 3603ef9..ff720fb 100644 --- a/theme/classic.php +++ b/theme/classic.php @@ -705,7 +705,7 @@ tmptextarea.select(); tmptextarea.setSelectionRange(0, tmptextarea.value.length); document.execCommand("copy"); - alert(tmptextarea.innerHTML+'Success'); + alert(tmptextarea.innerHTML+''); } var sort=0; function sortby(string) { From 0fb6614332dbf3acc4eba5750ec129e3e7944a99 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 26 Mar 2020 17:56:41 +0800 Subject: [PATCH 3/9] 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 7bba7e7..2b01ea3 100644 --- a/function/common.php +++ b/function/common.php @@ -1411,7 +1411,7 @@ function EnvOpt($needUpdate = 0) } else { //WaitSCFStat(); //sleep(3); - $html .= 'Success!
+ $html .= getconstStr('Success') . '!
'; $title = getconstStr('Setup'); } From 5c42aef34072b1e8d1a199483d44438327abd9bc Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 26 Mar 2020 20:40:50 +0800 Subject: [PATCH 4/9] fix sharepoint space in cn --- function/common.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/function/common.php b/function/common.php index 2b01ea3..5326412 100644 --- a/function/common.php +++ b/function/common.php @@ -173,20 +173,21 @@ function config_oauth() function get_siteid($access_token) { + if (getConfig('Drive_ver')=='MS') $url = 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname'); + if (getConfig('Drive_ver')=='CN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/sites/'.getConfig('sharepointname'); $i=0; $response = []; - while ($response['stat']!=200&&$i<4) { - $response = curl_request('https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname'), false, ['Authorization' => 'Bearer ' . $access_token]); + while ($url!=''&&$response['stat']!=200&&$i<4) { + $response = curl_request($url, false, ['Authorization' => 'Bearer ' . $access_token]); $i++; - echo 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname').$response['stat'].$response['body'].' - '; + //echo 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname').$response['stat'].$response['body'].' + //'; + } + if ($response['stat']!=200) { + error_log('failed to get siteid. response' . json_encode($response)); + throw new Exception($response['stat'].', failed to get siteid.'.$response['body']); } return json_decode($response['body'],true)['id']; - //$_SERVER['api_url'] = 'https://graph.microsoft.com/v1.0/sites/' . $tmp['siteid'] . '/drive/root'; - //setConfig($tmp); - - //error_log('failed to get siteid. response' . json_encode($response)); - //throw new Exception($response['stat'].', failed to get siteid.'.$response['body']); } function getListpath($domain) From 69f74da711aff2b88de07722ea39c93e64e052b2 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 27 Mar 2020 09:49:57 +0800 Subject: [PATCH 5/9] fix install language --- function/normal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function/normal.php b/function/normal.php index 1e4e0d7..68a9afb 100644 --- a/function/normal.php +++ b/function/normal.php @@ -118,7 +118,7 @@ function install() if ($_GET['install2']) { if ($_POST['admin']!='') { $tmp['admin'] = $_POST['admin']; - $tmp['language'] = $_POST['language']; + $tmp['language'] = $_COOKIE['language']; $response = setConfig($tmp); if (api_error($response)) { $html = api_error_msg($response); From 3b2251fe82900db852455ca1ffc886f086a4c682 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 27 Mar 2020 09:58:03 +0800 Subject: [PATCH 6/9] Update conststr.php --- conststr.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conststr.php b/conststr.php index c6d265a..c4f5df8 100644 --- a/conststr.php +++ b/conststr.php @@ -70,7 +70,7 @@ $constStr = [ '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.', + 'background' => 'Set an url as background photo.', '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.', @@ -85,7 +85,7 @@ $constStr = [ 'diskname' => '这个盘你想显示什么名称。', 'disktag' => '一个标签,用于保存配置,多盘时会显示在url中。', 'downloadencrypt' => '0 或 1。如果 1, 那加密目录内的文件可以不需要密码就能下载。', - 'background' => '设置一个url作为背景,或者在你显示的目录放一个background.jpg文件。', + 'background' => '设置一个url作为背景。', 'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。', 'hideFunctionalityFile' => '0 或 1。如果 1, 某些文件不列表给游客看,但它的功能正常,比如readme.md', 'passfile' => '自定义密码文件的名字,可以是\'pppppp\',也可以是\'aaaa.txt\'等等;列目录时不会显示,只有知道密码才能查看或下载此文件。密码是这个文件的内容,可以空格、可以中文;', @@ -114,7 +114,7 @@ $constStr = [ 'diskname' => '이 디스크에 어떤 이름을 표시 하시겠습니까?', 'disktag' => '레이블은 구성을 저장하는 데 사용되며 디스크가 여러 개인 경우 URL에 표시됩니다.', 'downloadencrypt' => '', - 'background' => 'URL을 배경으로 설정하거나 표시하는 디렉토리에 background.jpg 파일을 넣으십시오.', + 'background' => 'URL을 배경으로 설정하거나 표시하는.', 'guestup_path' => '방문자의 업로드 경로 (맵 베드 경로)를 설정합니다.이 값을 설정하지 않으면 디렉토리의 내용이 파일로 표시되고 설정 후에는 업로드 인터페이스 만 표시되고 파일은 표시되지 않습니다 (로그인 후 표시).', 'passfile' => '사용자 정의 비밀번호 파일의 이름은 \'pppppp\' \'aaaa.txt \'등이 될 수 있으며 디렉토리가 나열되어 있으면 표시되지 않으며 비밀번호를 알고있는 경우에만이 파일을 보거나 다운로드 할 수 있습니다. 암호는이 파일의 내용이며 공백이거나 한국어 일 수 있습니다.', 'public_path' => 'API 긴 링크 액세스를 사용하는 경우 네트워크 디스크 파일의 경로가 표시됩니다. 설정되지 않은 경우 기본적으로 루트 디렉토리로 설정됩니다.', From 0cfccddc4db37164d93bbed9a35c7ece22e8f3ef Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 27 Mar 2020 11:19:55 +0800 Subject: [PATCH 7/9] Update scf.php --- function/scf.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/function/scf.php b/function/scf.php index 7aaa711..382a1ad 100644 --- a/function/scf.php +++ b/function/scf.php @@ -152,8 +152,6 @@ function install() $response = json_decode(SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $SecretId, $SecretKey), true)['Response']; if (api_error($response)) { $html = api_error_msg($response); - $html .= '
-'; $title = 'Error'; return message($html, $title, 201); } else { From 37462b5e9a4e070a6e3db3bf10237df6556df18e Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 27 Mar 2020 11:53:36 +0800 Subject: [PATCH 8/9] move tag after admin --- function/common.php | 64 ++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/function/common.php b/function/common.php index 5326412..9290cca 100644 --- a/function/common.php +++ b/function/common.php @@ -260,7 +260,7 @@ function array_value_isnot_null($arr) return $arr!==''; } -function curl_request($url, $data = false, $headers = []) +function curl_request($url, $data = false, $headers = [], $returnheader = 0) { if (!isset($headers['Accept'])) $headers['Accept'] = '*/*'; //if (!isset($headers['Referer'])) $headers['Referer'] = $url; @@ -278,14 +278,23 @@ function curl_request($url, $data = false, $headers = []) curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_HEADER, $returnheader); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders); - $response['body'] = curl_exec($ch); + //$response['body'] = curl_exec($ch); + if ($returnheader) { + list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch)); + foreach (explode("\r\n", $returnhead) as $head) { + $tmp = explode(': ', $head); + $heads[$tmp[0]] = $tmp[1]; + } + $response['returnhead'] = $heads; + } else { + $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); return $response; } @@ -543,26 +552,8 @@ function main($path) if ($constStr['language']=='') $constStr['language'] = 'en-us'; $_SERVER['language'] = $constStr['language']; $_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path); - $_SERVER['base_disk_path'] = $_SERVER['base_path']; - $disktags = explode("|",getConfig('disktag')); -// echo 'count$disk:'.count($disktags); - if (count($disktags)>1) { - if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); - $_SERVER['disktag'] = $path; - $pos = strpos($path, '/'); - if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); - if (!in_array($_SERVER['disktag'], $disktags)) return message('Please visit from Home Page.', 'Error', 404); - $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]; -// echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.' -//'; - $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']); - if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/'; - $_SERVER['is_guestup_path'] = is_guestup_path($path); - $_SERVER['ajax']=0; - if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1; + if (getConfig('admin')=='') return install(); if (getConfig('adminloginpage')=='') { $adminloginpage = 'admin'; } else { @@ -597,8 +588,27 @@ function main($path) $url = path_format($_SERVER['PHP_SELF'] . '/'); return output('', 302, [ 'Location' => $url ]); } - - if (getConfig('admin')=='') return install(); + + $_SERVER['base_disk_path'] = $_SERVER['base_path']; + $disktags = explode("|",getConfig('disktag')); +// echo 'count$disk:'.count($disktags); + if (count($disktags)>1) { + if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + $_SERVER['disktag'] = $path; + $pos = strpos($path, '/'); + if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); + if (!in_array($_SERVER['disktag'], $disktags)) return message('Please visit from Home Page.', 'Error', 404); + $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]; +// echo 'main.disktag:'.$_SERVER['disktag'].',path:'.$path.' +//'; + $_SERVER['list_path'] = getListpath($_SERVER['HTTP_HOST']); + if ($_SERVER['list_path']=='') $_SERVER['list_path'] = '/'; + $_SERVER['is_guestup_path'] = is_guestup_path($path); + $_SERVER['ajax']=0; + if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1; + config_oauth(); if ($_SERVER['admin']) if (isset($_GET['AddDisk'])||isset($_GET['authorization_code'])) return get_refresh_token(); $refresh_token = getConfig('refresh_token'); @@ -1312,7 +1322,7 @@ function get_refresh_token()
- +
-
+