diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index a95063e9d64..547ccc0466c 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -103,7 +103,7 @@ if ($id > 0) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 972858a808f..26852e796c1 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -240,7 +240,7 @@ if ($object->id > 0) print '

'; // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index d3766ae27ce..ccd318c93fb 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -91,7 +91,7 @@ if ($object->id > 0) dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 17e041adaf5..05538666ba3 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index fb9df1fcb37..eed21f3e1cc 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -94,7 +94,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 1eb5909544b..31a741d9dcf 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -98,7 +98,7 @@ if ($id > 0 || ! empty($ref)) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 0647f0986d8..32eb8a50f77 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -95,7 +95,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index ea951f85941..0432f16b31b 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -97,7 +97,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index e2ad29b8562..8759af8a719 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -149,7 +149,7 @@ if ($type == 'directory') $formfile=new FormFile($db); $maxlengthname=40; - $excludefiles = array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'); + $excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'); $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); // Right area. If module is defined, we are in automatic ecm. @@ -205,7 +205,7 @@ if ($type == 'directory') $filearray=array(); $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; } - else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield, $sorting,1); + else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); if ($section) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 334fb9a5d9e..cb993f9418e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -797,7 +797,8 @@ class FormFile { print ''; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index faa4d7f1640..b8a2991ffb5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -43,7 +43,7 @@ function dol_basename($pathfile) * @param string $types Can be "directories", "files", or "all" * @param int $recursive Determines whether subdirectories are searched * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')) + * @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only @@ -1281,11 +1281,11 @@ function dol_uncompress($inputfile,$outputdir) * * @param string $dir Directory to scan * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function + * @param string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @param int $nohook Disable all hooks * @return string Full path to most recent file */ -function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'),$nohook=false) +function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview\.png)$','^\.'),$nohook=false) { $tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook); return $tmparray[0]; diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php index c8cf919742b..9525639dd9c 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php @@ -707,7 +707,7 @@ class doc_generic_project_odt extends ModelePDFProjects $listtasksfiles = $listlines->__get('tasksfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) @@ -746,7 +746,7 @@ class doc_generic_project_odt extends ModelePDFProjects $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) { diff --git a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php index 3d76834dc9e..09d6284d902 100644 --- a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php @@ -682,7 +682,7 @@ class doc_generic_task_odt extends ModelePDFTask $listtasksfiles = $odfHandler->setSegment('tasksfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) @@ -724,7 +724,7 @@ class doc_generic_task_odt extends ModelePDFTask $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 54e3fa0a561..aed4a682fc0 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -671,7 +671,7 @@ class EcmDirectory // extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); - $filelist=dol_dir_list($dir,'files',0,'','\.meta$'); + $filelist=dol_dir_list($dir,'files',0,'','(\.meta|_preview\.png)$'); // Test if filelist is in database diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 94c5d06759d..6cd469417ae 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -202,7 +202,7 @@ $form=new Form($db); // Construit liste des fichiers -$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); +$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 03ccaabd2a5..8bfc9216fbe 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -187,7 +187,7 @@ print ''; - $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1); + $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1); // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'invoice') diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 3137f31b793..0f88d80d34b 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -104,7 +104,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 277b241f259..7196387b067 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1082,7 +1082,7 @@ class Project extends CommonObject if (dol_mkdir($clone_project_dir) >= 0) { - $filearray=dol_dir_list($ori_project_dir,"files",0,'','\.meta$','',SORT_ASC,1); + $filearray=dol_dir_list($ori_project_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); foreach($filearray as $key => $file) { $rescopy = dol_copy($ori_project_dir . '/' . $file['name'], $clone_project_dir . '/' . $file['name'],0,1); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 214c64b94f9..3345ce84b21 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1160,7 +1160,7 @@ class Task extends CommonObject $clone_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($clone_project_ref). "/" . dol_sanitizeFileName($clone_task_ref); $ori_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($ori_project_ref). "/" . dol_sanitizeFileName($fromid); - $filearray=dol_dir_list($ori_task_dir,"files",0,'','\.meta$','',SORT_ASC,1); + $filearray=dol_dir_list($ori_task_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); foreach($filearray as $key => $file) { if (!file_exists($clone_task_dir)) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 8d545bf1e6a..721689bf5b0 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -97,7 +97,7 @@ if ($object->id > 0) dol_fiche_head($head, 'document', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); // Files list constructor - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 0b876d0490a..84dd161484f 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -180,7 +180,7 @@ if ($object->id > 0) $linkback=GETPOST('withproject')?''.$langs->trans("BackToList").'':''; // Files list constructor - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 1da45c36c8f..e1b4f9cd504 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -99,7 +99,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) {
'; $tmp=explode('.',$file['name']); - $minifile=$tmp[0].'_mini.'.strtolower($tmp[1]); // Thumbs are created with filename in lower case + if (count($tmp) == 3) $minifile=$tmp[0].'_mini.'.$tmp[1].'.'.strtolower($tmp[2]); // Thumbs are created with filename in lower case + else $minifile=$tmp[0].'_mini.'.strtolower($tmp[1]); // Thumbs are created with filename in lower case if (image_format_supported($file['name']) > 0) print ''; else print ' '; print ''; // Right area $relativepath=$ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; -$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); +$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $formfile=new FormFile($db); $param='&section='.$section; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 27e1c4995c1..54728df36d9 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -94,7 +94,7 @@ if ($object->id) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index ce497f9b7c4..cdf5bfad4e5 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -100,7 +100,7 @@ if ($object->id > 0) // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 2bc3e7b607e..3ea8e7b382e 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -89,7 +89,7 @@ if ($object->id > 0) dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill'); // Construit liste des fichiers - $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index a6c0975ec97..dc38357ca4e 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -313,7 +313,7 @@ if (GETPOST('purge')) print '
Clean orphelins files into files '.$upload_dir.'