From 2bdb09b95887a0a3b99e74f26b7037f3903558db Mon Sep 17 00:00:00 2001 From: F TEMPEZ Date: Thu, 22 Feb 2024 14:26:38 +0100 Subject: [PATCH] 1.6.02 Corrige un erreur de tri dans RFM --- README.md | 2 +- core/core.php | 2 +- core/vendor/filemanager/dialog.php | 38 +++++++++++++++++------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 8d6613d..fec0b76 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ZwiiCampus 1.6.01 +# ZwiiCampus 1.6.02 ZwiiCampus (Learning Management System) est logiciel auteur destiné à mettre en ligne des tutoriels. Il dispose de plusieurs modalités d'ouverture et d'accès des contenus. Basé sur la version 13 du CMS Zwii, la structure logicielle est solide, le framework de Zwii est éprouvé. diff --git a/core/core.php b/core/core.php index fe20531..ff81595 100644 --- a/core/core.php +++ b/core/core.php @@ -51,7 +51,7 @@ class common const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '1.6.01'; + const ZWII_VERSION = '1.6.02'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/'; diff --git a/core/vendor/filemanager/dialog.php b/core/vendor/filemanager/dialog.php index 151bc80..47a4ee3 100644 --- a/core/vendor/filemanager/dialog.php +++ b/core/vendor/filemanager/dialog.php @@ -864,50 +864,54 @@ if ($config['upload_files']) { ?> switch ($sort_by) { case 'date': - //usort($sorted, 'dateSort'); usort($sorted, function($x, $y) use ($descending) { if ($x['is_dir'] !== $y['is_dir']) { return $y['is_dir'] ? 1 : -1; } else { - return ($descending) - ? $x['size'] < $y['size'] - : $x['size'] >= $y['size']; + if ($descending) { + return ($x['size'] < $y['size']) ? -1 : ($x['size'] > $y['size'] ? 1 : 0); + } else { + return ($x['size'] > $y['size']) ? -1 : ($x['size'] < $y['size'] ? 1 : 0); + } } }); break; case 'size': - //usort($sorted, 'sizeSort'); usort($sorted, function($x, $y) use ($descending) { if ($x['is_dir'] !== $y['is_dir']) { return $y['is_dir'] ? 1 : -1; } else { - return ($descending) - ? $x['date'] < $y['date'] - : $x['date'] >= $y['date']; + if ($descending) { + return ($x['date'] < $y['date']) ? -1 : ($x['date'] > $y['date'] ? 1 : 0); + } else { + return ($x['date'] > $y['date']) ? -1 : ($x['date'] < $y['date'] ? 1 : 0); + } } }); - break; case 'extension': - //usort($sorted, 'extensionSort'); usort($sorted, function($x, $y) use ($descending) { if ($x['is_dir'] !== $y['is_dir']) { return $y['is_dir'] ? 1 : -1; } else { - return ($descending) - ? ($x['extension'] < $y['extension'] ? 1 : 0) - : ($x['extension'] >= $y['extension'] ? 1 : 0); + if ($descending) { + return strcasecmp($x['extension'], $y['extension']); + } else { + return -strcasecmp($x['extension'], $y['extension']); + } } }); + break; default: - // usort($sorted, 'filenameSort'); usort($sorted, function($x, $y) use ($descending) { if ($x['is_dir'] !== $y['is_dir']) { return $y['is_dir'] ? 1 : -1; } else { - return ($descending) - ? ($x['file_lcase'] < $y['file_lcase'] ? 1 : ($x['file_lcase'] == $y['file_lcase'] ? 0 : -1)) - : ($x['file_lcase'] >= $y['file_lcase'] ? 1 : ($x['file_lcase'] == $y['file_lcase'] ? 0 : -1)); + if ($descending) { + return strcasecmp($x['file_lcase'], $y['file_lcase']); + } else { + return -strcasecmp($x['file_lcase'], $y['file_lcase']); + } } }); break;