From ac4defe663868c89a3c4ead42315a7dd1b60c949 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 6 Jan 2022 09:31:03 +0800
Subject: [PATCH 01/34] add 'current folder' in 'refresh cache'
---
conststr.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conststr.php b/conststr.php
index 50db96b..453cd2a 100644
--- a/conststr.php
+++ b/conststr.php
@@ -1126,9 +1126,9 @@ $constStr = [
'ar-sa' => 'اختيار اللغة',
],
'RefreshCache' => [
- 'en-us' => 'RefreshCache',
- 'zh-cn' => '刷新缓存',
- 'zh-tw' => '重新整理快取',
+ 'en-us' => 'Refresh Cache of Current Folder',
+ 'zh-cn' => '刷新当前目录的缓存',
+ 'zh-tw' => '重新整理当前資料夾快取',
'ja' => 'キャッシュを再構築',
'ko-kr' => '캐시 플러시',
'fa' => 'رفرش cache',
From c8adcbbd7a4d112875fef45ad6b6245af4d4dd7b Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sun, 9 Jan 2022 14:05:25 +0800
Subject: [PATCH 02/34] add / at last, via SCF default link.
---
index.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/index.php b/index.php
index 725de56..c9244e2 100644
--- a/index.php
+++ b/index.php
@@ -88,6 +88,9 @@ function main_handler($event, $context)
$event = json_decode(json_encode($event), true);
$context = json_decode(json_encode($context), true);
printInput($event, $context);
+ if ( $event['requestContext']['serviceId'] === substr($event['headers']['host'], 0, strlen($event['requestContext']['serviceId'])) ) {
+ if ($event['path']==='/' . $context['function_name']) return output('add / at last.', 308, ['Location'=>'/'.$event['requestContext']['stage'].'/'.$context['function_name'].'/']);
+ }
unset($_POST);
unset($_GET);
unset($_COOKIE);
From f2d53d45af076a7a866b4a509137d6fd35838061 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sun, 9 Jan 2022 16:07:59 +0800
Subject: [PATCH 03/34] Allow Preview when enable downloadencrypt
#506 ,
---
common.php | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/common.php b/common.php
index efb0cb6..a09d1f3 100644
--- a/common.php
+++ b/common.php
@@ -2225,7 +2225,18 @@ function render_list($path = '', $files = [])
while (strpos($html, '')) $html = str_replace('', '', $html);
}
- if ($_SERVER['ishidden']==4) {
+ if ($_SERVER['ishidden']<4 || ($files['type']=='file'&&getConfig('downloadencrypt', $_SERVER['disktag']))) {
+ while (strpos($html, '')) {
+ $tmp = splitfirst($html, '');
+ $html = $tmp[0];
+ $tmp = splitfirst($tmp[1], '');
+ $html .= $tmp[1];
+ }
+ while (strpos($html, '')) {
+ $html = str_replace('', '', $html);
+ $html = str_replace('', '', $html);
+ }
+ } else {
// 加密状态
if (getConfig('useBasicAuth')) {
// use Basic Auth
@@ -2300,17 +2311,6 @@ function render_list($path = '', $files = [])
$tmp = splitfirst($tmp[1], '');
$html .= $tmp[1];
}
- } else {
- while (strpos($html, '')) {
- $tmp = splitfirst($html, '');
- $html = $tmp[0];
- $tmp = splitfirst($tmp[1], '');
- $html .= $tmp[1];
- }
- while (strpos($html, '')) {
- $html = str_replace('', '', $html);
- $html = str_replace('', '', $html);
- }
}
while (strpos($html, '')) $html = str_replace('', getconstStr('Download'), $html);
From 1b8287062dc5bb421fc7794fbbeeccbff27e9a60 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Fri, 14 Jan 2022 10:29:29 +0800
Subject: [PATCH 04/34] more smoothly in Adding Onedrive disk
---
disk/Onedrive.php | 134 ++++++++++++++++++++++++++++++----------------
1 file changed, 87 insertions(+), 47 deletions(-)
diff --git a/disk/Onedrive.php b/disk/Onedrive.php
index 3ae42a0..35c2158 100644
--- a/disk/Onedrive.php
+++ b/disk/Onedrive.php
@@ -446,7 +446,7 @@ class Onedrive {
$envs = '';
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
- $url = path_format($_SERVER['PHP_SELF'] . '/');
+ $url = path_format($_SERVER['base_path'] . '/');
//$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
if (isset($_GET['Finish'])) {
@@ -478,8 +478,8 @@ class Onedrive {
} else {
return message($arr['stat'] . $arr['body'], 'Get User ID', $arr['stat']);
}*/
- if (get_class($this)=='Sharepoint') $tmp['Driver'] = 'Onedrive';
- elseif (get_class($this)=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
+ if ($tmp['Driver']=='Sharepoint') $tmp['Driver'] = 'Onedrive';
+ elseif ($tmp['Driver']=='SharepointCN') $tmp['Driver'] = 'OnedriveCN';
$tmp['sharepointSite'] = '';
$tmp['siteid'] = '';
} elseif ($_POST['DriveType']=='Custom') {
@@ -492,14 +492,14 @@ class Onedrive {
//if ($arr['stat']!=200) return message($arr['stat'] . $arr['body'], 'Get Sharepoint Drive ID ' . $_POST['DriveType'], $arr['stat']);
$tmp['siteid'] = $siteid;
$tmp['sharepointSite'] = $_POST['sharepointSite'];
- if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint';
- elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
+ if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
+ elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
} else {
// 直接是siteid
$tmp['siteid'] = $_POST['DriveType'];
$tmp['sharepointSite'] = $_POST['sharepointSiteUrl'];
- if (get_class($this)=='Onedrive') $tmp['Driver'] = 'Sharepoint';
- elseif (get_class($this)=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
+ if ($tmp['Driver']=='Onedrive') $tmp['Driver'] = 'Sharepoint';
+ elseif ($tmp['Driver']=='OnedriveCN') $tmp['Driver'] = 'SharepointCN';
}
$response = setConfigResponse( setConfig($tmp, $this->disktag) );
@@ -520,11 +520,11 @@ class Onedrive {
console.log(i++);
} else {
clearInterval(uploadList);
- location.href = "' . $url . '";
+ location.href = "' . $url . '?setup&disktag=' . $_GET['disktag'] . '";
}
}, 1000);
';
- return message($html, getconstStr('WaitJumpIndex'), 201, 1);
+ return message($html, getconstStr('Wait'), 201, 1);
}
}
@@ -554,12 +554,13 @@ class Onedrive {
$title = 'Select Driver';
$html = '
- ';
+ }
+ function notnull(t)
+ {
+ if (t.DriveType.value==\'\') {
+ alert(\'Select a Disk\');
+ return false;
+ }
+ if (t.DriveType.value==\'Custom\') {
+ if (t.sharepointSite.value==\'\') {
+ alert(\'sharepoint Site Address\');
+ return false;
+ }
+ }
+ return true;
+ }
+
+';
return message($html, $title, 201);
}
@@ -611,7 +632,7 @@ class Onedrive {
texta[i].style.height = texta[i].scrollHeight + \'px\';
}
';
- $tmptoken['Driver'] = get_class($this);
+ $tmptoken['Driver'] = $_GET['AddDisk'];
$tmptoken['refresh_token'] = $refresh_token;
$tmptoken['token_expires'] = time()+7*24*60*60;
$response = setConfigResponse( setConfig($tmptoken, $this->disktag) );
@@ -629,7 +650,7 @@ class Onedrive {
console.log(i++);
} else {
clearInterval(uploadList);
- location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
+ location.href = "' . $url . '?AddDisk=' . $_GET['AddDisk'] . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
}
}, 1000);
';
@@ -641,7 +662,7 @@ class Onedrive {
}
if (isset($_GET['install1'])) {
- if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
+ //if (get_class($this)=='Onedrive' || get_class($this)=='OnedriveCN') {
return message('
' . getconstStr('JumptoOffice') . '
', getconstStr('Wait') . ' 1s', 201);
- } else {
- return message('Something error, retry after a few seconds.', 'Retry', 201);
- }
+ //} else {
+ // return message('Something error, retry after a few seconds.', 'Retry', 201);
+ //}
}
if (isset($_GET['install0'])) {
@@ -681,7 +702,8 @@ class Onedrive {
//$this->disktag = $_POST['disktag_add'];
$tmp['disktag_add'] = $_POST['disktag_add'];
$tmp['diskname'] = $_POST['diskname'];
- $tmp['Driver'] = $_POST['Drive_ver'];
+ //$tmp['Driver'] = $_POST['Drive_ver'];
+ $tmp['Driver'] = $_GET['AddDisk'];
if ($_POST['Drive_ver']=='Sharelink') {
$tmp['shareurl'] = $_POST['shareurl'];
} else {
@@ -701,7 +723,7 @@ class Onedrive {
} else {
$title = getconstStr('MayinEnv');
$html = getconstStr('Wait');
- if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
+ if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_GET['AddDisk'];
$html .= '';
From 38799d427e371bf906f765ee44ea86895d28d378 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sun, 16 Jan 2022 15:57:25 +0800
Subject: [PATCH 05/34] fix bug: turn index when adding disk
---
common.php | 81 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 32 deletions(-)
diff --git a/common.php b/common.php
index a09d1f3..ab49ba9 100644
--- a/common.php
+++ b/common.php
@@ -137,6 +137,7 @@ function main($path)
$_SERVER['php_starttime'] = microtime(true);
$path = path_format($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
+ $_SERVER['base_disk_path'] = $_SERVER['base_path'];
if (getConfig('forceHttps')&&$_SERVER['REQUEST_SCHEME']=='http') {
if ($_GET) {
$tmp = '';
@@ -166,6 +167,8 @@ function main($path)
$_SERVER['timezone'] = getConfig('timezone');
if (isset($_COOKIE['timezone'])&&$_COOKIE['timezone']!='') $_SERVER['timezone'] = $_COOKIE['timezone'];
if ($_SERVER['timezone']=='') $_SERVER['timezone'] = 0;
+ $_SERVER['sitename'] = getConfig('sitename');
+ if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
if (isset($_GET['WaitFunction'])) {
$response = WaitFunction($_GET['WaitFunction']);
@@ -212,9 +215,35 @@ function main($path)
return output('', 302, [ 'Location' => $url ]);
}
- $_SERVER['sitename'] = getConfig('sitename');
- if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename');
- $_SERVER['base_disk_path'] = $_SERVER['base_path'];
+ // Add disk
+ if (isset($_GET['AddDisk'])) {
+ if ($_GET['AddDisk']===true) {
+ $tmp = path_format($_SERVER['base_path'] . '/' . $path);
+ return output('Please visit ' . $tmp . '.', 301, [ 'Location' => $tmp ]);
+ }
+ if ($_SERVER['admin']) {
+ if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
+ $drive = new $_GET['AddDisk']($_GET['disktag']);
+ return $drive->AddDisk();
+ } else {
+ $url = $_SERVER['PHP_SELF'];
+ /*if ($_GET) {
+ $tmp = null;
+ $tmp = '';
+ foreach ($_GET as $k => $v) {
+ if ($k!='setup') {
+ if ($v===true) $tmp .= '&' . $k;
+ else $tmp .= '&' . $k . '=' . $v;
+ }
+ }
+ $tmp = substr($tmp, 1);
+ if ($tmp!='') $url .= '?' . $tmp;
+ }*/
+ // not need GET adddisk, remove it
+ return output('', 302, [ 'Location' => $url ]);
+ }
+ }
+
$disktags = explode("|", getConfig('disktag'));
// echo 'count$disk:'.count($disktags);
if (count($disktags)>1) {
@@ -263,35 +292,6 @@ function main($path)
$_SERVER['ajax']=0;
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) if ($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest') $_SERVER['ajax']=1;
- // Add disk
- if (isset($_GET['AddDisk'])) {
- if ($_GET['AddDisk']===true) {
- $tmp = path_format($_SERVER['base_path'] . '/' . $path);
- return output('Please visit ' . $tmp . '.', 301, [ 'Location' => $tmp ]);
- }
- if ($_SERVER['admin']) {
- if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
- $drive = new $_GET['AddDisk']($_GET['disktag']);
- return $drive->AddDisk();
- } else {
- $url = $_SERVER['PHP_SELF'];
- /*if ($_GET) {
- $tmp = null;
- $tmp = '';
- foreach ($_GET as $k => $v) {
- if ($k!='setup') {
- if ($v===true) $tmp .= '&' . $k;
- else $tmp .= '&' . $k . '=' . $v;
- }
- }
- $tmp = substr($tmp, 1);
- if ($tmp!='') $url .= '?' . $tmp;
- }*/
- // not need GET adddisk, remove it
- return output('', 302, [ 'Location' => $url ]);
- }
- }
-
if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403);
// Show disks in root
@@ -632,6 +632,23 @@ function filecache($disktag)
return $cache;
}
+function calcDownKey($filename, $key = '') {
+ if ($key) {
+ // check key
+ $tmp = splitfirst($key, '.');
+ if ($tmp[1]!='') {
+ $timestamp = $tmp[0];
+ if (time() > $timestamp) return false;
+ if (md5($timestamp . sha1($filename . getConfig('admin'))) == $tmp[1]) return true;
+ else return false;
+ } else return false;
+ } else {
+ // calc key
+ $timestamp = time() + 1*24*60*60;
+ return $timestamp . '.' . md5($timestamp . sha1($filename . getConfig('admin')));
+ }
+}
+
function findIndexPath($rootpath, $path = '')
{// find the path of the first 'index.php' that not in rootpath.
global $slash;
From 9572b68be968ce6262f3a867fd084ae803170cf4 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Sun, 16 Jan 2022 15:58:42 +0800
Subject: [PATCH 06/34] fix bug: turn index when adding disk
---
disk/Onedrive.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/disk/Onedrive.php b/disk/Onedrive.php
index 35c2158..184294d 100644
--- a/disk/Onedrive.php
+++ b/disk/Onedrive.php
@@ -446,7 +446,7 @@ class Onedrive {
$envs = '';
foreach ($EnvConfigs as $env => $v) if (isCommonEnv($env)) $envs .= '\'' . $env . '\', ';
- $url = path_format($_SERVER['base_path'] . '/');
+ $url = $_SERVER['PHP_SELF'];
//$this->api_url = splitfirst($_SERVER['api_url'], '/v1.0')[0] . '/v1.0';
if (isset($_GET['Finish'])) {
From 08c12518a72071d52ef85ea7279023813b2640bc Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Tue, 18 Jan 2022 13:04:46 +0800
Subject: [PATCH 07/34] show upload progress in table background
---
theme/classic.html | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/theme/classic.html b/theme/classic.html
index 83ae3fb..312d52d 100644
--- a/theme/classic.html
+++ b/theme/classic.html
@@ -1057,7 +1057,9 @@
let tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
lastCurrentSpeed = tmpspeed;
let remaintime = (totalsize-asize-e.loaded)/tmpspeed;
- label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
+ let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
+ label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
+ label.innerHTML = StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
}
}
var C_starttime = new Date();
@@ -1086,7 +1088,7 @@
while (filename.indexOf('%2F')>0) filename = filename.replace('%2F', '/');
document.getElementById('upfile_td1_'+tdnum).innerHTML='';
label.innerHTML=StartStr+MiddleStr;
- label.style.color='green';
+ label.parentNode.style.background = 'rgba(0,80,0,25%)';
// uploadbuttonshow();
@@ -1329,7 +1331,7 @@
}
document.getElementById('upfile_td1_'+tdnum).innerHTML='';
label.innerHTML=StartStr+MiddleStr;
- label.style.color='green';
+ label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else {
label.innerHTML= '' + xhr1.status + ',' + xhr1.responseText + '';
localStorage.removeItem(filesha1);
@@ -1349,7 +1351,9 @@
var tmptime = new Date();
var tmpspeed = e.loaded*1000/(tmptime.getTime()-C_starttime.getTime());
var remaintime = (totalsize-asize-e.loaded)/tmpspeed;
- label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + ((asize+e.loaded)*100/totalsize).toFixed(2) + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
+ let percent = ((asize+e.loaded)*100/totalsize).toFixed(2);
+ label.parentNode.style.background = "linear-gradient(to right, rgba(0,0,0,25%) " + percent + "%, rgba(0,0,0,0%) 0%)";
+ label.innerHTML=StartStr+' ' +size_format(asize+e.loaded)+ ' / '+size_format(totalsize) + ' = ' + percent + '% :'+size_format((asize+e.loaded-newstartsize)*1000/(tmptime.getTime()-StartTime.getTime()))+'/s
'+size_format(tmpspeed)+'/s '+seconds2hour(remaintime.toFixed(1));
}
}
var C_starttime = new Date();
@@ -1400,7 +1404,7 @@
}
document.getElementById('upfile_td1_'+tdnum).innerHTML='';
label.innerHTML=StartStr+MiddleStr;
- label.style.color='green';
+ label.parentNode.style.background = 'rgba(0,80,0,25%)';
} else {
label.innerHTML= '' + xhr1.status + ',' + xhr1.responseText + '';
localStorage.removeItem(filesha1);
From c5e7cabe09845c2b01e56d6d92cd476ffd4b1d45 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Tue, 18 Jan 2022 13:08:48 +0800
Subject: [PATCH 08/34] can not copy file by rapid_upload, so return 415
---
disk/Aliyundrive.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/disk/Aliyundrive.php b/disk/Aliyundrive.php
index 6dd2875..7fc3c49 100644
--- a/disk/Aliyundrive.php
+++ b/disk/Aliyundrive.php
@@ -320,6 +320,7 @@ class Aliyundrive {
return output(json_encode($this->files_format(json_decode($result['body'], true))), $result['stat']);
}
public function Copy($file) {
+ return output('NO copy', 415);
if (!$file['id']) {
$oldfile = $this->list_path($file['path'] . '/' . $file['name']);
//error_log1('res:' . json_encode($res));
From be58a17328fc712eba0fd31dce493b3201de8f63 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 20 Jan 2022 22:08:04 +0800
Subject: [PATCH 09/34] try fix : getenv(null)
---
common.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/common.php b/common.php
index ab49ba9..033273c 100644
--- a/common.php
+++ b/common.php
@@ -222,6 +222,7 @@ function main($path)
return output('Please visit ' . $tmp . '.', 301, [ 'Location' => $tmp ]);
}
if ($_SERVER['admin']) {
+ $_SERVER['disktag'] = '';
if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
$drive = new $_GET['AddDisk']($_GET['disktag']);
return $drive->AddDisk();
From bc86e38c718c78f4da350b3cff8d073b4ce240bf Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 27 Jan 2022 11:48:01 +0800
Subject: [PATCH 10/34] change login page, rm JumpFirstDisk, 403 in operating
root, change sorting disk, remake disktags tab, add global md config
change login page, rm JumpFirstDisk, 403 in operating root, change sorting disk, remake disktags tab, add global md config
---
common.php | 127 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 91 insertions(+), 36 deletions(-)
diff --git a/common.php b/common.php
index 033273c..c651bf3 100644
--- a/common.php
+++ b/common.php
@@ -21,7 +21,7 @@ $EnvConfigs = [
'admin' => 0b000,
'adminloginpage' => 0b010,
- 'autoJumpFirstDisk' => 0b010,
+ //'autoJumpFirstDisk' => 0b010,
'background' => 0b011,
'backgroundm' => 0b011,
'disableShowThumb' => 0b010,
@@ -38,6 +38,10 @@ $EnvConfigs = [
'useBasicAuth' => 0b010,
'referrer' => 0b011,
'forceHttps' => 0b010,
+ 'globalHeadOmfUrl' => 0b011,
+ 'globalHeadMdUrl' => 0b011,
+ 'globalReadmeMdUrl' => 0b011,
+ 'globalFootOmfUrl' => 0b011,
'Driver' => 0b100,
'client_id' => 0b100,
@@ -183,7 +187,7 @@ function main($path)
} else {
$adminloginpage = getConfig('adminloginpage');
}
- if (isset($_GET[$adminloginpage])) {
+ if (isset($_GET['login'])&&$_GET['login']==$adminloginpage) {
/*if (isset($_GET['preview'])) {
$url = $_SERVER['PHP_SELF'] . '?preview';
} else {
@@ -222,7 +226,6 @@ function main($path)
return output('Please visit ' . $tmp . '.', 301, [ 'Location' => $tmp ]);
}
if ($_SERVER['admin']) {
- $_SERVER['disktag'] = '';
if (!class_exists($_GET['AddDisk'])) require 'disk' . $slash . $_GET['AddDisk'] . '.php';
$drive = new $_GET['AddDisk']($_GET['disktag']);
return $drive->AddDisk();
@@ -261,7 +264,7 @@ function main($path)
// return a 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 {
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/');
@@ -295,19 +298,17 @@ function main($path)
if (!isreferhost()) return message('Must visit from designated host', 'NOT_ALLOWED', 403);
- // Show disks in root
- if ($files['showname'] == 'root') return render_list($path, $files);
-
- if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
-
// Operate
if ($_SERVER['ajax']) {
+ //error_log1($_SERVER['REQUEST_METHOD']);
if ($_GET['action']=='del_upload_cache') {
// del '.tmp' without login. 无需登录即可删除.tmp后缀文件
+ if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
savecache('path_' . $path1, '', $_SERVER['disktag'], 1); // clear cache.
return $drive->del_upload_cache($path);
}
if ($_GET['action']=='upbigfile') {
+ if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 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);
@@ -326,6 +327,12 @@ function main($path)
} else {
if ($_SERVER['ajax']) return output(getconstStr('RefreshtoLogin'),401);
}
+
+ // Show disks in root
+ if ($files['showname'] == 'root') return render_list($path, $files);
+
+ if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
+
$_SERVER['ishidden'] = passhidden($path);
if (isset($_GET['thumbnails'])) {
if ($_SERVER['ishidden']<4) {
@@ -1133,6 +1140,7 @@ function adminform($name = '', $pass = '', $storage = '', $path = '')
function adminoperate($path)
{
global $drive;
+ if ($_SERVER['REQUEST_METHOD']=='POST') if (!driveisfine($_SERVER['disktag'], $drive)) return output('Not in drive, or disk [' . $_SERVER['disktag'] . '] error.', 403);
$path1 = path_format($_SERVER['list_path'] . '/' . $path);
if (substr($path1, -1)=='/') $path1=substr($path1, 0, -1);
$tmpget = $_GET;
@@ -1646,11 +1654,9 @@ output:
}
';
} else {
- //$_GET['disktag'] = '';
- $Driver_arr = scandir(__DIR__ . $slash . 'disk');
if (count($disktags)>1) {
$frame .= '
-
+
+' . getconstStr('DragSort') . ':
+
+
';
}
+ $Driver_arr = scandir(__DIR__ . $slash . 'disk');
$frame .= '