From: nupplaPhil Date: Sun, 2 Feb 2020 21:40:30 +0000 (+0100) Subject: Add extra email banner (including setting) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7fb913eb86e9897de3551811ba4adc9d7caf8c14;p=friendica.git Add extra email banner (including setting) --- diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 7cb3a9b8f7..50a9c9d22e 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -13,6 +13,7 @@ use Friendica\Module\BaseAdmin; use Friendica\Module\Register; use Friendica\Protocol\PortableContact; use Friendica\Util\BasePath; +use Friendica\Util\EMailer\MailBuilder; use Friendica\Util\Strings; use Friendica\Worker\Delivery; @@ -110,6 +111,7 @@ class Site extends BaseAdmin $sitename = (!empty($_POST['sitename']) ? Strings::escapeTags(trim($_POST['sitename'])) : ''); $sender_email = (!empty($_POST['sender_email']) ? Strings::escapeTags(trim($_POST['sender_email'])) : ''); $banner = (!empty($_POST['banner']) ? trim($_POST['banner']) : false); + $email_banner = (!empty($_POST['email_banner']) ? trim($_POST['email_banner']) : false); $shortcut_icon = (!empty($_POST['shortcut_icon']) ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : ''); $touch_icon = (!empty($_POST['touch_icon']) ? Strings::escapeTags(trim($_POST['touch_icon'])) : ''); $additional_info = (!empty($_POST['additional_info']) ? trim($_POST['additional_info']) : ''); @@ -301,6 +303,12 @@ class Site extends BaseAdmin DI::config()->set('system', 'banner', $banner); } + if (empty($email_banner)) { + DI::config()->delete('system', 'email_banner'); + } else { + DI::config()->set('system', 'email_banner', $email_banner); + } + if (empty($additional_info)) { DI::config()->delete('config', 'info'); } else { @@ -489,6 +497,12 @@ class Site extends BaseAdmin $banner = 'logoFriendica'; } + $email_banner = DI::config()->get('system', 'email_banner'); + + if ($email_banner == false) { + $email_banner = MailBuilder::DEFAULT_EMAIL_BANNER; + } + $additional_info = DI::config()->get('config', 'info'); // Automatically create temporary paths @@ -571,6 +585,7 @@ class Site extends BaseAdmin '$sitename' => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''], '$sender_email' => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'], '$banner' => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''], + '$email_banner' => ['email_banner', DI::l10n()->t('Email Banner/Logo'), $email_banner, ''], '$shortcut_icon' => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')], '$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')], '$additional_info' => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())], diff --git a/src/Util/EMailer/MailBuilder.php b/src/Util/EMailer/MailBuilder.php index 389874efde..2f8c199a50 100644 --- a/src/Util/EMailer/MailBuilder.php +++ b/src/Util/EMailer/MailBuilder.php @@ -17,6 +17,9 @@ use Friendica\Object\EMail\IEmail; */ abstract class MailBuilder { + /** @var string The default email banner in case nothing else is defined */ + const DEFAULT_EMAIL_BANNER = 'images/friendica-32.png'; + /** @var L10n */ protected $l10n; /** @var IConfig */ @@ -163,11 +166,12 @@ abstract class MailBuilder // load the template for private message notifications $tpl = Renderer::getMarkupTemplate('email/html.tpl'); $msgHtml = Renderer::replaceMacros($tpl, [ - '$banner' => $this->l10n->t('Friendica Notification'), + '$title' => $this->l10n->t('Friendica Notification'), '$product' => FRIENDICA_PLATFORM, '$htmlversion' => $msgHtml, '$sitename' => $this->config->get('config', 'sitename'), - '$siteurl' => $this->baseUrl->get(true), + '$banner' => $this->config->get('system', 'email_banner', + $this->baseUrl->get(true) . DIRECTORY_SEPARATOR . self::DEFAULT_EMAIL_BANNER), ]); } diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index 19774b4255..9ccda33eeb 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -15,6 +15,7 @@ {{include file="field_input.tpl" field=$sitename}} {{include file="field_input.tpl" field=$sender_email}} {{include file="field_textarea.tpl" field=$banner}} + {{include file="field_input.tpl" field=$email_banner}} {{include file="field_input.tpl" field=$shortcut_icon}} {{include file="field_input.tpl" field=$touch_icon}} {{include file="field_textarea.tpl" field=$additional_info}} diff --git a/view/templates/email/html.tpl b/view/templates/email/html.tpl index 65af182c55..94e7271b90 100644 --- a/view/templates/email/html.tpl +++ b/view/templates/email/html.tpl @@ -1,7 +1,7 @@ - {{$banner}} + {{$title}} @@ -9,7 +9,7 @@ - +
{{$product}}