forked from Wavyzz/dolibarr
Prepare fix to hide images generated by "preview" feature.
This commit is contained in:
@@ -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='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -797,7 +797,8 @@ class FormFile
|
||||
{
|
||||
print '<td align="center">';
|
||||
$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 '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user