Bläddra i källkod

Fix sort not working on security page to test file upload

Laurent Destailleur 3 år sedan
förälder
incheckning
69654b2b43
2 ändrade filer med 10 tillägg och 4 borttagningar
  1. 9 3
      htdocs/admin/security_file.php
  2. 1 1
      htdocs/core/class/html.formfile.class.php

+ 9 - 3
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

+ 1 - 1
htdocs/core/class/html.formfile.class.php

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