diff --git a/.gitignore b/.gitignore index 7ffc0b0..47dbf3d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,5 @@ Project_Default.xml .project .vscode/launch.json .htaccess -.php_cs.cache +.php-cs-fixer.cache kleeja.db diff --git a/.php_cs b/.php-cs-fixer.php similarity index 90% rename from .php_cs rename to .php-cs-fixer.php index b754750..4e8d7cb 100644 --- a/.php_cs +++ b/.php-cs-fixer.php @@ -5,13 +5,13 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__) ; -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setRules([ 'binary_operator_spaces' => ['default' => 'align'], 'phpdoc_align' => true, 'array_indentation' => true, 'blank_line_before_statement' => ['statements' => [ - 'break', 'case', 'continue', 'default', 'die', 'for', 'foreach', 'if'] + 'break', 'case', 'continue', 'default', 'exit', 'for', 'foreach', 'if'] ], 'braces' => ['position_after_control_structures' => 'next'], 'cast_spaces' => true, @@ -22,7 +22,7 @@ return PhpCsFixer\Config::create() 'include' => true, 'indentation_type' => true, 'array_syntax' => ['syntax' => 'short'], - 'lowercase_constants' => true, + 'constant_case' => ['case' => 'lower'], 'method_chaining_indentation' => true, 'method_argument_space' => true, 'no_closing_tag' => true, diff --git a/CHANGELOG.md b/CHANGELOG.md index dbfc0f8..af198b9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 3.1.7 +* add the ability to toggle multipart download for groups +* introduce custom admin path option +* compatibility with PHP 8.X +* add group max storage limit feature +* add the ability to delete files by extension +* change the default style to Bootstrap +* fix pagination issue with incorrect link generation +* introduce ajax upload (show upload progress bar and upload speed) +* fix the issue where correct username, password, and security code still shows "The security code is incorrect!" +* various bug fixes and improvements + +## 3.1.6 +* compatibility with `m3u` files +* change dashboard box colors +* fix rtl issue in bootstrap template +* kleeja new domain is `kleeja.net` + ## 3.1.5 * fix hiding error msgs when updating kleeja * hide update all buttun , when empty update's list diff --git a/do.php b/do.php index e06e20f..bb51542 100755 --- a/do.php +++ b/do.php @@ -184,9 +184,9 @@ if (ig('id') || ig('filename')) // x : used only for html links, where x = extension, downf is filename without extension elseif (ig('down') || ig('downf') || - ig('img') || ig('imgf') || + ig('img') || ig('imgf') || ig('thmb') || ig('thmbf') || - ig('downex') || ig('downexf')) + ig('downex') || ig('downexf')) { is_array($plugin_run_result = Plugins::getInstance()->run('begin_down_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook @@ -505,9 +505,13 @@ elseif (ig('down') || ig('downf') || //send file headers header('Pragma: public'); - if ($resuming_on) { + + if ($resuming_on) + { header('Accept-Ranges: bytes'); - } else { + } + else + { header('Accept-Ranges: none'); } header('Content-Description: File Transfer'); @@ -539,14 +543,16 @@ elseif (ig('down') || ig('downf') || list($range, $range_end) = explode('-', $range, 2); $range = round(floatval($range), 0); $range_end = ! $range_end ? $size - 1 : round(floatval($range_end), 0); - - if ($range < 0 || $range >= $size || $range > $range_end || $range_end >= $size ) { + + 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; header('HTTP/1.1 206 Partial Content'); header("Content-Length: $partial_length"); diff --git a/go.php b/go.php index c1da52a..80b1f0a 100755 --- a/go.php +++ b/go.php @@ -53,9 +53,11 @@ switch ($current_go_case) 'ext' => $ext, 'size' => readable_size($size), 'group' => $gid, - 'group_name' => str_replace(['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'], - [$lang['ADMINS'], $lang['USERS'], $lang['GUESTS']], - $d_groups[$gid]['data']['group_name']), + 'group_name' => str_replace( + ['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'], + [$lang['ADMINS'], $lang['USERS'], $lang['GUESTS']], + $d_groups[$gid]['data']['group_name'] + ), 'most_firstrow' => $same_group == 0 ? true : false, 'firstrow' => $same_group ==0 or $same_group != $gid ? true : false, 'rando' => $rando, @@ -67,10 +69,10 @@ switch ($current_go_case) is_array($plugin_run_result = Plugins::getInstance()->run('guide_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook - break; + break; // - //Page of reporting + //Page of reporting // case 'report' : @@ -218,10 +220,10 @@ switch ($current_go_case) is_array($plugin_run_result = Plugins::getInstance()->run('report_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook - break; + break; // - //Pages of rules + //Pages of rules // case 'rules' : @@ -231,10 +233,10 @@ switch ($current_go_case) is_array($plugin_run_result = Plugins::getInstance()->run('rules_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook - break; + break; // - //Page of call-us + //Page of call-us // case 'call' : @@ -330,10 +332,10 @@ switch ($current_go_case) is_array($plugin_run_result = Plugins::getInstance()->run('call_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook - break; + break; // - //Page for requesting delete file + //Page for requesting delete file // case 'del' : @@ -376,6 +378,7 @@ switch ($current_go_case) while ($row=$SQL->fetch_array($result)) { @kleeja_unlink($row['folder'] . '/' . $row['name']); + //delete thumb if (file_exists($row['folder'] . '/thumbs/' . $row['name'])) { @@ -426,7 +429,9 @@ switch ($current_go_case) } $SQL->freeresult($result); - } else { + } + else + { kleeja_info($lang['NOT_FOUND']); } } @@ -448,10 +453,10 @@ switch ($current_go_case) } }//else - break; + break; // - //Page of Kleeja stats + //Page of Kleeja stats // case 'stats' : @@ -492,11 +497,11 @@ switch ($current_go_case) is_array($plugin_run_result = Plugins::getInstance()->run('stats_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook - break; + break; // - // Page for redirect to downloading a file - // [!] depreacted from 1rc6+, see do.php + // Page for redirect to downloading a file + // [!] depreacted from 1rc6+, see do.php // case 'down': @@ -515,10 +520,10 @@ switch ($current_go_case) exit; - break; + break; // - // for queue + // for queue // case 'queue': @@ -551,10 +556,10 @@ switch ($current_go_case) exit; - break; + break; // - //this is a part of ACP, only admins can access this part of page + //this is a part of ACP, only admins can access this part of page // case 'resync': @@ -572,73 +577,73 @@ switch ($current_go_case) switch (g('case')): // - //re-sync total files number .. + //re-sync total files number .. // - case 'sync_files': + case 'sync_files': - //no start ? or there - $start = ! ig('start') ? false : g('start', 'int'); + //no start ? or there + $start = ! ig('start') ? false : g('start', 'int'); - $end = sync_total_files(true, $start); + $end = sync_total_files(true, $start); - //no end, then sync'ing is done... - if (! $end) - { - delete_cache('data_stats'); - $text = $title = sprintf($lang['SYNCING_DONE'], $lang['ALL_FILES']); - $link_to_go = './'.$customadminpath.'/?cp=r_repair#!cp=r_repair'; - } - else - { - $text = $title = sprintf($lang['SYNCING'], $lang['ALL_FILES']) . ' (' . (! $start ? 0 : $start) . '->' . (! $end ? '?' : $end) . ')'; - $link_to_go = './go.php?go=resync&case=sync_files&start=' . $end; - } + //no end, then sync'ing is done... + if (! $end) + { + delete_cache('data_stats'); + $text = $title = sprintf($lang['SYNCING_DONE'], $lang['ALL_FILES']); + $link_to_go = './' . $customadminpath . '/?cp=r_repair#!cp=r_repair'; + } + else + { + $text = $title = sprintf($lang['SYNCING'], $lang['ALL_FILES']) . ' (' . (! $start ? 0 : $start) . '->' . (! $end ? '?' : $end) . ')'; + $link_to_go = './go.php?go=resync&case=sync_files&start=' . $end; + } - //to be sure ! - $text .= '' . "\n"; + //to be sure ! + $text .= '' . "\n"; - kleeja_info($text, $title, true, $link_to_go, 2); + kleeja_info($text, $title, true, $link_to_go, 2); - break; + break; // - //re-sync total images number .. + //re-sync total images number .. // - case 'sync_images': + case 'sync_images': - //no start ? or there - $start = ! ig('start') ? false : g('start', 'int'); + //no start ? or there + $start = ! ig('start') ? false : g('start', 'int'); - $end = sync_total_files(false, $start); + $end = sync_total_files(false, $start); - //no end, then sync'ing is done... - if (! $end) - { - delete_cache('data_stats'); - $text = $title = sprintf($lang['SYNCING_DONE'], $lang['ALL_IMAGES']) . ' (' . (! $start ? 0 : $start) . '->' . (! $end ? '?' : $end) . ')'; - $link_to_go = './'.$customadminpath.'/?cp=r_repair#!cp=r_repair'; - } - else - { - $text = $title = sprintf($lang['SYNCING'], $lang['ALL_IMAGES']); - $link_to_go = './go.php?go=resync&case=sync_images&start=' . $end; - } + //no end, then sync'ing is done... + if (! $end) + { + delete_cache('data_stats'); + $text = $title = sprintf($lang['SYNCING_DONE'], $lang['ALL_IMAGES']) . ' (' . (! $start ? 0 : $start) . '->' . (! $end ? '?' : $end) . ')'; + $link_to_go = './' . $customadminpath . '/?cp=r_repair#!cp=r_repair'; + } + else + { + $text = $title = sprintf($lang['SYNCING'], $lang['ALL_IMAGES']); + $link_to_go = './go.php?go=resync&case=sync_images&start=' . $end; + } - //to be sure ! - $text .= '' . "\n"; + //to be sure ! + $text .= '' . "\n"; - kleeja_info($text, $title, true, $link_to_go, 2); + kleeja_info($text, $title, true, $link_to_go, 2); - break; + break; endswitch; - break; + break; - /** - * Ajax get uploading progress - */ + /** + * Ajax get uploading progress + */ case 'uploading_progress': header('Content-type: application/json; charset=UTF-8'); @@ -656,10 +661,10 @@ switch ($current_go_case) // } - if (! function_exists('ini_get')) - { - exit(json_encode($result_data)); - } + if (! function_exists('ini_get')) + { + exit(json_encode($result_data)); + } $key = ini_get('session.upload_progress.prefix') . $field_value; @@ -678,8 +683,8 @@ switch ($current_go_case) // - // Default , if you are a developer , you can embed your page here with this hook - // by using g('go') and your codes. + // Default , if you are a developer , you can embed your page here with this hook + // by using g('go') and your codes. // default: @@ -692,7 +697,7 @@ switch ($current_go_case) kleeja_err($lang['ERROR_NAVIGATATION']); } - break; + break; }//end switch is_array($plugin_run_result = Plugins::getInstance()->run('end_go_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook diff --git a/includes/FetchFile.php b/includes/FetchFile.php index 9ad4391..403f2ce 100644 --- a/includes/FetchFile.php +++ b/includes/FetchFile.php @@ -130,7 +130,7 @@ class FetchFile $error = true; kleeja_log(sprintf("cUrl error (#%d): %s\n", curl_errno($ch), htmlspecialchars(curl_error($ch)))); } - + curl_close($ch); fclose($out); @@ -145,7 +145,7 @@ class FetchFile $error = true; kleeja_log(sprintf("FetchFile error (curl: #%d): %s\n", curl_errno($ch), htmlspecialchars(curl_error($ch)))); } - + curl_close($ch); return isset($error) ? false : $data; diff --git a/includes/KleejaUploader.php b/includes/KleejaUploader.php index d1da4db..59920d7 100755 --- a/includes/KleejaUploader.php +++ b/includes/KleejaUploader.php @@ -18,7 +18,6 @@ if (! defined('IN_COMMON')) interface KleejaUploader { - /** * set the allowed extensions of uploaded files * @param array $allowed_file_extensions an array of allowed extensions, and sizes ['gif'=>122, 'png'=>2421 ..] diff --git a/includes/adm/a_configs.php b/includes/adm/a_configs.php index 1c54e73..8e3db34 100755 --- a/includes/adm/a_configs.php +++ b/includes/adm/a_configs.php @@ -275,9 +275,10 @@ foreach ($types as $typekey => $type) if ($option['type'] == $typekey) { $options .= str_replace( - ['', '', '