try fix some error in import

pull/294/head
qkqpttgf 2021-04-07 21:16:37 +08:00 committed by GitHub
parent 99d3d4c2ee
commit 55c9805cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -1151,7 +1151,7 @@ function EnvOpt($needUpdate = 0)
} }
foreach ($disktags as $disktag) { foreach ($disktags as $disktag) {
$d = getConfig($disktag); $d = getConfig($disktag);
if ($d === '') { if ($d == '') {
$d = ''; $d = '';
} elseif (gettype($d)=='array') { } elseif (gettype($d)=='array') {
$tmp[$disktag] = $d; $tmp[$disktag] = $d;
@ -1168,7 +1168,7 @@ function EnvOpt($needUpdate = 0)
$c = splitlast($c, '}')[0] . '}'; $c = splitlast($c, '}')[0] . '}';
$tmp = json_decode($c, true); $tmp = json_decode($c, true);
if (!!!$tmp) return output("{\"Error\": \"Config input error. " . $c . "\"}", 403); if (!!!$tmp) return output("{\"Error\": \"Config input error. " . $c . "\"}", 403);
$tmptag = $tmp['disktag']; if (isset($tmp['disktag'])) $tmptag = $tmp['disktag'];
foreach ($EnvConfigs as $env => $v) { foreach ($EnvConfigs as $env => $v) {
if (isCommonEnv($env)) { if (isCommonEnv($env)) {
if (isShowedEnv($env)) { if (isShowedEnv($env)) {
@ -1178,11 +1178,11 @@ function EnvOpt($needUpdate = 0)
} }
} }
} }
foreach ($disktags as $disktag) { if ($disktags) foreach ($disktags as $disktag) {
if (!isset($tmp[$disktag])) $tmp[$disktag] = ''; if ($disktag!=''&&!isset($tmp[$disktag])) $tmp[$disktag] = '';
} }
$tmp['disktag'] = $tmptag; if ($tmptag) $tmp['disktag'] = $tmptag;
$response = setConfigResponse( setConfig($tmp, $_SERVER['disk_oprating']) ); $response = setConfigResponse( setConfig($tmp) );
if (api_error($response)) { if (api_error($response)) {
return output("{\"Error\": \"" . api_error_msg($response) . "\"}", 500); return output("{\"Error\": \"" . api_error_msg($response) . "\"}", 500);
} else { } else {