parent
5b232b3ef5
commit
04721295fa
15
common.php
15
common.php
|
@ -373,8 +373,16 @@ function main($path)
|
||||||
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
return output(json_encode($files), 200, ['Content-Type' => 'application/json']);
|
||||||
}
|
}
|
||||||
// random file
|
// random file
|
||||||
if (isset($_GET['random'])&&$_GET['random']!=='') {
|
if (isset($_GET['random']))
|
||||||
|
if ($_GET['random']!==true) {
|
||||||
if ($_SERVER['ishidden']<4) {
|
if ($_SERVER['ishidden']<4) {
|
||||||
|
if (!isset($files['list'])) {
|
||||||
|
$distfolder = splitlast($path, '/');
|
||||||
|
if ($distfolder[1]=='') $tmpfolder = splitlast($distfolder[0], '/')[1];
|
||||||
|
else $tmpfolder = $distfolder[1];
|
||||||
|
if ($tmpfolder=='') $tmpfolder = '/';
|
||||||
|
return output('No files in folder " ' . htmlspecialchars($tmpfolder) . ' ".', 404);
|
||||||
|
}
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
foreach (array_keys($files['list']) as $filename) {
|
foreach (array_keys($files['list']) as $filename) {
|
||||||
if (strtolower(splitlast($filename, '.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['list'][$filename]['url'];
|
if (strtolower(splitlast($filename, '.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['list'][$filename]['url'];
|
||||||
|
@ -390,9 +398,10 @@ function main($path)
|
||||||
$url = proxy_replace_domain($url, $domainforproxy, $header);
|
$url = proxy_replace_domain($url, $domainforproxy, $header);
|
||||||
}
|
}
|
||||||
return output('', 302, $header);
|
return output('', 302, $header);
|
||||||
} else return output('No ' . htmlspecialchars($_GET['random']) . 'file', 404);
|
} else return output('No "' . htmlspecialchars($_GET['random']) . '" files', 404);
|
||||||
} else return output('Hidden', 401);
|
} else return output('Hidden', 401);
|
||||||
}
|
} else return output('must provide a suffix, like "?random=gif".', 401);
|
||||||
|
|
||||||
// is file && not preview mode, download file
|
// is file && not preview mode, download file
|
||||||
if ($files['type']=='file' && !isset($_GET['preview'])) {
|
if ($files['type']=='file' && !isset($_GET['preview'])) {
|
||||||
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt', $_SERVER['disktag'])&&$files['name']!=getConfig('passfile')) ) {
|
if ( $_SERVER['ishidden']<4 || (!!getConfig('downloadencrypt', $_SERVER['disktag'])&&$files['name']!=getConfig('passfile')) ) {
|
||||||
|
|
Loading…
Reference in New Issue