From 69654b2b4398bfec1bb3f1c88cb9b73617ebb618 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 12:14:46 +0100 Subject: [PATCH] Fix sort not working on security page to test file upload --- htdocs/admin/security_file.php | 12 +++++++++--- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 82df4bed430..67c6914f1cf 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -36,6 +36,14 @@ if (!$user->admin) { } $action = GETPOST('action', 'aZ09'); +$sortfield = GETPOST('sortfield', 'aZ09'); +$sortorder = GETPOST('sortorder', 'aZ09'); +if (empty($sortfield)) { + $sortfield = 'date'; +} +if (empty($sortorder)) { + $sortorder = 'desc'; +} $upload_dir = $conf->admin->dir_temp; @@ -73,8 +81,6 @@ if ($action == 'updateform') { } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors'); } - Header('Location: '.$_SERVER["PHP_SELF"]); - exit; } @@ -190,7 +196,7 @@ $formfile = new FormFile($db); $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); // List of document -$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1); $formfile->list_of_documents($filearray, null, 'admin_temp', ''); // End of page diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cad584e8731..c01ff5af541 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1504,7 +1504,7 @@ class FormFile if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { $useajax = 0; } - print ''.img_delete().''; + print ''.img_delete().''; } print "";