Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwsswl
OneManager-php
提交
34599a6e
O
OneManager-php
项目概览
lwsswl
/
OneManager-php
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneManager-php
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
34599a6e
编写于
1月 16, 2021
作者:
R
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use BasicAuth in encrypted folder. fix: error_log in SCF
上级
5e49a44e
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
133 addition
and
93 deletion
+133
-93
common.php
common.php
+25
-10
disk/Aliyundrive.php
disk/Aliyundrive.php
+30
-30
disk/Onedrive.php
disk/Onedrive.php
+11
-11
disk/Sharelink.php
disk/Sharelink.php
+4
-4
index.php
index.php
+0
-27
platform/AliyunFC.php
platform/AliyunFC.php
+27
-0
platform/BaiduCFC.php
platform/BaiduCFC.php
+5
-0
platform/Heroku.php
platform/Heroku.php
+8
-8
platform/HuaweiFG_env.php
platform/HuaweiFG_env.php
+5
-0
platform/HuaweiFG_file.php
platform/HuaweiFG_file.php
+5
-0
platform/Normal.php
platform/Normal.php
+1
-1
platform/TencentSCF_env.php
platform/TencentSCF_env.php
+5
-0
platform/TencentSCF_file.php
platform/TencentSCF_file.php
+7
-2
未找到文件。
common.php
浏览文件 @
34599a6e
...
...
@@ -475,7 +475,7 @@ function filecache($disktag)
$tag
=
str_replace
(
':'
,
'_'
,
$tag
);
$tag
=
str_replace
(
'\\'
,
'_'
,
$tag
);
}
// error_log('DIR:' . $dir . ' TAG: ' . $tag);
// error_log
1
('DIR:' . $dir . ' TAG: ' . $tag);
$cache
=
new
\
Doctrine\Common\Cache\FilesystemCache
(
$dir
,
$tag
);
return
$cache
;
}
...
...
@@ -575,6 +575,11 @@ function base64y_decode($str)
return
$str
;
}
function
error_log1
(
$str
)
{
error_log
(
$str
);
}
function
is_guestup_path
(
$path
)
{
if
(
getConfig
(
'guestup_path'
,
$_SERVER
[
'disktag'
])
!=
''
)
{
...
...
@@ -683,6 +688,13 @@ function comppass($pass)
return
2
;
}
if
(
$_COOKIE
[
'password'
]
!==
''
)
if
(
$_COOKIE
[
'password'
]
===
$pass
)
return
3
;
//$_SERVER['PHP_AUTH_USER']
if
(
$_SERVER
[
'PHP_AUTH_PW'
]
!==
''
)
if
(
md5
(
$_SERVER
[
'PHP_AUTH_PW'
])
===
$pass
)
{
date_default_timezone_set
(
'UTC'
);
$_SERVER
[
'Set-Cookie'
]
=
'password='
.
$pass
.
'; expires='
.
date
(
DATE_COOKIE
,
strtotime
(
'+1hour'
));
date_default_timezone_set
(
get_timezone
(
$_SERVER
[
'timezone'
]));
return
2
;
}
return
4
;
}
...
...
@@ -1492,7 +1504,7 @@ function render_list($path = '', $files = [])
$file_path
=
$theme
;
$tmp
=
curl
(
'GET'
,
$file_path
,
false
,
[],
1
);
if
(
$tmp
[
'stat'
]
==
302
)
{
error_log
(
json_encode
(
$tmp
));
error_log
1
(
json_encode
(
$tmp
));
$tmp
=
curl
(
'GET'
,
$tmp
[
"returnhead"
][
"Location"
]);
}
if
(
!!
$tmp
[
'body'
])
$html
=
$tmp
[
'body'
];
...
...
@@ -1603,6 +1615,16 @@ function render_list($path = '', $files = [])
}
if
(
$_SERVER
[
'ishidden'
]
==
4
)
{
// 加密状态
// Basic Auth
return
output
(
'Need password.'
,
401
,
[
'WWW-Authenticate'
=>
'Basic realm="Secure Area"'
]);
/*$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--ListStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--ListEnd-->');
$html .= $tmp[1];
}*/
$tmp
[
1
]
=
'a'
;
while
(
$tmp
[
1
]
!=
''
)
{
$tmp
=
splitfirst
(
$html
,
'<!--IsFileStart-->'
);
...
...
@@ -1617,13 +1639,6 @@ function render_list($path = '', $files = [])
$tmp
=
splitfirst
(
$tmp
[
1
],
'<!--IsFolderEnd-->'
);
$html
.
=
$tmp
[
1
];
}
/*$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--ListStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--ListEnd-->');
$html .= $tmp[1];
}*/
$tmp
[
1
]
=
'a'
;
while
(
$tmp
[
1
]
!=
''
)
{
$tmp
=
splitfirst
(
$html
,
'<!--IsNotHiddenStart-->'
);
...
...
@@ -1891,7 +1906,7 @@ function render_list($path = '', $files = [])
if
(
$ext
==
$key1
)
{
$FolderListStr
=
str_replace
(
'<!--IconValue-->'
,
$value1
,
$FolderListStr
);
}
//error_log('file:'.$file['name'].':'.$key1);
//error_log
1
('file:'.$file['name'].':'.$key1);
if
(
!
strpos
(
$FolderListStr
,
'<!--IconValue-->'
))
break
;
}
if
(
strpos
(
$FolderListStr
,
'<!--IconValue-->'
))
$FolderListStr
=
str_replace
(
'<!--IconValue-->'
,
$IconValues
[
'default'
],
$FolderListStr
);
...
...
disk/Aliyundrive.php
浏览文件 @
34599a6e
...
...
@@ -78,7 +78,7 @@ class Aliyundrive {
}
elseif
(
isset
(
$files
[
'code'
]))
{
return
$files
;
}
//error_log(json_encode($tmp));
//error_log
1
(json_encode($tmp));
return
$tmp
;
}
...
...
@@ -91,7 +91,7 @@ class Aliyundrive {
//if (!($files = getcache('path_' . $path, $this->disktag))) {
if
(
$path
==
'/'
||
$path
==
''
)
{
$files
=
$this
->
fileList
(
'root'
);
//error_log('root_id' . $files['id']);
//error_log
1
('root_id' . $files['id']);
$files
[
'file_id'
]
=
'root'
;
$files
[
'type'
]
=
'folder'
;
}
else
{
...
...
@@ -136,7 +136,7 @@ class Aliyundrive {
savecache
(
'path_'
.
$path
,
$files
,
$this
->
disktag
,
600
);
}
//}
//error_log('path:' . $path . ', files:' . json_encode($files));
//error_log
1
('path:' . $path . ', files:' . json_encode($files));
return
$files
;
}
...
...
@@ -191,7 +191,7 @@ class Aliyundrive {
$result
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
//error_log('decode:' . json_encode($result));
//error_log
1
('decode:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
//return output($result['body'], $result['stat']);
}
...
...
@@ -211,7 +211,7 @@ class Aliyundrive {
$result
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
//error_log('result:' . json_encode($result));
//error_log
1
('result:' . json_encode($result));
//return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
$res
=
json_decode
(
$result
[
'body'
],
true
)[
'responses'
][
0
];
if
(
isset
(
$res
[
'status'
]))
return
output
(
$res
[
'id'
],
$res
[
'status'
]);
...
...
@@ -224,7 +224,7 @@ class Aliyundrive {
}
if
(
!
$folder
[
'id'
])
{
$res
=
$this
->
list_path
(
$folder
[
'path'
]);
//error_log('res:' . json_encode($res));
//error_log
1
('res:' . json_encode($res));
$folder
[
'id'
]
=
$res
[
'file_id'
];
}
$tmp
=
'/tmp/'
.
$passfilename
;
...
...
@@ -233,7 +233,7 @@ class Aliyundrive {
$result
=
$this
->
tmpfileCreate
(
$folder
[
'id'
],
$tmp
,
$passfilename
);
if
(
$result
[
'stat'
]
==
201
)
{
//error_log('1,url:' . $url .' res:' . json_encode($result));
//error_log
1
('1,url:' . $url .' res:' . json_encode($result));
$res
=
json_decode
(
$result
[
'body'
],
true
);
$url
=
$res
[
'part_info_list'
][
0
][
'upload_url'
];
if
(
!
$url
)
{
// 无url,应该算秒传
...
...
@@ -249,13 +249,13 @@ class Aliyundrive {
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
}
//error_log('2,url:' . $url .' res:' . json_encode($result));
//error_log
1
('2,url:' . $url .' res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
public
function
Move
(
$file
,
$folder
)
{
if
(
!
$folder
[
'id'
])
{
$res
=
$this
->
list_path
(
$folder
[
'path'
]);
//error_log('res:' . json_encode($res));
//error_log
1
('res:' . json_encode($res));
$folder
[
'id'
]
=
$res
[
'file_id'
];
}
...
...
@@ -276,13 +276,13 @@ class Aliyundrive {
$result
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
//savecache('path_' . $file['path'], json_decode('{}',true), $this->disktag, 1);
//error_log('result:' . json_encode($result));
//error_log
1
('result:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
public
function
Copy
(
$file
)
{
if
(
!
$file
[
'id'
])
{
$oldfile
=
$this
->
list_path
(
$file
[
'path'
]
.
'/'
.
$file
[
'name'
]);
//error_log('res:' . json_encode($res));
//error_log
1
('res:' . json_encode($res));
//$file['id'] = $res['file_id'];
}
else
{
$oldfile
=
$this
->
fileGet
(
$file
[
'id'
]);
...
...
@@ -308,7 +308,7 @@ class Aliyundrive {
$result
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
if
(
$result
[
'stat'
]
==
201
)
{
//error_log('1,url:' . $url .' res:' . json_encode($result));
//error_log
1
('1,url:' . $url .' res:' . json_encode($result));
$res
=
json_decode
(
$result
[
'body'
],
true
);
$url
=
$res
[
'part_info_list'
][
0
][
'upload_url'
];
if
(
!
$url
)
{
// 无url,应该算秒传
...
...
@@ -326,7 +326,7 @@ class Aliyundrive {
else return output('success', 0);
}*/
}
//error_log('2,url:' . $url .' res:' . json_encode($result));
//error_log
1
('2,url:' . $url .' res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
public
function
Edit
(
$file
,
$content
)
{
...
...
@@ -343,7 +343,7 @@ class Aliyundrive {
$result
=
$this
->
tmpfileCreate
(
$this
->
list_path
(
$folderpath
)[
'file_id'
],
$tmp1
,
$filename
);
if
(
$result
[
'stat'
]
==
201
)
{
//error_log('1,url:' . $url .' res:' . json_encode($result));
//error_log
1
('1,url:' . $url .' res:' . json_encode($result));
$res
=
json_decode
(
$result
[
'body'
],
true
);
$url
=
$res
[
'part_info_list'
][
0
][
'upload_url'
];
if
(
!
$url
)
{
// 无url,应该算秒传
...
...
@@ -360,18 +360,18 @@ class Aliyundrive {
else
return
output
(
'success'
,
0
);
}
}
//error_log('2,url:' . $url .' res:' . json_encode($result));
//error_log
1
('2,url:' . $url .' res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
public
function
Create
(
$folder
,
$type
,
$name
,
$content
=
''
)
{
if
(
!
$folder
[
'id'
])
{
$res
=
$this
->
list_path
(
$folder
[
'path'
]);
//error_log('res:' . json_encode($res));
//error_log
1
('res:' . json_encode($res));
$folder
[
'id'
]
=
$res
[
'file_id'
];
}
if
(
$type
==
'folder'
)
{
$result
=
$this
->
folderCreate
(
$folder
[
'id'
],
$name
);
//error_log('res:' . json_encode($result));
//error_log
1
('res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
if
(
$type
==
'file'
)
{
...
...
@@ -381,32 +381,32 @@ class Aliyundrive {
$result
=
$this
->
tmpfileCreate
(
$folder
[
'id'
],
$tmp
,
$name
);
if
(
$result
[
'stat'
]
==
201
)
{
//error_log('1,url:' . $url .' res:' . json_encode($result));
//error_log
1
('1,url:' . $url .' res:' . json_encode($result));
$res
=
json_decode
(
$result
[
'body'
],
true
);
if
(
isset
(
$res
[
'exist'
])
&&
$res
[
'exist'
]
!=
false
)
{
// 已经有
//error_log('exist:' . json_encode($res));
//error_log
1
('exist:' . json_encode($res));
return
output
(
'{"type":"file","name":"'
.
$name
.
'", "exist":true}'
,
200
);
}
if
(
isset
(
$res
[
'rapid_upload'
])
&&
$res
[
'rapid_upload'
]
!=
false
)
{
// 秒传
//error_log('rapid up:' . json_encode($res));
//error_log
1
('rapid up:' . json_encode($res));
return
output
(
'{"type":"file","name":"'
.
$name
.
'", "rapid_upload":true}'
,
200
);
}
$url
=
$res
[
'part_info_list'
][
0
][
'upload_url'
];
$file_id
=
$res
[
'file_id'
];
$upload_id
=
$res
[
'upload_id'
];
$result
=
curl
(
'PUT'
,
$url
,
$content
,
[],
1
);
//error_log('2,url:' . $url .' res:' . json_encode($result));
//error_log
1
('2,url:' . $url .' res:' . json_encode($result));
if
(
$result
[
'stat'
]
==
200
)
{
// 块1传好
$tmp1
[
'part_number'
]
=
1
;
$tmp1
[
'etag'
]
=
$result
[
'returnhead'
][
'ETag'
];
$result
=
$this
->
fileComplete
(
$file_id
,
$upload_id
,
[
$tmp1
]);
//error_log('3,url:' . $url .' res:' . json_encode($result));
//error_log
1
('3,url:' . $url .' res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
}
//error_log('4,url:' . $url .' res:' . json_encode($result));
//error_log
1
('4,url:' . $url .' res:' . json_encode($result));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$result
[
'body'
],
true
))),
$result
[
'stat'
]);
}
return
output
(
'Type not folder or file.'
,
500
);
...
...
@@ -539,20 +539,20 @@ class Aliyundrive {
$parent_file_id
=
$parent
[
'file_id'
];
}
else
{
$res
=
$this
->
folderCreate
(
$this
->
list_path
(
$path
)[
'file_id'
],
$fileinfo
[
'path'
]);
//error_log($res['body']);
//error_log
1
($res['body']);
$parent_file_id
=
json_decode
(
$res
[
'body'
],
true
)[
'file_id'
];
}
$response
=
$this
->
fileCreate
(
$parent_file_id
,
$filename
,
$_POST
[
'filesha1'
],
$fileinfo
[
'size'
]);
$res
=
json_decode
(
$response
[
'body'
],
true
);
if
(
isset
(
$res
[
'exist'
]))
{
// 已经有
//error_log('exist:' . json_encode($res));
//error_log
1
('exist:' . json_encode($res));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$response
[
'body'
],
true
))),
$response
[
'stat'
]);
//return output('{"type":"file","name":"' . $_POST['upbigfilename'] . '", "exist":true}', 200);
}
if
(
isset
(
$res
[
'rapid_upload'
])
&&
$res
[
'rapid_upload'
]
!=
false
)
{
// 秒传
//error_log('rapid up:' . json_encode($res));
//error_log
1
('rapid up:' . json_encode($res));
return
output
(
json_encode
(
$this
->
files_format
(
json_decode
(
$response
[
'body'
],
true
))),
$response
[
'stat'
]);
//return output('{"type":"file","name":"' . $_POST['upbigfilename'] . '", "rapid upload":true}', 200);
}
...
...
@@ -694,10 +694,10 @@ class Aliyundrive {
$response
=
curl
(
'POST'
,
$this
->
auth_url
,
json_encode
(
$tmp1
),
[
"content-type"
=>
"application/json; charset=utf-8"
]);
$p
++
;
}
error_log
(
json_encode
(
$response
));
error_log
1
(
json_encode
(
$response
));
if
(
$response
[
'stat'
]
==
200
)
$ret
=
json_decode
(
$response
[
'body'
],
true
);
if
(
!
isset
(
$ret
[
'access_token'
]))
{
error_log
(
'failed to get ['
.
$this
->
disktag
.
'] access_token. response'
.
json_encode
(
$ret
));
error_log
1
(
'failed to get ['
.
$this
->
disktag
.
'] access_token. response'
.
json_encode
(
$ret
));
$response
[
'body'
]
=
json_encode
(
json_decode
(
$response
[
'body'
]),
JSON_PRETTY_PRINT
);
$response
[
'body'
]
.
=
'\nfailed to get ['
.
$this
->
disktag
.
'] access_token.'
;
return
$response
;
...
...
@@ -705,7 +705,7 @@ class Aliyundrive {
$tmp
=
$ret
;
$tmp
[
'access_token'
]
=
'******'
;
$tmp
[
'refresh_token'
]
=
'******'
;
error_log
(
'['
.
$this
->
disktag
.
'] Get access token:'
.
json_encode
(
$tmp
,
JSON_PRETTY_PRINT
));
error_log
1
(
'['
.
$this
->
disktag
.
'] Get access token:'
.
json_encode
(
$tmp
,
JSON_PRETTY_PRINT
));
$this
->
access_token
=
$ret
[
'access_token'
];
savecache
(
'access_token'
,
$this
->
access_token
,
$this
->
disktag
,
$ret
[
'expires_in'
]
-
300
);
if
(
time
()
>
getConfig
(
'token_expires'
,
$this
->
disktag
))
setConfig
([
'refresh_token'
=>
$ret
[
'refresh_token'
],
'token_expires'
=>
time
()
+
7
*
24
*
60
*
60
],
$this
->
disktag
);
...
...
@@ -713,4 +713,4 @@ class Aliyundrive {
}
return
true
;
}
}
}
\ No newline at end of file
disk/Onedrive.php
浏览文件 @
34599a6e
...
...
@@ -118,7 +118,7 @@ class Onedrive {
$files
[
'error'
][
'stat'
]
=
$arr
[
'stat'
];
}
}
else
{
//error_log($arr['body']);
//error_log
1
($arr['body']);
$files
=
json_decode
(
$arr
[
'body'
],
true
);
if
(
isset
(
$files
[
'error'
]))
{
$files
[
'error'
][
'stat'
]
=
$arr
[
'stat'
];
...
...
@@ -128,7 +128,7 @@ class Onedrive {
$files
[
'error'
][
'message'
]
=
'unknownError'
;
}
//$files = json_decode( '{"unknownError":{ "stat":'.$arr['stat'].',"message":"'.$arr['body'].'"}}', true);
//error_log(json_encode($files, JSON_PRETTY_PRINT));
//error_log
1
(json_encode($files, JSON_PRETTY_PRINT));
}
}
//echo '<pre>' . json_encode($files, JSON_PRETTY_PRINT) . '</pre>';
...
...
@@ -172,7 +172,7 @@ class Onedrive {
}
elseif
(
isset
(
$files
[
'error'
]))
{
return
$files
;
}
//error_log(json_encode($tmp));
//error_log
1
(json_encode($tmp));
return
$tmp
;
}
...
...
@@ -463,7 +463,7 @@ class Onedrive {
$api
=
$this
->
api_url
.
'/me/followedSites'
;
$arr
=
curl
(
'GET'
,
$api
,
''
,
[
'Authorization'
=>
'Bearer '
.
$this
->
access_token
]);
if
(
!
(
$arr
[
'stat'
]
==
200
||
$arr
[
'stat'
]
==
403
||
$arr
[
'stat'
]
==
400
))
return
message
(
$arr
[
'stat'
]
.
json_encode
(
json_decode
(
$arr
[
'body'
]),
JSON_PRETTY_PRINT
),
'Get followedSites'
,
$arr
[
'stat'
]);
error_log
(
$arr
[
'body'
]);
error_log
1
(
$arr
[
'body'
]);
$sites
=
json_decode
(
$arr
[
'body'
],
true
)[
'value'
];
$title
=
'Select Disk'
;
...
...
@@ -717,8 +717,8 @@ class Onedrive {
}
if
(
$response
[
'stat'
]
==
200
)
$ret
=
json_decode
(
$response
[
'body'
],
true
);
if
(
!
isset
(
$ret
[
'access_token'
]))
{
error_log
(
$this
->
oauth_url
.
'token'
.
'?client_id='
.
$this
->
client_id
.
'&client_secret='
.
$this
->
client_secret
.
'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token='
.
substr
(
$refresh_token
,
0
,
20
)
.
'******'
.
substr
(
$refresh_token
,
-
20
));
error_log
(
'failed to get ['
.
$this
->
disktag
.
'] access_token. response'
.
json_encode
(
$ret
));
error_log
1
(
$this
->
oauth_url
.
'token'
.
'?client_id='
.
$this
->
client_id
.
'&client_secret='
.
$this
->
client_secret
.
'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token='
.
substr
(
$refresh_token
,
0
,
20
)
.
'******'
.
substr
(
$refresh_token
,
-
20
));
error_log
1
(
'failed to get ['
.
$this
->
disktag
.
'] access_token. response'
.
json_encode
(
$ret
));
$response
[
'body'
]
=
json_encode
(
json_decode
(
$response
[
'body'
]),
JSON_PRETTY_PRINT
);
$response
[
'body'
]
.
=
'\nfailed to get ['
.
$this
->
disktag
.
'] access_token.'
;
return
$response
;
...
...
@@ -727,7 +727,7 @@ class Onedrive {
$tmp
=
$ret
;
$tmp
[
'access_token'
]
=
'******'
;
$tmp
[
'refresh_token'
]
=
'******'
;
error_log
(
'['
.
$this
->
disktag
.
'] Get access token:'
.
json_encode
(
$tmp
,
JSON_PRETTY_PRINT
));
error_log
1
(
'['
.
$this
->
disktag
.
'] Get access token:'
.
json_encode
(
$tmp
,
JSON_PRETTY_PRINT
));
$this
->
access_token
=
$ret
[
'access_token'
];
savecache
(
'access_token'
,
$this
->
access_token
,
$this
->
disktag
,
$ret
[
'expires_in'
]
-
300
);
if
(
time
()
>
getConfig
(
'token_expires'
,
$this
->
disktag
))
setConfig
([
'refresh_token'
=>
$ret
[
'refresh_token'
],
'token_expires'
=>
time
()
+
7
*
24
*
60
*
60
],
$this
->
disktag
);
...
...
@@ -757,7 +757,7 @@ class Onedrive {
$i
++
;
}
if
(
$response
[
'stat'
]
!=
200
)
{
error_log
(
'failed to get siteid. response'
.
json_encode
(
$response
));
error_log
1
(
'failed to get siteid. response'
.
json_encode
(
$response
));
$response
[
'body'
]
.
=
'\nfailed to get siteid.'
;
return
$response
;
//throw new Exception($response['stat'].', failed to get siteid.'.$response['body']);
...
...
@@ -767,7 +767,7 @@ class Onedrive {
public
function
del_upload_cache
(
$path
)
{
error_log
(
'del.tmp:GET,'
.
json_encode
(
$_GET
,
JSON_PRETTY_PRINT
));
error_log
1
(
'del.tmp:GET,'
.
json_encode
(
$_GET
,
JSON_PRETTY_PRINT
));
$tmp
=
splitlast
(
$_GET
[
'filename'
],
'/'
);
if
(
$tmp
[
1
]
!=
''
)
{
$filename
=
$tmp
[
0
]
.
'/.'
.
$_GET
[
'filelastModified'
]
.
'_'
.
$_GET
[
'filesize'
]
.
'_'
.
$tmp
[
1
]
.
'.tmp'
;
...
...
@@ -905,11 +905,11 @@ class Onedrive {
$response
[
'stat'
]
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
//$response['Location'] = curl_getinfo($ch);
curl_close
(
$ch
);
error_log
(
$response
[
'stat'
]
.
'
error_log
1
(
$response
[
'stat'
]
.
'
'
.
$response
[
'body'
]
.
'
'
.
$url
.
'
'
);
return
$response
;
}
}
}
\ No newline at end of file
disk/Sharelink.php
浏览文件 @
34599a6e
...
...
@@ -37,8 +37,8 @@ class Sharelink extends Onedrive {
$this
->
access_token
=
splitlast
(
$ret
[
'ListSchema'
][
'.driveAccessToken'
],
'='
)[
1
];
$this
->
api_url
=
$ret
[
'ListSchema'
][
'.driveUrl'
]
.
'/root'
;
if
(
!
$this
->
access_token
)
{
error_log
(
$domain
.
"/personal/"
.
$account
.
"/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='"
.
urlencode
(
"/personal/"
.
$account
.
"/Documents"
)
.
"'&RootFolder="
.
urlencode
(
"/personal/"
.
$account
.
"/Documents/"
)
.
"&TryNewExperienceSingle=TRUE"
);
error_log
(
'failed to get share access_token. response'
.
json_encode
(
$ret
));
error_log
1
(
$domain
.
"/personal/"
.
$account
.
"/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='"
.
urlencode
(
"/personal/"
.
$account
.
"/Documents"
)
.
"'&RootFolder="
.
urlencode
(
"/personal/"
.
$account
.
"/Documents/"
)
.
"&TryNewExperienceSingle=TRUE"
);
error_log
1
(
'failed to get share access_token. response'
.
json_encode
(
$ret
));
$response
[
'body'
]
=
json_encode
(
json_decode
(
$response
[
'body'
]),
JSON_PRETTY_PRINT
);
$response
[
'body'
]
.
=
'\nfailed to get shareurl access_token.'
;
return
$response
;
...
...
@@ -46,7 +46,7 @@ class Sharelink extends Onedrive {
}
//$tmp = $ret;
//$tmp['access_token'] = '******';
//error_log('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
//error_log
1
('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
savecache
(
'access_token'
,
$this
->
access_token
,
$this
->
disktag
);
$tmp1
=
null
;
if
(
getConfig
(
'shareapiurl'
,
$this
->
disktag
)
!=
$this
->
api_url
)
$tmp1
[
'shareapiurl'
]
=
$this
->
api_url
;
...
...
@@ -56,4 +56,4 @@ class Sharelink extends Onedrive {
}
return
true
;
}
}
}
\ No newline at end of file
index.php
浏览文件 @
34599a6e
...
...
@@ -15,8 +15,6 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
//else include 'platform/HuaweiFG_env.php';
echo
'FG'
.
PHP_EOL
;
}
elseif
(
$_SERVER
[
'BCE_CFC_RUNTIME_NAME'
]
==
'php7'
)
{
//set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/php');
//include 'BaiduBce.phar';
include
'platform/BaiduCFC.php'
;
}
elseif
(
isset
(
$_SERVER
[
'HEROKU_APP_DIR'
])
&&
$_SERVER
[
'HEROKU_APP_DIR'
]
===
'/app'
)
{
include
'platform/Heroku.php'
;
...
...
@@ -136,28 +134,3 @@ function handler($event, $context)
}
}
// used by Aliyun FC
function
myErrorHandler
(
$errno
,
$errstr
,
$errfile
,
$errline
)
{
if
(
!
(
error_reporting
()
&
$errno
))
{
return
false
;
}
switch
(
$errno
)
{
case
E_USER_ERROR
:
$errInfo
=
array
(
"errorMessage"
=>
$errstr
,
"errorType"
=>
\
ServerlessFC\friendly_error_type
(
$errno
),
"stackTrace"
=>
array
(
"file"
=>
$errfile
,
"line"
=>
$errline
,
),
);
throw
new
\
ErrorException
(
$errstr
,
0
,
$errno
,
$errfile
,
$errline
);
break
;
default
:
// E_USER_WARNING | E_USER_NOTICE
break
;
}
return
true
;
}
platform/AliyunFC.php
浏览文件 @
34599a6e
...
...
@@ -28,6 +28,11 @@ function GetGlobalVariable($event)
$pos
=
strpos
(
$cookievalues
,
"="
);
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
if
(
isset
(
$event
[
'headers'
][
'Authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'Authorization'
][
0
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'FC_SERVER_PATH'
]
=
'/var/fc/runtime/php7.2'
;
}
...
...
@@ -454,3 +459,25 @@ function addFileToZip($zip, $rootpath, $path = '')
}
@
closedir
(
$path
);
}
function
myErrorHandler
(
$errno
,
$errstr
,
$errfile
,
$errline
)
{
if
(
!
(
error_reporting
()
&
$errno
))
{
return
false
;
}
switch
(
$errno
)
{
case
E_USER_ERROR
:
$errInfo
=
array
(
"errorMessage"
=>
$errstr
,
"errorType"
=>
\
ServerlessFC\friendly_error_type
(
$errno
),
"stackTrace"
=>
array
(
"file"
=>
$errfile
,
"line"
=>
$errline
,
),
);
throw
new
\
ErrorException
(
$errstr
,
0
,
$errno
,
$errfile
,
$errline
);
break
;
default
:
// E_USER_WARNING | E_USER_NOTICE
break
;
}
return
true
;
}
platform/BaiduCFC.php
浏览文件 @
34599a6e
...
...
@@ -27,6 +27,11 @@ function GetGlobalVariable($event)
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
$_SERVER
[
'HTTP_USER_AGENT'
]
=
$event
[
'headers'
][
'User-Agent'
];
if
(
isset
(
$event
[
'headers'
][
'authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'authorization'
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'HTTP_TRANSLATE'
]
=
$event
[
'headers'
][
'translate'
];
//'f'
$_SERVER
[
'BCE_CFC_RUNTIME_NAME'
]
=
'php7'
;
}
...
...
platform/Heroku.php
浏览文件 @
34599a6e
...
...
@@ -15,14 +15,14 @@ function getpath()
function
getGET
()
{
//error_log('POST:' . json_encode($_POST));
//error_log
1
('POST:' . json_encode($_POST));
if
(
!
$_POST
)
{
if
(
!!
$HTTP_RAW_POST_DATA
)
{
$tmpdata
=
$HTTP_RAW_POST_DATA
;
//error_log('RAW:' . $tmpdata);
//error_log
1
('RAW:' . $tmpdata);
}
else
{
$tmpdata
=
file_get_contents
(
'php://input'
);
//error_log('PHPINPUT:' . $tmpdata);
//error_log
1
('PHPINPUT:' . $tmpdata);
}
if
(
!!
$tmpdata
)
{
$postbody
=
explode
(
"&"
,
$tmpdata
);
...
...
@@ -30,7 +30,7 @@ function getGET()
$pos
=
strpos
(
$postvalues
,
"="
);
$_POST
[
urldecode
(
substr
(
$postvalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$postvalues
,
$pos
+
1
));
}
//error_log('POSTformPHPINPUT:' . json_encode($_POST));
//error_log
1
('POSTformPHPINPUT:' . json_encode($_POST));
}
}
$p
=
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'?'
);
...
...
@@ -117,9 +117,9 @@ function setConfig($arr, $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'
));
error_log1
(
json_encode
(
$arr
,
JSON_PRETTY_PRINT
)
.
' => tmp:'
.
json_encode
(
$tmp
,
JSON_PRETTY_PRINT
));
}
function
install
()
...
...
@@ -227,7 +227,7 @@ function HerokuAPI($method, $url, $data = '', $apikey)
foreach
(
$headers
as
$headerName
=>
$headerVal
)
{
$sendHeaders
[]
=
$headerName
.
': '
.
$headerVal
;
}
error_log
(
$method
.
$url
.
$data
.
$apikey
);
error_log
1
(
$method
.
$url
.
$data
.
$apikey
);
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_CUSTOMREQUEST
,
$method
);
...
...
@@ -242,7 +242,7 @@ function HerokuAPI($method, $url, $data = '', $apikey)
$response
[
'body'
]
=
curl_exec
(
$ch
);
$response
[
'stat'
]
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
curl_close
(
$ch
);
error_log
(
$response
[
'stat'
]
.
'
error_log
1
(
$response
[
'stat'
]
.
'
'
.
$response
[
'body'
]
.
'
'
);
return
$response
;
...
...
platform/HuaweiFG_env.php
浏览文件 @
34599a6e
...
...
@@ -40,6 +40,11 @@ function GetGlobalVariable($event)
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
$_SERVER
[
'HTTP_USER_AGENT'
]
=
$event
[
'headers'
][
'user-agent'
];
if
(
isset
(
$event
[
'headers'
][
'authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'authorization'
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'HTTP_TRANSLATE'
]
=
$event
[
'headers'
][
'translate'
];
//'f'
$_SERVER
[
'_APP_SHARE_DIR'
]
=
'/var/share/CFF/processrouter'
;
}
...
...
platform/HuaweiFG_file.php
浏览文件 @
34599a6e
...
...
@@ -40,6 +40,11 @@ function GetGlobalVariable($event)
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
$_SERVER
[
'HTTP_USER_AGENT'
]
=
$event
[
'headers'
][
'user-agent'
];
if
(
isset
(
$event
[
'headers'
][
'authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'authorization'
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'HTTP_TRANSLATE'
]
=
$event
[
'headers'
][
'translate'
];
//'f'
$_SERVER
[
'_APP_SHARE_DIR'
]
=
'/var/share/CFF/processrouter'
;
}
...
...
platform/Normal.php
浏览文件 @
34599a6e
...
...
@@ -316,7 +316,7 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
break
;
}
}
//error_log($outPath);
//error_log
1
($outPath);
if
(
$outPath
==
''
)
return
0
;
//unlink($outPath.'/config.php');
...
...
platform/TencentSCF_env.php
浏览文件 @
34599a6e
...
...
@@ -24,6 +24,11 @@ function GetGlobalVariable($event)
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
$_SERVER
[
'HTTP_USER_AGENT'
]
=
$event
[
'headers'
][
'user-agent'
];
if
(
isset
(
$event
[
'headers'
][
'authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'authorization'
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'HTTP_TRANSLATE'
]
==
$event
[
'headers'
][
'translate'
];
//'f'
$_SERVER
[
'USER'
]
=
'qcloud'
;
}
...
...
platform/TencentSCF_file.php
浏览文件 @
34599a6e
...
...
@@ -24,6 +24,11 @@ function GetGlobalVariable($event)
$_COOKIE
[
urldecode
(
substr
(
$cookievalues
,
0
,
$pos
))]
=
urldecode
(
substr
(
$cookievalues
,
$pos
+
1
));
}
$_SERVER
[
'HTTP_USER_AGENT'
]
=
$event
[
'headers'
][
'user-agent'
];
if
(
isset
(
$event
[
'headers'
][
'authorization'
]))
{
$basicAuth
=
splitfirst
(
base64_decode
(
splitfirst
(
$event
[
'headers'
][
'authorization'
],
'Basic '
)[
1
]),
':'
);
$_SERVER
[
'PHP_AUTH_USER'
]
=
$basicAuth
[
0
];
$_SERVER
[
'PHP_AUTH_PW'
]
=
$basicAuth
[
1
];
}
$_SERVER
[
'HTTP_TRANSLATE'
]
==
$event
[
'headers'
][
'translate'
];
//'f'
$_SERVER
[
'USER'
]
=
'qcloud'
;
}
...
...
@@ -392,7 +397,7 @@ function updateEnvironment($Envs, $function_name, $Region, $Namespace, $SecretId
return
updateProgram
(
$function_name
,
$Region
,
$namespace
,
$SecretId
,
$SecretKey
,
$source
);
$tmp1
[
'Response'
][
'Error'
][
'Message'
]
=
$codeurl
;
error_log
(
$tmp1
[
'Response'
][
'Error'
][
'Message'
]);
error_log
1
(
$tmp1
[
'Response'
][
'Error'
][
'Message'
]);
return
json_encode
(
$tmp1
);
}
...
...
@@ -535,7 +540,7 @@ function updateProgram($function_name, $Region, $Namespace, $SecretId, $SecretKe
// .' -H "X-TC-Version: '.$version.'"'
// .' -H "X-TC-Region: '.$region.'"'
// ." -d '".$payload."'";
//error_log( $curl.PHP_EOL );
//error_log
1
( $curl.PHP_EOL );
//return '{"response": {"Error": {"Message":"' . $curl . '"}}}';
$headers
[
'Authorization'
]
=
$authorization
;
$headers
[
'Content-Type'
]
=
'application/json; charset=utf-8'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录