Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwsswl
OneManager-php
提交
41d37f6b
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 搜索 >>
未验证
提交
41d37f6b
编写于
5月 14, 2021
作者:
Q
qkqpttgf
提交者:
GitHub
5月 14, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #321 from qkqpttgf/GBKpreview
GBKpreview
上级
13b70a42
57fc2729
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
81 addition
and
36 deletion
+81
-36
disk/Aliyundrive.php
disk/Aliyundrive.php
+37
-16
disk/Googledrive.php
disk/Googledrive.php
+27
-15
disk/Onedrive.php
disk/Onedrive.php
+17
-5
未找到文件。
disk/Aliyundrive.php
浏览文件 @
41d37f6b
...
...
@@ -76,7 +76,7 @@ class Aliyundrive {
$tmp
[
'list'
][
$filename
][
'name'
]
=
$file
[
'name'
];
$tmp
[
'list'
][
$filename
][
'time'
]
=
$file
[
'updated_at'
];
$tmp
[
'list'
][
$filename
][
'size'
]
=
$file
[
'size'
];
$tmp
[
'childcount'
]
++
;
//
$tmp['childcount']++;
}
}
elseif
(
isset
(
$files
[
'code'
])
||
isset
(
$files
[
'error'
]))
{
return
$files
;
...
...
@@ -90,8 +90,6 @@ class Aliyundrive {
global
$exts
;
while
(
substr
(
$path
,
-
1
)
==
'/'
)
$path
=
substr
(
$path
,
0
,
-
1
);
if
(
$path
==
''
)
$path
=
'/'
;
//$files = getcache('path_' . $path, $this->disktag);
//if (!$files) {
if
(
!
(
$files
=
getcache
(
'path_'
.
$path
,
$this
->
disktag
)))
{
if
(
$path
==
'/'
||
$path
==
''
)
{
$files
=
$this
->
fileList
(
'root'
);
...
...
@@ -113,22 +111,33 @@ class Aliyundrive {
$files
[
'time'
]
=
$item
[
'updated_at'
];
$files
[
'size'
]
=
$item
[
'size'
];
}
else
$files
=
$item
;
}
}
//echo $files['name'];
}
if
(
$files
[
'type'
]
==
'file'
)
{
if
(
in_array
(
splitlast
(
$files
[
'name'
],
'.'
)[
1
],
$exts
[
'txt'
]))
{
if
(
!
(
isset
(
$files
[
'content'
])
&&
$files
[
'content'
][
'stat'
]
==
200
))
{
$header
[
'Referer'
]
=
'https://www.aliyundrive.com/'
;
$header
[
'User-Agent'
]
=
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'
;
$content1
=
curl
(
'GET'
,
$files
[
'download_url'
],
''
,
$header
);
$files
[
'content'
]
=
$content1
;
savecache
(
'path_'
.
$path
,
$files
,
$this
->
disktag
);
if
(
in_array
(
strtolower
(
splitlast
(
$files
[
'name'
],
'.'
)[
1
]),
$exts
[
'txt'
]))
{
if
(
$files
[
'size'
]
<
1024
*
1024
)
{
if
(
!
(
isset
(
$files
[
'content'
])
&&
$files
[
'content'
][
'stat'
]
==
200
))
{
$header
[
'Referer'
]
=
'https://www.aliyundrive.com/'
;
$header
[
'User-Agent'
]
=
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'
;
$content1
=
curl
(
'GET'
,
$files
[
'download_url'
],
''
,
$header
);
$tmp
=
null
;
$tmp
=
json_decode
(
json_encode
(
$content1
),
true
);
if
(
$tmp
[
'body'
]
===
null
)
{
$tmp
[
'body'
]
=
iconv
(
"GBK"
,
'UTF-8//TRANSLIT'
,
$content1
[
'body'
]);
$tmp
=
json_decode
(
json_encode
(
$tmp
),
true
);
if
(
$tmp
[
'body'
]
!==
null
)
$content1
[
'body'
]
=
$tmp
[
'body'
];
}
//error_log1('body : ' . $content1['body'] . PHP_EOL);
$files
[
'content'
]
=
$content1
;
savecache
(
'path_'
.
$path
,
$files
,
$this
->
disktag
);
}
}
else
{
$files
[
'content'
][
'stat'
]
=
202
;
$files
[
'content'
][
'body'
]
=
'File too large.'
;
}
error_log1
(
$files
[
'name'
]
.
' : '
.
json_encode
(
$files
[
'content'
])
.
PHP_EOL
);
//
error_log1($files['name'] . ' : ' . json_encode($files['content']) . PHP_EOL);
}
}
if
(
!
$files
)
{
...
...
@@ -177,8 +186,8 @@ class Aliyundrive {
$header
[
"content-type"
]
=
"application/json; charset=utf-8"
;
$header
[
'authorization'
]
=
'Bearer '
.
$this
->
access_token
;
$data
[
'limit'
]
=
5
0
;
$data
[
'marker'
]
=
NULL
;
$data
[
'limit'
]
=
20
0
;
$data
[
'marker'
]
=
null
;
$data
[
'drive_id'
]
=
$this
->
driveId
;
$data
[
'parent_file_id'
]
=
$parent_file_id
;
$data
[
'image_thumbnail_process'
]
=
'image/resize,w_160/format,jpeg'
;
...
...
@@ -190,7 +199,19 @@ class Aliyundrive {
$res
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
//error_log1($res['stat'] . $res['body']);
if
(
$res
[
'stat'
]
==
200
)
return
json_decode
(
$res
[
'body'
],
true
);
if
(
$res
[
'stat'
]
==
200
)
{
$body
=
json_decode
(
$res
[
'body'
],
true
);
$body1
=
$body
;
while
(
$body1
[
'next_marker'
]
!=
''
)
{
$data
[
'marker'
]
=
$body1
[
'next_marker'
];
$res1
=
null
;
$res1
=
curl
(
'POST'
,
$url
,
json_encode
(
$data
),
$header
);
$body1
=
json_decode
(
$res1
[
'body'
],
true
);
$body
[
'items'
]
=
array_merge
(
$body
[
'items'
],
$body1
[
'items'
]);
}
return
$body
;
//return json_decode($res['body'], true);
}
else
return
$res
;
}
...
...
disk/Googledrive.php
浏览文件 @
41d37f6b
...
...
@@ -128,21 +128,33 @@ class Googledrive {
//$this->permission('delete', $files['id']);
//if (isset($item['mimeType']) && $item['mimeType']!='application/vnd.google-apps.folder') {
if
(
in_array
(
splitlast
(
$item
[
'name'
],
'.'
)[
1
],
$exts
[
'txt'
]))
{
if
(
!
(
isset
(
$item
[
'content'
])
&&
$item
[
'content'
][
'stat'
]
==
200
))
{
//if (!isset($item['downUrl'])) {
$res
=
curl
(
'GET'
,
$item
[
'webContentLink'
],
''
,
[],
1
);
$weblink
=
$res
[
'returnhead'
][
'Location'
];
//if ($weblink!==null) $item['downUrl'] = $weblink;
//else error_log1('Cant get link:' . json_encode($res, JSON_PRETTY_PRINT));
//}
if
(
$res
[
'stat'
]
==
302
)
{
$content1
=
curl
(
'GET'
,
$weblink
,
''
,
[
"User-Agent"
=>
"qkqpttgf/OneManager 3.0.0"
,
"Accept"
=>
"*/*"
]);
$item
[
'content'
]
=
$content1
;
}
// else $content1 = $res;
//error_log1($item['name'] . '~' . json_encode($content1, JSON_PRETTY_PRINT) . PHP_EOL);
$parent_folder
[
'files'
][
$i
]
=
$item
;
savecache
(
'path_'
.
$path
,
$parent_folder
,
$this
->
disktag
);
if
(
in_array
(
strtolower
(
splitlast
(
$item
[
'name'
],
'.'
)[
1
]),
$exts
[
'txt'
]))
{
if
(
$files
[
'size'
]
<
1024
*
1024
)
{
if
(
!
(
isset
(
$item
[
'content'
])
&&
$item
[
'content'
][
'stat'
]
==
200
))
{
//if (!isset($item['downUrl'])) {
$res
=
curl
(
'GET'
,
$item
[
'webContentLink'
],
''
,
[],
1
);
$weblink
=
$res
[
'returnhead'
][
'Location'
];
//if ($weblink!==null) $item['downUrl'] = $weblink;
//else error_log1('Cant get link:' . json_encode($res, JSON_PRETTY_PRINT));
//}
if
(
$res
[
'stat'
]
==
302
)
{
$content1
=
curl
(
'GET'
,
$weblink
,
''
,
[
"User-Agent"
=>
"qkqpttgf/OneManager 3.0.0"
,
"Accept"
=>
"*/*"
]);
$tmp
=
null
;
$tmp
=
json_decode
(
json_encode
(
$content1
),
true
);
if
(
$tmp
[
'body'
]
===
null
)
{
$tmp
[
'body'
]
=
iconv
(
"GBK"
,
'UTF-8//TRANSLIT'
,
$content1
[
'body'
]);
$tmp
=
json_decode
(
json_encode
(
$tmp
),
true
);
if
(
$tmp
[
'body'
]
!==
null
)
$content1
[
'body'
]
=
$tmp
[
'body'
];
}
$item
[
'content'
]
=
$content1
;
}
// else $content1 = $res;
//error_log1($item['name'] . '~' . json_encode($content1, JSON_PRETTY_PRINT) . PHP_EOL);
$parent_folder
[
'files'
][
$i
]
=
$item
;
savecache
(
'path_'
.
$path
,
$parent_folder
,
$this
->
disktag
);
}
}
else
{
$files
[
'content'
][
'stat'
]
=
202
;
$files
[
'content'
][
'body'
]
=
'File too large.'
;
}
}
//}
...
...
disk/Onedrive.php
浏览文件 @
41d37f6b
...
...
@@ -100,11 +100,23 @@ class Onedrive {
}
}
if
(
isset
(
$files
[
'file'
]))
{
if
(
in_array
(
splitlast
(
$files
[
'name'
],
'.'
)[
1
],
$exts
[
'txt'
]))
{
if
(
!
(
isset
(
$files
[
'content'
])
&&
$files
[
'content'
][
'stat'
]
==
200
))
{
$content1
=
curl
(
'GET'
,
$files
[
$this
->
DownurlStrName
]);
$files
[
'content'
]
=
$content1
;
savecache
(
'path_'
.
$path
,
$files
,
$this
->
disktag
);
if
(
in_array
(
strtolower
(
splitlast
(
$files
[
'name'
],
'.'
)[
1
]),
$exts
[
'txt'
]))
{
if
(
$files
[
'size'
]
<
1024
*
1024
)
{
if
(
!
(
isset
(
$files
[
'content'
])
&&
$files
[
'content'
][
'stat'
]
==
200
))
{
$content1
=
curl
(
'GET'
,
$files
[
$this
->
DownurlStrName
]);
$tmp
=
null
;
$tmp
=
json_decode
(
json_encode
(
$content1
),
true
);
if
(
$tmp
[
'body'
]
===
null
)
{
$tmp
[
'body'
]
=
iconv
(
"GBK"
,
'UTF-8//TRANSLIT'
,
$content1
[
'body'
]);
$tmp
=
json_decode
(
json_encode
(
$tmp
),
true
);
if
(
$tmp
[
'body'
]
!==
null
)
$content1
[
'body'
]
=
$tmp
[
'body'
];
}
$files
[
'content'
]
=
$content1
;
savecache
(
'path_'
.
$path
,
$files
,
$this
->
disktag
);
}
}
else
{
$files
[
'content'
][
'stat'
]
=
202
;
$files
[
'content'
][
'body'
]
=
'File too large.'
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录