Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwsswl
OneManager-php
提交
c0b51709
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 搜索 >>
未验证
提交
c0b51709
编写于
3月 24, 2020
作者:
Q
qkqpttgf
提交者:
GitHub
3月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update common.php
上级
5c016a07
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
37 deletion
+33
-37
function/common.php
function/common.php
+33
-37
未找到文件。
function/common.php
浏览文件 @
c0b51709
...
...
@@ -294,29 +294,29 @@ function gethiddenpass($path,$passfile)
if
(
$path1
!=
'/'
&&
substr
(
$path1
,
-
1
)
==
'/'
)
$path1
=
substr
(
$path1
,
0
,
-
1
);
$password
=
getcache
(
'path_'
.
$path1
.
'/?password'
);
if
(
$password
==
''
)
{
$ispassfile
=
fetch_files
(
path_format
(
$path
.
'/'
.
urlencode
(
$passfile
)));
//echo $path . '<pre>' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '</pre>';
if
(
isset
(
$ispassfile
[
'file'
]))
{
$arr
=
curl_request
(
$ispassfile
[
'@microsoft.graph.downloadUrl'
]);
if
(
$arr
[
'stat'
]
==
200
)
{
$passwordf
=
explode
(
"
\n
"
,
$arr
[
'body'
]);
$password
=
$passwordf
[
0
];
if
(
$password
!=
''
)
$password
=
md5
(
$password
);
savecache
(
'path_'
.
$path1
.
'/?password'
,
$password
);
return
$password
;
}
else
{
//return md5('DefaultP@sswordWhenNetworkError');
return
md5
(
md5
(
time
())
.
rand
(
1000
,
9999
)
);
}
}
else
{
savecache
(
'path_'
.
$path1
.
'/?password'
,
'null'
);
if
(
$path
!==
''
)
{
$path
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
return
gethiddenpass
(
$path
,
$passfile
);
$ispassfile
=
fetch_files
(
path_format
(
$path
.
'/'
.
urlencode
(
$passfile
)));
//echo $path . '<pre>' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '</pre>';
if
(
isset
(
$ispassfile
[
'file'
]))
{
$arr
=
curl_request
(
$ispassfile
[
'@microsoft.graph.downloadUrl'
]);
if
(
$arr
[
'stat'
]
==
200
)
{
$passwordf
=
explode
(
"
\n
"
,
$arr
[
'body'
]);
$password
=
$passwordf
[
0
];
if
(
$password
!=
''
)
$password
=
md5
(
$password
);
savecache
(
'path_'
.
$path1
.
'/?password'
,
$password
);
return
$password
;
}
else
{
//return md5('DefaultP@sswordWhenNetworkError');
return
md5
(
md5
(
time
())
.
rand
(
1000
,
9999
)
);
}
}
else
{
return
''
;
savecache
(
'path_'
.
$path1
.
'/?password'
,
'null'
);
if
(
$path
!==
''
)
{
$path
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
return
gethiddenpass
(
$path
,
$passfile
);
}
else
{
return
''
;
}
}
}
}
elseif
(
$password
===
'null'
)
{
if
(
$path
!==
''
)
{
$path
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
...
...
@@ -517,7 +517,7 @@ 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
[
'base_path'
]
.
'/'
.
$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
);
...
...
@@ -590,7 +590,6 @@ function main($path)
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后缀文件
...
...
@@ -666,7 +665,12 @@ function main($path)
if
(
isset
(
$files
[
'folder'
])
||
isset
(
$files
[
'file'
])
)
{
return
render_list
(
$path
,
$files
);
}
else
{
return
message
(
'<a href="'
.
$_SERVER
[
'base_path'
]
.
'">'
.
getconstStr
(
'Back'
)
.
getconstStr
(
'Home'
)
.
'</a><div style="margin:8px;">'
.
$files
[
'error'
][
'message'
]
.
'</div><a href="javascript:history.back(-1)">'
.
getconstStr
(
'Back'
)
.
'</a>'
,
$files
[
'error'
][
'code'
],
$files
[
'error'
][
'stat'
]);
if
(
!
isset
(
$files
[
'error'
]))
{
$files
[
'error'
][
'message'
]
=
json_encode
(
$files
,
JSON_PRETTY_PRINT
);
$files
[
'error'
][
'code'
]
=
'unknownError'
;
$files
[
'error'
][
'stat'
]
=
500
;
}
return
message
(
'<a href="'
.
$_SERVER
[
'base_path'
]
.
'">'
.
getconstStr
(
'Back'
)
.
getconstStr
(
'Home'
)
.
'</a><div style="margin:8px;"><pre>'
.
$files
[
'error'
][
'message'
]
.
'</pre></div><a href="javascript:history.back(-1)">'
.
getconstStr
(
'Back'
)
.
'</a>'
,
$files
[
'error'
][
'code'
],
$files
[
'error'
][
'stat'
]);
}
}
}
...
...
@@ -683,15 +687,6 @@ function list_files($path)
$files
=
fetch_files
(
$path
);
}
return
$files
;
/*if ( isset($files['folder']) || isset($files['file']) || isset($files['error']) ) {
return $files;
} else {
error_log( json_encode($files) . ' Network Error<br>' );
$_SERVER['retry']++;
if ($_SERVER['retry'] < 3) {
return list_files($path);
} else return $files;
}*/
}
function
adminform
(
$name
=
''
,
$pass
=
''
,
$path
=
''
)
...
...
@@ -759,6 +754,7 @@ function adminoperate($path)
//echo $foldername;
$result
=
MSAPI
(
'PUT'
,
$filename
,
$_GET
[
'encrypt_newpass'
],
$_SERVER
[
'access_token'
]);
$path1
=
path_format
(
$path1
.
'/'
.
$foldername
);
if
(
$path1
!=
'/'
&&
substr
(
$path1
,
-
1
)
==
'/'
)
$path1
=
substr
(
$path1
,
0
,
-
1
);
savecache
(
'path_'
.
$path1
.
'/?password'
,
''
,
1
);
return
output
(
$result
[
'body'
],
$result
[
'stat'
]);
}
...
...
@@ -817,7 +813,7 @@ function adminoperate($path)
//if ($_GET['move_folder'] == '/../') $path2 = path_format( substr($path1, 0, strrpos($path1, '/')) . '/' );
//else $path2 = path_format( $path1 . '/' . $_GET['move_folder'] . '/' );
//savecache('path_' . $path2, json_decode('{}',true), 1);
return
output
(
$result
[
'body'
]
.
json_encode
(
$result
[
'Location'
])
,
$result
[
'stat'
]);
return
output
(
$result
[
'body'
],
$result
[
'stat'
]);
}
if
(
isset
(
$_POST
[
'editfile'
]))
{
// edit 编辑
...
...
@@ -1218,7 +1214,6 @@ function get_refresh_token()
//return message('<pre>' . json_encode($ret, JSON_PRETTY_PRINT) . '</pre>', 500);
}
if
(
isset
(
$_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'
)
{
...
...
@@ -1250,11 +1245,12 @@ function get_refresh_token()
$tmp
[
'client_secret'
]
=
$_POST
[
'client_secret'
];
}
$response
=
setConfigResponse
(
setConfig
(
$tmp
,
$_COOKIE
[
'disktag'
])
);
$title
=
getconstStr
(
'MayinEnv'
);
$html
=
getconstStr
(
'Wait'
)
.
' 3s<meta http-equiv="refresh" content="3;URL='
.
$url
.
'?AddDisk&install1">'
;
if
(
api_error
(
$response
))
{
$html
=
api_error_msg
(
$response
);
$title
=
'Error'
;
}
else
{
$title
=
getconstStr
(
'MayinEnv'
);
$html
=
getconstStr
(
'Wait'
)
.
' 3s<meta http-equiv="refresh" content="3;URL='
.
$url
.
'?AddDisk&install1">'
;
}
return
message
(
$html
,
$title
,
201
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录