]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/EMailer/MailBuilder.php
Update function / rearrange tab order
[friendica.git] / src / Util / EMailer / MailBuilder.php
index e6b745b97978c07d9eb171aaf5dd38e603dd9b16..96e3a0928eb453f08844474e7fa0f34679a73382 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,6 +22,7 @@
 namespace Friendica\Util\EMailer;
 
 use Exception;
+use Friendica\App;
 use Friendica\App\BaseURL;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
@@ -71,7 +72,7 @@ abstract class MailBuilder
                $this->config  = $config;
                $this->logger  = $logger;
 
-               $hostname = $baseUrl->getHostname();
+               $hostname = $baseUrl->getHost();
                if (strpos($hostname, ':')) {
                        $hostname = substr($hostname, 0, strpos($hostname, ':'));
                }
@@ -79,10 +80,10 @@ abstract class MailBuilder
                $this->headers = [
                        'Precedence'           => ['list'],
                        'X-Friendica-Host'     => [$hostname],
-                       'X-Friendica-Platform' => [FRIENDICA_PLATFORM],
-                       'X-Friendica-Version'  => [FRIENDICA_VERSION],
+                       'X-Friendica-Platform' => [App::PLATFORM],
+                       'X-Friendica-Version'  => [App::VERSION],
                        'List-ID'              => ['<notification.' . $hostname . '>'],
-                       'List-Archive'         => ['<' . $baseUrl->get() . '/notifications/system>'],
+                       'List-Archive'         => ['<' . $baseUrl . '/notifications/system>'],
                ];
        }
 
@@ -119,7 +120,7 @@ abstract class MailBuilder
        {
                $this->recipientUid = $user['uid'] ?? 0;
                try {
-                       $this->l10n = $user['language'] ? $this->l10n->withLang($user['language']) : $this->l10n;
+                       $this->l10n = isset($user['language']) ? $this->l10n->withLang($user['language']) : $this->l10n;
                } catch (Exception $e) {
                        $this->logger->warning('cannot use language.', ['user' => $user, 'exception' => $e]);
                }
@@ -257,11 +258,11 @@ abstract class MailBuilder
                        $tpl     = Renderer::getMarkupTemplate('email/html.tpl');
                        $msgHtml = Renderer::replaceMacros($tpl, [
                                '$title'       => $this->l10n->t('Friendica Notification'),
-                               '$product'     => FRIENDICA_PLATFORM,
+                               '$product'     => App::PLATFORM,
                                '$htmlversion' => $msgHtml,
                                '$sitename'    => $this->config->get('config', 'sitename'),
                                '$banner'      => $this->config->get('system', 'email_banner',
-                                       $this->baseUrl->get(true) . DIRECTORY_SEPARATOR . self::DEFAULT_EMAIL_BANNER),
+                                       $this->baseUrl . DIRECTORY_SEPARATOR . self::DEFAULT_EMAIL_BANNER),
                        ]);
                }