Fix sort not working on security page to test file upload

This commit is contained in:
Laurent Destailleur 2022-03-15 12:14:46 +01:00
parent f789fc24f7
commit 69654b2b43
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -1504,7 +1504,7 @@ class FormFile
if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) {
$useajax = 0;
}
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="'.($useajax ? 'reposition ' : '').'deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
}
print "</td>";