13.1.07 Corrige une erreur de tri dans RFM dépréciation return usort

This commit is contained in:
Fred Tempez 2024-02-22 14:34:54 +01:00
parent a2f53e1e58
commit 50fc319afd
5 changed files with 31 additions and 20 deletions

View File

@ -1,5 +1,12 @@
# Changelog # Changelog
## Version 13.1.07
### Corrections
- Corrige une dépréciation de la sortie de la fonction Usort dans RFM.
## Version 13.1.06 ## Version 13.1.06
### Corrections ### Corrections

View File

@ -1,4 +1,4 @@
# ZwiiCMS 13.1.06 # ZwiiCMS 13.1.07
Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.

View File

@ -1,4 +1,4 @@
# ZwiiCMS 13.1.06 # ZwiiCMS 13.1.07
Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge. Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge.

View File

@ -51,7 +51,7 @@ class common
const ACCESS_TIMER = 1800; const ACCESS_TIMER = 1800;
// Numéro de version // Numéro de version
const ZWII_VERSION = '13.1.06'; const ZWII_VERSION = '13.1.07';
// URL autoupdate // URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/cms-update/raw/branch/master/'; const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/cms-update/raw/branch/master/';

View File

@ -864,50 +864,54 @@ if ($config['upload_files']) { ?>
switch ($sort_by) { switch ($sort_by) {
case 'date': case 'date':
//usort($sorted, 'dateSort');
usort($sorted, function($x, $y) use ($descending) { usort($sorted, function($x, $y) use ($descending) {
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir'] ? 1 : -1; return $y['is_dir'] ? 1 : -1;
} else { } else {
return ($descending) if ($descending) {
? $x['size'] < $y['size'] return ($x['size'] < $y['size']) ? -1 : ($x['size'] > $y['size'] ? 1 : 0);
: $x['size'] >= $y['size']; } else {
return ($x['size'] > $y['size']) ? -1 : ($x['size'] < $y['size'] ? 1 : 0);
}
} }
}); });
break; break;
case 'size': case 'size':
//usort($sorted, 'sizeSort');
usort($sorted, function($x, $y) use ($descending) { usort($sorted, function($x, $y) use ($descending) {
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir'] ? 1 : -1; return $y['is_dir'] ? 1 : -1;
} else { } else {
return ($descending) if ($descending) {
? $x['date'] < $y['date'] return ($x['date'] < $y['date']) ? -1 : ($x['date'] > $y['date'] ? 1 : 0);
: $x['date'] >= $y['date']; } else {
return ($x['date'] > $y['date']) ? -1 : ($x['date'] < $y['date'] ? 1 : 0);
}
} }
}); });
break;
case 'extension': case 'extension':
//usort($sorted, 'extensionSort');
usort($sorted, function($x, $y) use ($descending) { usort($sorted, function($x, $y) use ($descending) {
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir'] ? 1 : -1; return $y['is_dir'] ? 1 : -1;
} else { } else {
return ($descending) if ($descending) {
? ($x['extension'] < $y['extension'] ? 1 : 0) return strcasecmp($x['extension'], $y['extension']);
: ($x['extension'] >= $y['extension'] ? 1 : 0); } else {
return -strcasecmp($x['extension'], $y['extension']);
}
} }
}); });
break; break;
default: default:
// usort($sorted, 'filenameSort');
usort($sorted, function($x, $y) use ($descending) { usort($sorted, function($x, $y) use ($descending) {
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir'] ? 1 : -1; return $y['is_dir'] ? 1 : -1;
} else { } else {
return ($descending) if ($descending) {
? ($x['file_lcase'] < $y['file_lcase'] ? 1 : ($x['file_lcase'] == $y['file_lcase'] ? 0 : -1)) return strcasecmp($x['file_lcase'], $y['file_lcase']);
: ($x['file_lcase'] >= $y['file_lcase'] ? 1 : ($x['file_lcase'] == $y['file_lcase'] ? 0 : -1)); } else {
return -strcasecmp($x['file_lcase'], $y['file_lcase']);
}
} }
}); });
break; break;