From 522d5703d32fa2024682339e62fad05cbadb7db4 Mon Sep 17 00:00:00 2001 From: mjansen Date: Wed, 6 Sep 2023 14:28:31 +0200 Subject: [PATCH] Mail: Make language variable placeholder interpolation more robust See: https://mantis.ilias.de/view.php?id=37831 --- Services/Mail/classes/class.ilMailFormGUI.php | 6 +++++- Services/Mail/classes/class.ilMailTemplateGUI.php | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Services/Mail/classes/class.ilMailFormGUI.php b/Services/Mail/classes/class.ilMailFormGUI.php index 7ac69f79de56..8fbd8184eade 100644 --- a/Services/Mail/classes/class.ilMailFormGUI.php +++ b/Services/Mail/classes/class.ilMailFormGUI.php @@ -743,7 +743,11 @@ public function showForm() $placeholders = new ilManualPlaceholderInputGUI('m_message'); $placeholders->setInstructionText($this->lng->txt('mail_nacc_use_placeholder')); - $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + try { + $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + } catch (Throwable $e) { + $placeholders->setAdviseText($this->lng->txt('placeholders_advise')); + } foreach ($context->getPlaceholders() as $key => $value) { $placeholders->addPlaceholder($value['placeholder'], $value['label']); } diff --git a/Services/Mail/classes/class.ilMailTemplateGUI.php b/Services/Mail/classes/class.ilMailTemplateGUI.php index 2c6e80f2baad..d3cf3a88657e 100644 --- a/Services/Mail/classes/class.ilMailTemplateGUI.php +++ b/Services/Mail/classes/class.ilMailTemplateGUI.php @@ -444,7 +444,11 @@ public function getAjaxPlaceholdersById() : void $placeholders = new ilManualPlaceholderInputGUI('m_message'); $placeholders->setInstructionText($this->lng->txt('mail_nacc_use_placeholder')); - $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + try { + $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + } catch (Throwable $e) { + $placeholders->setAdviseText($this->lng->txt('placeholders_advise')); + } $context = ilMailTemplateContextService::getTemplateContextById($contextId); foreach ($context->getPlaceholders() as $key => $value) { @@ -522,7 +526,11 @@ protected function getTemplateForm(ilMailTemplate $template = null) : ilProperty $placeholders = new ilManualPlaceholderInputGUI('m_message'); $placeholders->setDisabled(!$this->isEditingAllowed()); $placeholders->setInstructionText($this->lng->txt('mail_nacc_use_placeholder')); - $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + try { + $placeholders->setAdviseText(sprintf($this->lng->txt('placeholders_advise'), '
')); + } catch (Throwable $e) { + $placeholders->setAdviseText($this->lng->txt('placeholders_advise')); + } $placeholders->supportsRerenderSignal( 'context', $this->ctrl->getLinkTarget($this, 'getAjaxPlaceholdersById', '', true, false)