commit
0e451380a6
|
@ -859,7 +859,7 @@ function splitlast($str, $split)
|
||||||
$tmp[1] = substr($str, $pos+1);
|
$tmp[1] = substr($str, $pos+1);
|
||||||
} else {
|
} else {
|
||||||
$tmp[0] = '';
|
$tmp[0] = '';
|
||||||
$tmp[1] = $str;
|
$tmp[1] = substr($str, 1);
|
||||||
}
|
}
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
@ -934,28 +934,37 @@ function MSAPI($method, $path, $data = '', $access_token)
|
||||||
|
|
||||||
function fetch_files($path = '/')
|
function fetch_files($path = '/')
|
||||||
{
|
{
|
||||||
|
global $exts;
|
||||||
$path1 = path_format($path);
|
$path1 = path_format($path);
|
||||||
$path = path_format($_SERVER['list_path'] . path_format($path));
|
$path = path_format($_SERVER['list_path'] . path_format($path));
|
||||||
if (!($files = getcache('path_' . $path))) {
|
if (!($files = getcache('path_' . $path))) {
|
||||||
// https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
|
// https://docs.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0
|
||||||
// https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
|
// https://docs.microsoft.com/zh-cn/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
|
||||||
// https://developer.microsoft.com/zh-cn/graph/graph-explorer
|
// https://developer.microsoft.com/zh-cn/graph/graph-explorer
|
||||||
$pos = strrpos($path, '/');
|
$pos = splitlast($path, '/');
|
||||||
if ($pos>1) {
|
$parentpath = $pos[0];
|
||||||
$parentpath = substr($path, 0, $pos);
|
$filename = $pos[1];
|
||||||
$filename = substr($path, $pos+1);
|
if ($parentfiles = getcache('path_' . $parentpath. '/')) {
|
||||||
if ($parentfiles = getcache('path_' . $parentpath))
|
if (isset($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl'])) {
|
||||||
foreach ($parentfiles['children'] as $file)
|
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
|
||||||
if ($file['name']==$filename)
|
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
|
||||||
if (isset($file['@microsoft.graph.downloadUrl']))
|
$content1 = curl_request($parentfiles['children'][$filename]['@microsoft.graph.downloadUrl']);
|
||||||
return $file;
|
$parentfiles['children'][$filename]['content'] = $content1;
|
||||||
|
savecache('path_' . $parentpath. '/', $parentfiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $parentfiles['children'][$filename];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $_SERVER['api_url'];
|
$url = $_SERVER['api_url'];
|
||||||
if ($path !== '/') {
|
if ($path !== '/') {
|
||||||
$url .= ':' . $path;
|
$url .= ':' . $path;
|
||||||
if (substr($url,-1)=='/') $url=substr($url,0,-1);
|
if (substr($url,-1)=='/') $url=substr($url,0,-1);
|
||||||
}
|
}
|
||||||
$url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl)';
|
$url .= '?expand=children(select=name,size,file,folder,parentReference,lastModifiedDateTime,@microsoft.graph.downloadUrl)';
|
||||||
|
$retry = 0;
|
||||||
|
$arr = [];
|
||||||
while ($retry<3&&!$arr['stat']) {
|
while ($retry<3&&!$arr['stat']) {
|
||||||
$arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]);
|
$arr = curl_request($url, false, ['Authorization' => 'Bearer ' . $_SERVER['access_token']]);
|
||||||
$retry++;
|
$retry++;
|
||||||
|
@ -1002,7 +1011,7 @@ function children_name($children)
|
||||||
{
|
{
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
foreach ($children as $file) {
|
foreach ($children as $file) {
|
||||||
$tmp[$file['name']] = $file;
|
$tmp[strtolower($file['name'])] = $file;
|
||||||
}
|
}
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
@ -1115,6 +1124,10 @@ function render_list($path = '', $files = '')
|
||||||
global $exts;
|
global $exts;
|
||||||
global $constStr;
|
global $constStr;
|
||||||
|
|
||||||
|
if (isset($files['children']['index.html']) && !$_SERVER['admin']) {
|
||||||
|
$htmlcontent = fetch_files(spurlencode(path_format($path . '/index.html'),'/'))['content'];
|
||||||
|
return output($htmlcontent['body'], $htmlcontent['stat']);
|
||||||
|
}
|
||||||
$path = str_replace('%20','%2520',$path);
|
$path = str_replace('%20','%2520',$path);
|
||||||
$path = str_replace('+','%2B',$path);
|
$path = str_replace('+','%2B',$path);
|
||||||
$path = str_replace('&','&',path_format(urldecode($path))) ;
|
$path = str_replace('&','&',path_format(urldecode($path))) ;
|
||||||
|
@ -1147,12 +1160,12 @@ function render_list($path = '', $files = '')
|
||||||
|
|
||||||
$theme = getConfig('theme');
|
$theme = getConfig('theme');
|
||||||
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
|
if ( $theme=='' || !file_exists('theme/'.$theme) ) $theme = 'classic.php';
|
||||||
$htmlpage = include 'theme/'.$theme;
|
include 'theme/'.$theme;
|
||||||
|
|
||||||
$html = '<!--
|
$html = '<!--
|
||||||
Github : https://github.com/ldxw/OneManager-php
|
Github : https://github.com/ldxw/OneManager-php
|
||||||
-->' . ob_get_clean();
|
-->' . ob_get_clean();
|
||||||
if (isset($htmlpage['statusCode'])) return $htmlpage;
|
//if (isset($htmlpage['statusCode'])) return $htmlpage;
|
||||||
if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
|
if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
|
||||||
return output($html,$statusCode);
|
return output($html,$statusCode);
|
||||||
}
|
}
|
||||||
|
|
7
version
7
version
|
@ -1,3 +1,9 @@
|
||||||
|
20200321-1830.15
|
||||||
|
<font color=red>本次更新后,'index.html'功能在其它主题会导致bug。</font>
|
||||||
|
文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
|
||||||
|
<font color=red>after this update, then 'index.html' function will bug in other theme.</font>
|
||||||
|
cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。
|
||||||
|
|
||||||
20200311-2150.14
|
20200311-2150.14
|
||||||
Add a switch, can download a known file or not, while the folder is encrypted.
|
Add a switch, can download a known file or not, while the folder is encrypted.
|
||||||
Hide time and size in mobile.
|
Hide time and size in mobile.
|
||||||
|
@ -5,7 +11,6 @@ Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after
|
||||||
增加一个开关,在目录加密后能否下载其中的某个文件。
|
增加一个开关,在目录加密后能否下载其中的某个文件。
|
||||||
在手机上浏览时,隐藏修改时间跟大小。
|
在手机上浏览时,隐藏修改时间跟大小。
|
||||||
加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
|
加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
|
||||||
|
|
||||||
20200229-1300.13
|
20200229-1300.13
|
||||||
In SCF, some config can input Special symbols now, like ?&= 。
|
In SCF, some config can input Special symbols now, like ?&= 。
|
||||||
在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
|
在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
|
||||||
|
|
Loading…
Reference in New Issue