From 2234463f2dca9e59f1c430ca1946cddeaeab9d79 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 15 Jan 2025 10:42:05 +0100 Subject: [PATCH 1/2] Fix itilsolution picture visibility --- inc/itilsolution.class.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/inc/itilsolution.class.php b/inc/itilsolution.class.php index c4b3fc9..f843c14 100644 --- a/inc/itilsolution.class.php +++ b/inc/itilsolution.class.php @@ -70,11 +70,18 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item) } else { $title = __('Solution'); } - $sol = Toolbox::stripTags(Glpi\Toolbox\Sanitizer::unsanitize(html_entity_decode( - $row['content'], - ENT_QUOTES, - 'UTF-8', - ))); + $sol = Glpi\Toolbox\Sanitizer::unsanitize(Html::entity_decode_deep($row['content'])); + $sol = preg_replace('#data:image/[^;]+;base64,#', '@', $sol); + + preg_match_all('/]*src=[\'"]([^\'"]*docid=([0-9]*))[^>]*>/', $sol, $res, PREG_SET_ORDER); + + foreach ($res as $img) { + $docimg = new Document(); + $docimg->getFromDB($img[2]); + + $path = ''; + $sol = str_replace($img[0], $path, $sol); + } if ($row['status'] == 3) { $text = __('Soluce approved on ', 'pdf'); From 217177a5b6558a2feed5036e87ef5038dcea5b55 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 15 Jan 2025 10:48:01 +0100 Subject: [PATCH 2/2] Fix Lints --- inc/itilsolution.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/itilsolution.class.php b/inc/itilsolution.class.php index f843c14..d79f8f6 100644 --- a/inc/itilsolution.class.php +++ b/inc/itilsolution.class.php @@ -79,7 +79,7 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item) $docimg = new Document(); $docimg->getFromDB($img[2]); - $path = ''; + $path = ''; $sol = str_replace($img[0], $path, $sol); }