the $drive not new twice

pull/187/head
qkqpttgf 2021-01-15 19:24:14 +08:00 committed by GitHub
parent 1102d4234f
commit d5120aa390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -260,12 +260,7 @@ function main($path)
// Show disks in root
if ($files['showname'] == 'root') return render_list($path, $files);
$disktype = getConfig('Driver', $_SERVER['disktag']);
if ($disktype=='') return render_list();
if (!class_exists($disktype)) require 'disk' . $slash . $disktype . '.php';
$drive = new $disktype($_SERVER['disktag']);
if (!driveisfine($_SERVER['disktag'])) return render_list();
if (!driveisfine($_SERVER['disktag'], $drive)) return render_list();
// Operate
if ($_SERVER['ajax']) {
@ -399,7 +394,7 @@ function get_content($path)
return $file;
}
function driveisfine($tag)
function driveisfine($tag, &$drive = null)
{
global $slash;
$disktype = getConfig('Driver', $tag);