diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 8da7a68ad09..688bcac2d33 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -139,7 +139,7 @@ if ($id > 0)
// Construit liste des fichiers
- $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
+ $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3);
$totalsize=0;
foreach($filearray as $key => $file)
{
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index bca18b5712e..f12dd40f616 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -202,7 +202,7 @@ if ($objectid > 0)
print '
| '.$langs->trans("MailFile").' '.$i.' | '; // List of files - $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1); + $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); if (sizeof($listofpaths)) { foreach($listofpaths as $key => $val) @@ -966,7 +966,7 @@ else print ' | ||
| '.$langs->trans("MailFile").' '.$i.' | '; print ''; // List of files - $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,1); + $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); if (sizeof($listofpaths)) { foreach($listofpaths as $key => $val) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 337acb8bdf1..66c715e9f7f 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 26ee9202c61..abe08c4701a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -136,7 +136,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 85473925b98..06887448d30 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 9187a4f34b4..369f9272b35 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -133,7 +133,7 @@ if ($contrat->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index a142ac023e2..d3a3b0bba3c 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -132,7 +132,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 3b034ab03d6..777e9aa2822 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -143,7 +143,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index b28df21a4b7..d142fc7ac37 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -138,7 +138,7 @@ if ($facid > 0) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php index c1dbb6442a3..0c8ab3a2083 100644 --- a/htdocs/lib/files.lib.php +++ b/htdocs/lib/files.lib.php @@ -93,6 +93,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil // Add file into file_list array if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file); if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file); + if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file)) { $file_list[] = array( diff --git a/htdocs/product/document.php b/htdocs/product/document.php index b0f71d5aa6f..5b5c19e683d 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -136,7 +136,7 @@ if ($product->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index db64340449b..763c204acb5 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -136,7 +136,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'document', $langs->trans("Project"), 0, ($project->public?'projectpub':'project')); // Files list constructor - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index c9ff1e76cae..a9869e30e5a 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'document', $langs->trans("Task"), 0, 'projecttask'); // Files list constructor - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index ae8f8e340b4..e7f5becfad0 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -136,7 +136,7 @@ if ($socid > 0) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),3); $totalsize=0; foreach($filearray as $key => $file) { | ||