From 4d243561530ff3a28fe59ae83e3eb1ec877e5016 Mon Sep 17 00:00:00 2001 From: Dasc3er Date: Wed, 7 Jul 2021 08:03:25 +0200 Subject: [PATCH] Correzioni minori percorsi --- modules/interventi/add.php | 2 +- plugins/componenti/actions.php | 6 +- view.php | 121 +++++++++++++++++---------------- 3 files changed, 65 insertions(+), 64 deletions(-) diff --git a/modules/interventi/add.php b/modules/interventi/add.php index 4f2900e86..6eb0fcb0c 100755 --- a/modules/interventi/add.php +++ b/modules/interventi/add.php @@ -450,7 +450,7 @@ echo ' if (data !== undefined) { //Carico nel panel i dettagli del cliente - $.get("'.$rootdir.'/modules/interventi/ajax_details.php?op=dettagli&id_anagrafica="+$(this).val(), function(data){ + $.get("'.base_path().'/modules/interventi/ajax_details.php?op=dettagli&id_anagrafica="+$(this).val(), function(data){ $("#dettagli_ciente").html(data); }); }else{ diff --git a/plugins/componenti/actions.php b/plugins/componenti/actions.php index 7ccc1b73b..9a899844c 100644 --- a/plugins/componenti/actions.php +++ b/plugins/componenti/actions.php @@ -49,7 +49,7 @@ switch ($operazione) { flash()->info(tr('Salvataggio completato!')); $dbo->commitTransaction(); - header('Location: '.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); + header('Location: '.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); exit; break; @@ -106,7 +106,7 @@ switch ($operazione) { } $dbo->commitTransaction(); - header('Location: '.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); + header('Location: '.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); exit; break; @@ -117,7 +117,7 @@ switch ($operazione) { flash()->info(tr('Componente eliminato!')); $dbo->commitTransaction(); - header('Location: '.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); + header('Location: '.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'#tab_'.$id_plugin); exit; break; diff --git a/view.php b/view.php index addc557b1..74dd8d008 100755 --- a/view.php +++ b/view.php @@ -30,74 +30,75 @@ if (empty($file)) { $link = base_path().'/'.$file->filepath; // Force download of the file -if (get('force') == '1') { +if (get('download') == '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); + readfile(base_dir().'/'.$file->filepath); + //download(base_dir().'/'.$file->filepath, basename($file->original_name)); exit(); +} + +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]; + + $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl'; + $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl'; + + // XML + $xml = new DOMDocument(); + $xml->loadXML($content); + + // XSL + $xsl = new DOMDocument(); + $xsl->load($stylesheet); + + // XSLT + $xslt = new XSLTProcessor(); + $xslt->importStylesheet($xsl); + + echo ' +'; + + echo $xslt->transformToXML($xml); } else { - 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]; - - $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl'; - $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl'; - - // XML - $xml = new DOMDocument(); - $xml->loadXML($content); - - // XSL - $xsl = new DOMDocument(); - $xsl->load($stylesheet); - - // XSLT - $xslt = new XSLTProcessor(); - $xslt->importStylesheet($xsl); + echo ' +'; + if ($file->isImage()) { echo ' - '; - - echo $xslt->transformToXML($xml); + '; } else { + if ($file->isPDF()) { + $src = \Prints::getPDFLink($file->filepath); + } + echo ' - '; - - if ($file->isImage()) { - echo ' - '; - } else { - if ($file->isPDF()) { - $src = \Prints::getPDFLink($file->filepath); - } - - echo ' - '; - } + '; } }