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
## Version 13.1.07
### Corrections
- Corrige une dépréciation de la sortie de la fonction Usort dans RFM.
## Version 13.1.06
### 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.

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.

View File

@ -51,7 +51,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '13.1.06';
const ZWII_VERSION = '13.1.07';
// URL autoupdate
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) {
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;