Browse Source

fix host page snap storage id

main
ghost 1 year ago
parent
commit
3c4a89d16d
  1. 21
      public/file.php

21
public/file.php

@ -53,27 +53,19 @@ switch ($type) { @@ -53,27 +53,19 @@ switch ($type) {
if ($hostPageSnap = $db->getHostPageSnap(!empty($_GET['hps']) ? (int) $_GET['hps'] : 0)) {
// Get snap file
$snapStorageIndex = 0;
foreach (json_decode(SNAP_STORAGE) as $name => $storages) {
foreach ($storages as $storage) {
$snapStorageIndex++;
foreach ($storages as $i => $storage) {
// Generate storage id
$crc32name = crc32(sprintf('%s.%s', $name, $snapStorageIndex));
$crc32name = crc32(sprintf('%s.%s', $name, $i));
if ($hostPageSnapStorage = $db->getHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
switch ($name) {
case 'localhost':
if ($hostPageSnapStorage = $db->getHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
// Check request quota
//if ()
// Get file
$snapFile = 'hp/' . chunk_split($hostPageSnap->hostPageId, 1, '/') . $hostPageSnap->timeAdded . '.zip';
@ -94,13 +86,10 @@ switch ($type) { @@ -94,13 +86,10 @@ switch ($type) {
exit;
}
}
break;
case 'ftp':
if ($hostPageSnapStorage = $db->getHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
$ftp = new Ftp();
if ($ftp->connect($storage->host, $storage->port, $storage->username, $storage->password, $storage->directory, $storage->timeout, $storage->passive)) {
@ -121,13 +110,13 @@ switch ($type) { @@ -121,13 +110,13 @@ switch ($type) {
exit;
}
}
break;
}
}
}
}
}
header('HTTP/1.0 404 Not Found');

Loading…
Cancel
Save