From 2e8e29a35e1b06736f186f63a4664de292f4497f Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Tue, 4 Aug 2020 14:38:20 +0800 Subject: [PATCH] visit root in multy disk --- common.php | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/common.php b/common.php index 42862eb..b1c7e25 100644 --- a/common.php +++ b/common.php @@ -1,8 +1,14 @@ alert(\''.getconstStr('SetSecretsFirst').'\');', 302, [ 'Location' => $url ]); } + $_SERVER['sitename'] = getConfig('sitename'); + if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); $_SERVER['base_disk_path'] = $_SERVER['base_path']; $disktags = explode("|",getConfig('disktag')); // echo 'count$disk:'.count($disktags); if (count($disktags)>1) { - if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + if ($path=='/'||$path=='') { + $files['folder']['childCount'] = count($disktags); + foreach ($disktags as $disktag) { + $files['children'][$disktag]['folder'] = 1; + $files['children'][$disktag]['name'] = $disktag; + } + if ($_GET['json']) { + // return a json + return files_json($files); + } + return render_list($path, $files); + //return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]); + } $_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0]; //$pos = strpos($path, '/'); //if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos); @@ -538,8 +556,6 @@ function getconstStr($str) function config_oauth() { - $_SERVER['sitename'] = getConfig('sitename'); - if (empty($_SERVER['sitename'])) $_SERVER['sitename'] = getconstStr('defaultSitename'); $_SERVER['redirect_uri'] = 'https://scfonedrive.github.io'; if (getConfig('Drive_ver')=='shareurl') { $_SERVER['api_url'] = getConfig('shareapiurl'); @@ -1617,7 +1633,7 @@ function EnvOpt($needUpdate = 0) asort($ShowedInnerEnv); $html = '