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') . ': +
- - - '; + + '; $num = 0; foreach ($disktags as $disktag) { if ($disktag!='') { $num++; $frame .= ' - '; + '; } } $frame .= ' - - - - + +
' . $disktag . '
' . $num . ' ' . $disktag . '
' . getconstStr('DragSort') . '
+ + +
'; } + $Driver_arr = scandir(__DIR__ . $slash . 'disk'); $frame .= '