mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-16 04:59:42 +01:00
Add Enable/Disable multipart download
This commit is contained in:
18
do.php
18
do.php
@@ -396,7 +396,7 @@ elseif (ig('down') || ig('downf') ||
|
||||
//download process
|
||||
$path_file = ig('thmb') || ig('thmbf') ? "./{$f}/thumbs/{$n}" : "./{$f}/{$n}";
|
||||
$chunksize = 8192;
|
||||
$resuming_on = true;
|
||||
$resuming_on = $config['enable_multipart'] == 1;
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('down_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
@@ -528,7 +528,9 @@ elseif (ig('down') || ig('downf') ||
|
||||
//}
|
||||
|
||||
//add multipart download and resume support
|
||||
if (isset($_SERVER['HTTP_RANGE']) && $resuming_on)
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
if ($resuming_on)
|
||||
{
|
||||
list($a, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
|
||||
list($range) = explode(',', $range, 2);
|
||||
@@ -539,11 +541,18 @@ elseif (ig('down') || ig('downf') ||
|
||||
$partial_length = $range_end - $range + 1;
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
header("Content-Length: $partial_length");
|
||||
header('Content-Range: bytes ' . ($range - $range_end / $size));
|
||||
header("Content-Range: bytes $range-$range_end/$size");
|
||||
|
||||
fseek($fp, $range);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Respond with a 416 Range Not Satisfiable
|
||||
header('HTTP/1.1 416 Range Not Satisfiable');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 200 OK');
|
||||
$partial_length = $size;
|
||||
@@ -556,6 +565,9 @@ elseif (ig('down') || ig('downf') ||
|
||||
//read and output the file in chunks
|
||||
while (! feof($fp) && (! connection_aborted()) && ($bytes_sent < $partial_length))
|
||||
{
|
||||
if ($chunksize > ($partial_length - $bytes_sent)) {
|
||||
$chunksize = $partial_length - $bytes_sent;
|
||||
}
|
||||
$buffer = fread($fp, $chunksize);
|
||||
print($buffer);
|
||||
flush();
|
||||
|
||||
@@ -60,6 +60,7 @@ $config_values[] = ['thumbs_imgs', '1', '<input type=\"text\" id=\"thmb_dim_w\"
|
||||
$config_values[] = ['write_imgs', '0' , '<label>{lang.YES}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"1\" <IF NAME=\"con.write_imgs==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"write_imgs\" name=\"write_imgs\" value=\"0\" <IF NAME=\"con.write_imgs==0\"> checked=\"checked\"</IF> /></label>\r\n <br /><img src=\"{STAMP_IMG_URL}\" alt=\"Seal photo\" style=\"margin-top:4px;border:1px groove #FF865E;\" />\r\n ', 28, 'groups', 0, 0];
|
||||
$config_values[] = ['livexts', 'swf', '<input type=\"text\" id=\"livexts\" name=\"livexts\" value=\"{con.livexts}\" size=\"62\" style=\"direction:ltr\" />{lang.COMMA_X}', '29', 'upload', 0, 0];
|
||||
$config_values[] = ['usersectoupload', '10', '<input type=\"text\" id=\"usersectoupload\" name=\"usersectoupload\" value=\"{con.usersectoupload}\" size=\"10\" />', 44, 'groups', 0, 0];
|
||||
$config_values[] = ['enable_multipart', '1' , '<label>{lang.YES}<input type=\"radio\" id=\"enable_multipart\" name=\"enable_multipart\" value=\"1\" <IF NAME=\"con.enable_multipart==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"enable_multipart\" name=\"enable_multipart\" value=\"0\" <IF NAME=\"con.enable_multipart==0\"> checked=\"checked\"</IF> /></label>', 45, 'groups', 0, 0];
|
||||
$config_values[] = ['filesnum_show', '1', '<label>{lang.YES}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"1\" <IF NAME=\"con.filesnum_show==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"filesnum_show\" name=\"filesnum_show\" value=\"0\" <IF NAME=\"con.filesnum_show==0\"> checked=\"checked\"</IF> /></label>', 22, 'upload', 0, 0];
|
||||
|
||||
//KLIVE
|
||||
|
||||
@@ -183,6 +183,7 @@ return [
|
||||
'COMMA_X' => '<p class="live_xts">افصل بين الامتدادات باستخدام الفاصلة (<span style="font-size:large"> , </span>)</p>',
|
||||
'NO_SEARCH_WORD' => 'لم تقم بكتابة كلمة بحث !',
|
||||
'USERSECTOUPLOAD' => 'عدد الثواني بين كل عملية رفع',
|
||||
'ENABLE_MULTIPART' => 'تفعيل التنزيل متعدد الأجزاء',
|
||||
'ADM_UNWANTED_FILES' => 'يبدوا انك قمت بالترقية من نسخة سابقة وبسبب اختلاف اسماء بعض الملفات ستلاحظ وجود ازرار متكررة بلوحة التحكم . <br /> لحل المشكلة قم بإزالة كافة الملفات في المسار "includes/adm" واعادة رفعها من جديد. ايضا قم بحذف ملف admin.php من المجلد الرئيسي اذا وجد.',
|
||||
'HTML_URLS_ENABLED_NO_HTCC' => 'لقد قمت بتفعيل روابط الهتمل ولكنك نسيت أن تقوم بإعادة تسمية الملف htaccess.txt في مجلد كليجا الرئيسي ليصبح ".htaccess". اذا لم تفهم شيئاً من هذا الكلام قم بالسؤال في الدعم الفني لكليجا او قم بتعطيل روابط الهتمل .',
|
||||
'PLUGIN_CONFIRM_ADD' => 'انتبه, الاضافات هي تعديلات برمجية على كليجا و قد تكون ضارة أحياناً , لذا ان كنت غير متأكد من مصدر الإضافة ولم تقم بتحميلها من موقع كليجا فالافضل ان تراجع نفسك الآن . ',
|
||||
|
||||
@@ -181,6 +181,7 @@ return [
|
||||
'COMMA_X' => '<p class="live_xts">separate by comma (<span style="font-size:large"> , </span>)</p>',
|
||||
'NO_SEARCH_WORD' => 'You didn\'t type anything in the search form !',
|
||||
'USERSECTOUPLOAD' => 'The seconds between each upload process',
|
||||
'ENABLE_MULTIPART' => 'Enable multipart download',
|
||||
'ADM_UNWANTED_FILES' => 'You seem to have upgraded from a previous version, and because some file names are different now, you\'ll notice duplicated buttons in control panel. </ br> to solve this, remove all the files in "includes/adm" directory and re-upload them.',
|
||||
'HTML_URLS_ENABLED_NO_HTCC' => 'you have enabled the rewrite URLs, but you seem to have forgot to rename .htaccess.txt in Kleeja\'s root directory to ".htaccess", however, if you don\'t know what I\'m talking about, go ask for Kleeja\'s support or simply disable the rewrite urls feature.',
|
||||
'PLUGIN_CONFIRM_ADD' => 'Caution: plugins make changes to Kleeja functionality, and they could be harmful at times. so be sure to check the plugin source and make sure that it is an official Kleeja plugin.',
|
||||
|
||||
@@ -183,6 +183,7 @@ return [
|
||||
'COMMA_X' => '<p class="live_xts">جدا شده توسط کاما (<font style="font-size:large"> , </font>)</p>',
|
||||
'NO_SEARCH_WORD' => 'شما چيزي در فرم جست و جو تايپ نکرديد!',
|
||||
'USERSECTOUPLOAD' => 'زمان (ثانيه) بين هر اپلود با اپلود بعدي.',
|
||||
'ENABLE_MULTIPART' => 'دانلود چند قسمتی را فعال کنید',
|
||||
'ADM_UNWANTED_FILES' => 'ظاهرا شما از نسخه قديمي بروز رساني کرده ايد و به دليل تفاوت نوع فايل ها شما با مشکل دوگانگي فايل مواجه ميشويد. </ br> براي رفع اين مشکل , کليه ي فايل هاي پوشه "includes/adm" را پاک کرده و مجددا اپلود نماييد.',
|
||||
'HTML_URLS_ENABLED_NO_HTCC' => 'شما ادرس دهي بر اساس قوانين htaccess را انتخا کرده ايد. اما ظاهرا وارد کردن قوانين را فراموش کرده ايد. براي اطلاعات بيشتر به سايت پشتيبان مراجعه نماييد.',
|
||||
'PLUGIN_CONFIRM_ADD' => 'اخطار!!! اين افزونه تغييراتي در اسکريپت اصلي خواهد داد و اين ممکن است براي امنيت در اينده خطر ساز باشد, لذا از صحت افزونه اطمينان حاصل کنيد.',
|
||||
|
||||
Reference in New Issue
Block a user