Update DB Schema

This commit is contained in:
Hani Rouatbi
2023-07-29 19:46:16 +01:00
parent e494a7c759
commit 211cac974b
2 changed files with 25 additions and 25 deletions

25
do.php
View File

@@ -505,7 +505,11 @@ elseif (ig('down') || ig('downf') ||
//send file headers //send file headers
header('Pragma: public'); header('Pragma: public');
if ($resuming_on) {
header('Accept-Ranges: bytes'); header('Accept-Ranges: bytes');
} else {
header('Accept-Ranges: none');
}
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
//dirty fix //dirty fix
@@ -528,9 +532,7 @@ elseif (ig('down') || ig('downf') ||
//} //}
//add multipart download and resume support //add multipart download and resume support
if (isset($_SERVER['HTTP_RANGE'])) if (isset($_SERVER['HTTP_RANGE']) && $resuming_on)
{
if ($resuming_on)
{ {
list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
list($range) = explode(',', $range, 2); list($range) = explode(',', $range, 2);
@@ -538,6 +540,13 @@ elseif (ig('down') || ig('downf') ||
$range = round(floatval($range), 0); $range = round(floatval($range), 0);
$range_end = ! $range_end ? $size - 1 : round(floatval($range_end), 0); $range_end = ! $range_end ? $size - 1 : round(floatval($range_end), 0);
if ($range < 0 || $range >= $size || $range > $range_end || $range_end >= $size ) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes */$size");
fclose($fp);
exit;
}
$partial_length = $range_end - $range + 1; $partial_length = $range_end - $range + 1;
header('HTTP/1.1 206 Partial Content'); header('HTTP/1.1 206 Partial Content');
header("Content-Length: $partial_length"); header("Content-Length: $partial_length");
@@ -546,13 +555,6 @@ elseif (ig('down') || ig('downf') ||
fseek($fp, $range); fseek($fp, $range);
} }
else else
{
// Respond with a 416 Range Not Satisfiable
header('HTTP/1.1 416 Range Not Satisfiable');
exit;
}
}
else
{ {
header('HTTP/1.1 200 OK'); header('HTTP/1.1 200 OK');
$partial_length = $size; $partial_length = $size;
@@ -565,9 +567,6 @@ elseif (ig('down') || ig('downf') ||
//read and output the file in chunks //read and output the file in chunks
while (! feof($fp) && (! connection_aborted()) && ($bytes_sent < $partial_length)) while (! feof($fp) && (! connection_aborted()) && ($bytes_sent < $partial_length))
{ {
if ($chunksize > ($partial_length - $bytes_sent)) {
$chunksize = $partial_length - $bytes_sent;
}
$buffer = fread($fp, $chunksize); $buffer = fread($fp, $chunksize);
print($buffer); print($buffer);
flush(); flush();

View File

@@ -35,4 +35,5 @@ $update_schema[9]['sql'] = [
$update_schema[10]['sql'] = [ $update_schema[10]['sql'] = [
'about_files' => "ALTER TABLE `{$dbprefix}files` ADD `about` LONGTEXT NULL DEFAULT NULL AFTER `real_filename`;", 'about_files' => "ALTER TABLE `{$dbprefix}files` ADD `about` LONGTEXT NULL DEFAULT NULL AFTER `real_filename`;",
'enable_multipart' => "INSERT INTO `{$dbprefix}groups_data` (`group_id`, `name`, `value`) SELECT `group_id`, 'enable_multipart', 1 FROM `{$dbprefix}groups`;",
]; ];