From 76315a0617e38ef257487bf89be5cbbc7d08bd59 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 22 May 2018 18:37:51 +0200 Subject: [PATCH] Ripristino modifiche file FileManager.php commit dc3f035 --- src/HTMLBuilder/Manager/FileManager.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/HTMLBuilder/Manager/FileManager.php b/src/HTMLBuilder/Manager/FileManager.php index 1103acd08..d37c24f14 100644 --- a/src/HTMLBuilder/Manager/FileManager.php +++ b/src/HTMLBuilder/Manager/FileManager.php @@ -42,10 +42,13 @@ $result .= ' } // Visualizzo l'elenco di file giĆ  caricati - if (!empty($options['id_plugin'])) - $rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($options['id_module']).' AND id_record='.prepare($options['id_record']).' AND id_plugin='.prepare($options['id_plugin'])); - else - $rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($options['id_module']).' AND id_record='.prepare($options['id_record']).' AND id_plugin = 0'); + $query = 'SELECT * FROM zz_files WHERE id_module='.prepare($options['id_module']).' AND id_record = '.prepare($options['id_record']).' AND id_plugin '; + if (!empty($options['id_plugin'])) { + $query .= ' = '.prepare($options['id_plugin']); + } else { + $query .= 'IS NULL'; + } + $rs = $dbo->fetchArray($query); if (!empty($rs)) { $result .= ' @@ -74,7 +77,7 @@ $result .= ' //Anteprime supportate dal browser // - $extension = end((explode('.', $r['filename']))); + $extension = end((explode('.', $r['original']))); $supported_extensions = ['pdf','jpg','png','gif','jpeg','bmp']; if ( in_array($extension, $supported_extensions)){ $result .= "