diff --git a/components/ILIAS/Certificate/classes/File/Certificate/class.ilPdfGenerator.php b/components/ILIAS/Certificate/classes/File/Certificate/class.ilPdfGenerator.php index 356bd93f53f4..32aef76d0ad6 100755 --- a/components/ILIAS/Certificate/classes/File/Certificate/class.ilPdfGenerator.php +++ b/components/ILIAS/Certificate/classes/File/Certificate/class.ilPdfGenerator.php @@ -109,7 +109,7 @@ private function createPDFScalar(ilUserCertificate $certificate): string $background_rid = $this->irss->manage()->find($certificate->getCurrentBackgroundImageUsed()); $background_src = ''; if ($background_rid instanceof ResourceIdentification) { - $background_src = $this->irss->consume()->src($background_rid)->getSrc(); + $background_src = $this->irss->consume()->src($background_rid)->getSrc(true); $certificateContent = str_replace( ['[BACKGROUND_IMAGE]'], @@ -124,8 +124,6 @@ private function createPDFScalar(ilUserCertificate $certificate): string ); } - - $pdf_base64 = $this->rpcHelper->ilFO2PDF('RPCTransformationHandler', $certificateContent); return $pdf_base64->scalar; diff --git a/components/ILIAS/Certificate/classes/Form/Repository/class.ilCertificateSettingsFormRepository.php b/components/ILIAS/Certificate/classes/Form/Repository/class.ilCertificateSettingsFormRepository.php index 267980bc0acd..bfa730fc6b71 100755 --- a/components/ILIAS/Certificate/classes/Form/Repository/class.ilCertificateSettingsFormRepository.php +++ b/components/ILIAS/Certificate/classes/Form/Repository/class.ilCertificateSettingsFormRepository.php @@ -216,7 +216,7 @@ public function createForm(ilCertificateGUI $certificateGUI): ilPropertyFormGUI $this->card_thumbnail_definition ); $flavour_urls = $this->irss->consume()->flavourUrls($background_flavour); - foreach ($flavour_urls->getURLs() as $url) { + foreach ($flavour_urls->getURLs(true) as $url) { /** @var string $url */ $bgimage->setImage($url); } @@ -245,7 +245,7 @@ public function createForm(ilCertificateGUI $certificateGUI): ilPropertyFormGUI if ('' !== $thumbnail_image_identification) { $identification = $this->irss->manage()->find($thumbnail_image_identification); if ($identification instanceof ResourceIdentification) { - $thumbnailImage->setImage($this->irss->consume()->src($identification)->getSrc()); + $thumbnailImage->setImage($this->irss->consume()->src($identification)->getSrc(true)); $allowThumbnailDeletion = true; } } elseif ($old_thumbnail_image_path !== '' && $this->filesystem->has($old_thumbnail_image_path)) { diff --git a/components/ILIAS/Certificate/classes/Template/Action/Preview/ilCertificateTemplatePreviewAction.php b/components/ILIAS/Certificate/classes/Template/Action/Preview/ilCertificateTemplatePreviewAction.php index 67a5176b3ff2..fd28510132eb 100755 --- a/components/ILIAS/Certificate/classes/Template/Action/Preview/ilCertificateTemplatePreviewAction.php +++ b/components/ILIAS/Certificate/classes/Template/Action/Preview/ilCertificateTemplatePreviewAction.php @@ -128,7 +128,7 @@ private function exchangeCertificateVariables( $identification = $this->irss->manage()->find($template->getBackgroundImageIdentification()); if ($identification instanceof ResourceIdentification) { - $backgroundImagePath = $this->irss->consume()->src($identification)->getSrc(); + $backgroundImagePath = $this->irss->consume()->src($identification)->getSrc(true); } return str_replace( diff --git a/components/ILIAS/Certificate/classes/User/class.ilUserCertificateGUI.php b/components/ILIAS/Certificate/classes/User/class.ilUserCertificateGUI.php index d408c03ba567..cbac0aae98c5 100755 --- a/components/ILIAS/Certificate/classes/User/class.ilUserCertificateGUI.php +++ b/components/ILIAS/Certificate/classes/User/class.ilUserCertificateGUI.php @@ -169,7 +169,9 @@ public function listCertificates(): void if ($thumbnail_image_identification === '' || $thumbnail_image_identification === '-') { $thumbnail_image_identification = $certificateData['thumbnail_image_path'] ?? ''; if ($thumbnail_image_identification !== '' && $this->filesystem->has($thumbnail_image_identification)) { - $imagePath = ilFileUtils::getWebspaceDir() . $thumbnail_image_identification; + $imagePath = ilWACSignedPath::signFile( + ilFileUtils::getWebspaceDir() . $thumbnail_image_identification + ); } } else { $thumb_rid = $this->irss->manage()->find($thumbnail_image_identification); @@ -179,7 +181,7 @@ public function listCertificates(): void } if ($imagePath === '') { - $imagePath = ilUtil::getImagePath('standard/icon_cert.svg'); + $imagePath = ilWACSignedPath::signFile(ilUtil::getImagePath('standard/icon_cert.svg')); } $cardImage = $this->uiFactory->image()->standard( diff --git a/components/ILIAS/Certificate/classes/class.ilCertificateGUI.php b/components/ILIAS/Certificate/classes/class.ilCertificateGUI.php index df11aa1733af..13fc586e60d4 100755 --- a/components/ILIAS/Certificate/classes/class.ilCertificateGUI.php +++ b/components/ILIAS/Certificate/classes/class.ilCertificateGUI.php @@ -59,6 +59,7 @@ class ilCertificateGUI private readonly ilCertificateTemplateExportAction $exportAction; private readonly ilCertificateTemplatePreviewAction $previewAction; private readonly FileUpload $fileUpload; + private readonly Filesystem $file_system; private readonly string $certificatePath; private readonly ilPageFormats $pageFormats; private readonly ilLogger $logger; @@ -79,7 +80,7 @@ public function __construct( ilCertificateTemplatePreviewAction $previewAction = null, FileUpload $fileUpload = null, private readonly ilSetting $settings = new ilSetting('certificate'), - Filesystem $fileSystem = null, + Filesystem $file_system = null, Filesystem $tmp_file_system = null ) { global $DIC; @@ -138,6 +139,7 @@ public function __construct( $this->irss ); $this->fileUpload = $fileUpload ?? $DIC->upload(); + $this->file_system = $file_system ?? $DIC->filesystem()->web(); $this->database = $DIC->database(); } @@ -390,6 +392,22 @@ private function saveCertificate(ilPropertyFormGUI $form, array $form_fields, in ) { $new_background_rid = null; } + if ( + is_string($new_background_rid) && + is_string($this->global_certificate_settings->getBackgroundImageIdentification()) && + $new_background_rid === $this->global_certificate_settings->getBackgroundImageIdentification() + ) { + if ($this->file_system->has($new_background_rid)) { + $new_background_rid = $this->irss->manage()->stream( + $this->file_system->readStream($new_background_rid), + $this->stakeholder + ); + } else { + $old_background_image = $new_background_rid; + $new_background_rid = null; + } + } + $new_thumbnail_rid = !$should_delete_thumbnail ? $current_thumbnail_rid : null; if ($form->checkInput()) { try { diff --git a/components/ILIAS/Certificate/classes/class.ilObjCertificateSettingsGUI.php b/components/ILIAS/Certificate/classes/class.ilObjCertificateSettingsGUI.php index 95b9cabb9e55..a5c565e5b50a 100755 --- a/components/ILIAS/Certificate/classes/class.ilObjCertificateSettingsGUI.php +++ b/components/ILIAS/Certificate/classes/class.ilObjCertificateSettingsGUI.php @@ -177,12 +177,12 @@ public function settings(): void } } } - }# + } if ($this->object->hasBackgroundImage()) { $rid = $this->object->getBackgroundImageIdentification(); if ($rid instanceof ResourceIdentification) { - $bgimage->setImage($this->irss->consume()->src($rid)->getSrc()); + $bgimage->setImage($this->irss->consume()->src($rid)->getSrc(true)); } elseif (is_string($rid)) { $bgimage->setImage($rid); }