add diskDisplay
a disk display to guest or hide, or disable for guest, only admin can visitpull/585/head
parent
f276a60a1d
commit
a81c94bad3
33
common.php
33
common.php
|
@ -57,6 +57,7 @@ $EnvConfigs = [
|
||||||
'activeLimit' => 0b100,
|
'activeLimit' => 0b100,
|
||||||
'driveId' => 0b100,
|
'driveId' => 0b100,
|
||||||
|
|
||||||
|
'diskDisplay' => 0b110,
|
||||||
'diskname' => 0b111,
|
'diskname' => 0b111,
|
||||||
'diskDescription' => 0b111,
|
'diskDescription' => 0b111,
|
||||||
'domain_path' => 0b111,
|
'domain_path' => 0b111,
|
||||||
|
@ -273,7 +274,7 @@ function main($path)
|
||||||
$files['type'] = 'folder';
|
$files['type'] = 'folder';
|
||||||
$files['childcount'] = count($disktags);
|
$files['childcount'] = count($disktags);
|
||||||
$files['showname'] = 'root';
|
$files['showname'] = 'root';
|
||||||
foreach ($disktags as $disktag) {
|
foreach ($disktags as $disktag) if ($_SERVER['admin']||getConfig('diskDisplay', $disktag)=='') {
|
||||||
$files['list'][$disktag]['type'] = 'folder';
|
$files['list'][$disktag]['type'] = 'folder';
|
||||||
$files['list'][$disktag]['name'] = $disktag;
|
$files['list'][$disktag]['name'] = $disktag;
|
||||||
$files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
|
$files['list'][$disktag]['showname'] = getConfig('diskname', $disktag);
|
||||||
|
@ -287,7 +288,7 @@ function main($path)
|
||||||
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
|
||||||
//$pos = strpos($path, '/');
|
//$pos = strpos($path, '/');
|
||||||
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
|
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
|
||||||
if (!in_array($_SERVER['disktag'], $disktags)) {
|
if ((!$_SERVER['admin']&&getConfig('diskDisplay', $_SERVER['disktag'])=='disable')||!in_array($_SERVER['disktag'], $disktags)) {
|
||||||
$tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
|
$tmp = path_format($_SERVER['base_path'] . '/' . $disktags[0] . '/' . $path);
|
||||||
if (!!$_GET) {
|
if (!!$_GET) {
|
||||||
$tmp .= '?';
|
$tmp .= '?';
|
||||||
|
@ -400,6 +401,7 @@ function main($path)
|
||||||
} else {
|
} else {
|
||||||
$files = $drive->list_files($path1);
|
$files = $drive->list_files($path1);
|
||||||
}
|
}
|
||||||
|
//echo "<pre>" . json_encode($files, 448) . "</pre>";
|
||||||
//if ($path!=='')
|
//if ($path!=='')
|
||||||
if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
|
if ( $files['type']=='folder' && substr($path, -1)!=='/' ) {
|
||||||
$tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
|
$tmp = path_format($_SERVER['base_disk_path'] . $path . '/');
|
||||||
|
@ -496,6 +498,7 @@ function main($path)
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
//if ($files['size']<$fileConduitSize) return $drive->ConduitDown($files['url'], $files['time'], $fileConduitCacheTime);
|
||||||
}
|
}
|
||||||
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
||||||
$header['Location'] = $url;
|
$header['Location'] = $url;
|
||||||
|
@ -513,12 +516,13 @@ function main($path)
|
||||||
return render_list($path, $files);
|
return render_list($path, $files);
|
||||||
} else {
|
} else {
|
||||||
if (!isset($files['error'])) {
|
if (!isset($files['error'])) {
|
||||||
if (is_array($files)) $files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
|
if (is_array($files)) {
|
||||||
else $files['error']['message'] = $files;
|
$files['error']['message'] = json_encode($files, JSON_PRETTY_PRINT);
|
||||||
$files['error']['code'] = 'unknownError';
|
$files['error']['code'] = 'unknownError';
|
||||||
$files['error']['stat'] = 500;
|
$files['error']['stat'] = 500;
|
||||||
}
|
}
|
||||||
return message('<div style="margin:8px;"><pre>' . $files['error']['message'] . '</pre></div><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>', $files['error']['code'], $files['error']['stat']);
|
}
|
||||||
|
return message('<div style="margin:8px;"><pre>' . $files.json_encode($files, JSON_PRETTY_PRINT) . '</pre></div><a href="javascript:history.back(-1)">'.getconstStr('Back').'</a>', $files['error']['code'], $files['error']['stat']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,7 +1100,7 @@ function needUpdate()
|
||||||
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
|
function output($body, $statusCode = 200, $headers = ['Content-Type' => 'text/html'], $isBase64Encoded = false)
|
||||||
{
|
{
|
||||||
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
|
if (isset($_SERVER['Set-Cookie'])) $headers['Set-Cookie'] = $_SERVER['Set-Cookie'];
|
||||||
if (baseclassofdrive()=='Aliyundrive') $headers['Referrer-Policy'] = 'no-referrer';
|
if (baseclassofdrive()=='Aliyundrive' || baseclassofdrive()=='BaiduDisk') $headers['Referrer-Policy'] = 'no-referrer';
|
||||||
//$headers['Referrer-Policy'] = 'same-origin';
|
//$headers['Referrer-Policy'] = 'same-origin';
|
||||||
//$headers['X-Frame-Options'] = 'sameorigin';
|
//$headers['X-Frame-Options'] = 'sameorigin';
|
||||||
return [
|
return [
|
||||||
|
@ -1695,12 +1699,27 @@ output:
|
||||||
<input name="_admin" type="hidden" value="">
|
<input name="_admin" type="hidden" value="">
|
||||||
<input type="hidden" name="disk" value="' . $disktag . '">';
|
<input type="hidden" name="disk" value="' . $disktag . '">';
|
||||||
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
|
foreach ($EnvConfigs as $key => $val) if (isInnerEnv($key) && isShowedEnv($key)) {
|
||||||
|
if ($key=='diskDisplay') {
|
||||||
|
$frame .= '
|
||||||
|
<tr>
|
||||||
|
<td><label>' . $key . '</label></td>
|
||||||
|
<td width=100%>
|
||||||
|
<select name="' . $key . '">
|
||||||
|
<option value=""' . (getConfig($key, $disktag)===''?' selected':'') . '> </option>
|
||||||
|
<option value="hidden"' . (getConfig($key, $disktag)==='hidden'?' selected':'') . '>hidden</option>
|
||||||
|
<option value="disable"' . (getConfig($key, $disktag)==='disable'?' selected':'') . '>disable</option>
|
||||||
|
</select>
|
||||||
|
' . getconstStr('EnvironmentsDescription')[$key] . '
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
} else {
|
||||||
$frame .= '
|
$frame .= '
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>' . $key . '</label></td>
|
<td><label>' . $key . '</label></td>
|
||||||
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
|
<td width=100%><input type="text" name="' . $key . '" value="' . getConfig($key, $disktag) . '" placeholder="' . getconstStr('EnvironmentsDescription')[$key] . '" style="width:100%"></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$frame .= '
|
$frame .= '
|
||||||
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
|
<tr><td></td><td><input type="submit" name="submit1" value="' . getconstStr('Setup') . '"></td></tr>
|
||||||
</form>';
|
</form>';
|
||||||
|
@ -2959,7 +2978,7 @@ function render_list($path = '', $files = [])
|
||||||
$MultiDiskArea = $tmp[0];
|
$MultiDiskArea = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--MultiDisksEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--MultiDisksEnd-->');
|
||||||
$MultiDisks = $tmp[0];
|
$MultiDisks = $tmp[0];
|
||||||
foreach ($disktags as $disk) {
|
foreach ($disktags as $disk) if ($_SERVER['admin']||getConfig('diskDisplay', $disk)=='') {
|
||||||
$diskname = getConfig('diskname', $disk);
|
$diskname = getConfig('diskname', $disk);
|
||||||
if ($diskname=='') $diskname = $disk;
|
if ($diskname=='') $diskname = $disk;
|
||||||
$MultiDisksStr = str_replace('<!--MultiDisksUrl-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
|
$MultiDisksStr = str_replace('<!--MultiDisksUrl-->', path_format($_SERVER['base_path'].'/'.$disk.'/'), $MultiDisks);
|
||||||
|
|
Loading…
Reference in New Issue