Skip to content

Commit e85d2e7

Browse files
authored
Fix itilsolution picture visibility (#10)
* Fix itilsolution picture visibility * Fix Lints
1 parent f93aa33 commit e85d2e7

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

inc/itilsolution.class.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ public static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
7070
} else {
7171
$title = __('Solution');
7272
}
73-
$sol = Toolbox::stripTags(Glpi\Toolbox\Sanitizer::unsanitize(html_entity_decode(
74-
$row['content'],
75-
ENT_QUOTES,
76-
'UTF-8',
77-
)));
73+
$sol = Glpi\Toolbox\Sanitizer::unsanitize(Html::entity_decode_deep($row['content']));
74+
$sol = preg_replace('#data:image/[^;]+;base64,#', '@', $sol);
75+
76+
preg_match_all('/<img [^>]*src=[\'"]([^\'"]*docid=([0-9]*))[^>]*>/', $sol, $res, PREG_SET_ORDER);
77+
78+
foreach ($res as $img) {
79+
$docimg = new Document();
80+
$docimg->getFromDB($img[2]);
81+
82+
$path = '<img src="file://' . GLPI_DOC_DIR . '/' . $docimg->fields['filepath'] . '"/>';
83+
$sol = str_replace($img[0], $path, $sol);
84+
}
7885

7986
if ($row['status'] == 3) {
8087
$text = __('Soluce approved on ', 'pdf');

0 commit comments

Comments
 (0)