diff --git a/src/Models/Upload.php b/src/Models/Upload.php
index e5dd849a1..f3af59eef 100755
--- a/src/Models/Upload.php
+++ b/src/Models/Upload.php
@@ -206,7 +206,7 @@ public function getContent()
*/
public function isImage()
{
- $list = ['jpg', 'png', 'gif', 'jpeg', 'bmp'];
+ $list = ['jpg', 'png', 'gif', 'jpeg', 'bmp', 'svg'];
return in_array($this->extension, $list);
}
diff --git a/view.php b/view.php
index a6b3a2124..a95f09878 100755
--- a/view.php
+++ b/view.php
@@ -29,66 +29,75 @@
$link = base_path().'/'.$file->filepath;
-if ($file->isFatturaElettronica()) {
- $content = file_get_contents(base_dir().'/'.$file->filepath);
-
- // Individuazione stylesheet
- $default_stylesheet = 'asso-invoice';
-
- $name = basename($file->original_name);
- $filename = explode('.', $name)[0];
- $pieces = explode('_', $filename);
- $stylesheet = $pieces[2];
+// Force download of the file
+if (get('force') == '1') {
+ header('Content-Type: application/octet-stream');
+ header("Content-Transfer-Encoding: Binary");
+ header("Content-disposition: attachment; filename=\"" . basename($file->original_name) . "\"");
+ readfile($docroot.'/'.$file->filepath);
+ exit();
+} else {
+ if ($file->isFatturaElettronica()) {
+ $content = file_get_contents(base_dir().'/'.$file->filepath);
- $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl';
- $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl';
+ // Individuazione stylesheet
+ $default_stylesheet = 'asso-invoice';
- // XML
- $xml = new DOMDocument();
- $xml->loadXML($content);
+ $name = basename($file->original_name);
+ $filename = explode('.', $name)[0];
+ $pieces = explode('_', $filename);
+ $stylesheet = $pieces[2];
- // XSL
- $xsl = new DOMDocument();
- $xsl->load($stylesheet);
+ $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl';
+ $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl';
- // XSLT
- $xslt = new XSLTProcessor();
- $xslt->importStylesheet($xsl);
+ // XML
+ $xml = new DOMDocument();
+ $xml->loadXML($content);
- echo '
-';
+ // XSL
+ $xsl = new DOMDocument();
+ $xsl->load($stylesheet);
- echo $xslt->transformToXML($xml);
-} else {
- echo '
-';
+ // XSLT
+ $xslt = new XSLTProcessor();
+ $xslt->importStylesheet($xsl);
- if ($file->isImage()) {
echo '
- ';
- } else {
- if ($file->isPDF()) {
- $src = \Prints::getPDFLink($file->filepath);
+ ';
+ echo $xslt->transformToXML($xml);
+ } else {
echo '
- ';
+ ';
+
+ if ($file->isImage()) {
+ echo '
+ ';
+ } else {
+ if ($file->isPDF()) {
+ $src = \Prints::getPDFLink($file->filepath);
+ }
+
+ echo '
+ ';
+ }
}
}