From a6a28a635623256ded5623b9abad17479927f295 Mon Sep 17 00:00:00 2001 From: safraja <63454672+safraja@users.noreply.github.com> Date: Mon, 20 Jul 2020 02:09:47 +0200 Subject: [PATCH] Fix sorting by date and size (#387) Based on suggestions in https://github.com/prasathmani/tinyfilemanager/issues/197 but uses data-sort attribute (from DataTable wiki https://datatables.net/examples/advanced_init/html5-data-attributes.html) instead of invisible characters and also distinguishes files and folders, so they stay grouped even after sort. (I am sorry for my bad English.) --- tinyfilemanager.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 3e59f943..896697fa 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1902,7 +1902,16 @@ class="edit-file"> ' . readlink($path . '/' . $f) . '' : '') ?> - - + "> + + + @@ -1947,7 +1958,8 @@ class="edit-file"> ' . readlink($path . '/' . $f) . '' : '') ?> - + "> - + @@ -2453,7 +2465,7 @@ function fm_get_filesize($size) /** * Get director total size * @param string $directory - * @return string + * @return int */ function fm_get_directorysize($directory) { global $calc_folder; @@ -2466,7 +2478,7 @@ function fm_get_directorysize($directory) { } else if ($file->isDir()) { $dirCount++; } // return [$size, $count, $dirCount]; - return fm_get_filesize($size); + return $size; } else return 'Folder'; // Quick output }