From ba97743b3efca4ff19bd68fa938f57296dca23c3 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 1 Aug 2024 10:43:28 +0200 Subject: [PATCH] improve extendability --- Application/Controller/Admin/SmtpChecker.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Application/Controller/Admin/SmtpChecker.php b/Application/Controller/Admin/SmtpChecker.php index a41c947..0051333 100644 --- a/Application/Controller/Admin/SmtpChecker.php +++ b/Application/Controller/Admin/SmtpChecker.php @@ -44,7 +44,18 @@ class SmtpChecker extends AdminDetailsController { parent::__construct(); - /** @var Shop $activeShop */ + $this->setSmtpCredentials(); + $this->from = Registry::getRequest()->getRequestEscapedParameter('from') ?: ''; + $this->addTplParam('from', $this->from); + $this->to = Registry::getRequest()->getRequestEscapedParameter('to') ?: ''; + $this->addTplParam('recipient', $this->to); + $this->addTplParam('sendMail', Registry::getRequest()->getRequestEscapedParameter('sendmail')); + + $this->addTplParam('smtpLog', $this->log); + } + + protected function setSmtpCredentials(): void + { $activeShop = Registry::getConfig()->getActiveShop(); if ($localHost = Registry::getRequest()->getRequestEscapedParameter('smtpHost')) { @@ -60,13 +71,6 @@ class SmtpChecker extends AdminDetailsController $this->addTplParam('smtpUser', $this->user); $this->pwd = Registry::getRequest()->getRequestEscapedParameter('smtpPwd') ?: $activeShop->getFieldData('oxsmtppwd'); $this->addTplParam('smtpPwd', $this->pwd); - $this->from = Registry::getRequest()->getRequestEscapedParameter('from') ?: ''; - $this->addTplParam('from', $this->from); - $this->to = Registry::getRequest()->getRequestEscapedParameter('to') ?: ''; - $this->addTplParam('recipient', $this->to); - $this->addTplParam('sendMail', Registry::getRequest()->getRequestEscapedParameter('sendmail')); - - $this->addTplParam('smtpLog', $this->log); } public function getTemplateName(): string