From: Tim Düsterhus
Date: Thu, 16 Jun 2016 14:47:15 +0000 (+0200)
Subject: Optionally move links to the bottom in text/plain emails
X-Git-Tag: 3.0.0_Beta_1~916^2~4
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=09e788e906fcc4ebf8799dde2d41a41643a0da3b;p=GitHub%2FWoltLab%2FWCF.git
Optionally move links to the bottom in text/plain emails
---
diff --git a/wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php b/wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php
index 7bef27c3f8..122025b641 100644
--- a/wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php
+++ b/wcfsetup/install/files/lib/system/email/mime/RecipientAwareTextMimePart.class.php
@@ -79,6 +79,24 @@ class RecipientAwareTextMimePart extends TextMimePart implements IRecipientAware
$result = $emogrifier->emogrify();
}
+ else if ($this->mimeType === 'text/plain') {
+ $counter = 1;
+ $urls = [];
+ $result = preg_replace_callback('~\[URL:(https?://[^\]\s]*)\]~', function ($matches) use (&$counter, &$urls) {
+ if (!isset($urls[$matches[1]])) {
+ $urls[$matches[1]] = $counter++;
+ }
+
+ return '['.$urls[$matches[1]].']';
+ }, $result);
+ $result = preg_replace_callback('/(\r?\n-- \r?\n|$)/', function ($matches) use ($urls) {
+ $list = '';
+ foreach ($urls as $url => $number) {
+ $list .= "\r\n[".$number."] ".$url;
+ }
+ return $list."\r\n".$matches[0];
+ }, $result, 1);
+ }
return $result;
}
diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml
index e7d0ccea51..a02262acdf 100644
--- a/wcfsetup/install/lang/de.xml
+++ b/wcfsetup/install/lang/de.xml
@@ -1806,11 +1806,9 @@ Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} unter System -> O
freigeschaltet. {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} die Funktionen {if LANGUAGE_USE_INFORMAL_VARIANT}deines{else}Ihres{/if} Benutzerkontos nun in vollem Umfang nutzen.
]]>
- getUser()->username},
-{if LANGUAGE_USE_INFORMAL_VARIANT}Ihr{else}Dein{/if} Benutzerkonto auf der Website: {@PAGE_TITLE|language} [1] wurde von
+{if LANGUAGE_USE_INFORMAL_VARIANT}Ihr{else}Dein{/if} Benutzerkonto auf der Website: {@PAGE_TITLE|language} [URL:{link}{/link}] wurde von
einem Administrator freigeschaltet. {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} die Funktionen {if LANGUAGE_USE_INFORMAL_VARIANT}deines{else}Ihres{/if}
-Benutzerkontos nun in vollem Umfang nutzen.
-
-[1] {link}{/link}]]>
+Benutzerkontos nun in vollem Umfang nutzen.]]>
@@ -3048,7 +3046,7 @@ unter: {MAIL_ADMIN_ADDRESS}. Wenn {if
dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese E-Mail ignorieren.]]>
- getUser()->username},
-vielen Dank für {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Registrierung auf der Website: {@PAGE_TITLE|language} [1].
+vielen Dank für {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Registrierung auf der Website: {@PAGE_TITLE|language} [URL:{link}{/link}].
Bevor {if LANGUAGE_USE_INFORMAL_VARIANT}du dein{else}Sie Ihr{/if} Benutzerkonto vollständig verwenden {if LANGUAGE_USE_INFORMAL_VARIANT}kannst{else}können{/if} ist es notwendig,
dass Sie einmalig durch Klicken des Folgenden Links die Gültigkeit {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if}
E-Mail-Adresse {if LANGUAGE_USE_INFORMAL_VARIANT}bestätigst{else}bestätigen{/if}:
@@ -3061,9 +3059,7 @@ Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} Probleme mit der Aktivie
dich{else}wenden
Sie sich{/if} bitte an den Administrator unter: {@MAIL_ADMIN_ADDRESS}. Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du
dich{else}Sie
-sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese E-Mail ignorieren.
-
-[1] {link}{/link}]]>
+sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese E-Mail ignorieren.]]>
- username}. Ihre Registrierung ist hiermit vollständig abgeschlossen.]]>
diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml
index dbbd6aa3e0..5e38e1100a 100644
--- a/wcfsetup/install/lang/en.xml
+++ b/wcfsetup/install/lang/en.xml
@@ -1779,11 +1779,9 @@ Login with your new password: {link controller='Login' isEmail=true}{/link}]]>
by an administrator. You are now able to use your user account to itâs full extend.]]>
- getUser()->username},
-your account on the website: {@PAGE_TITLE|language} [1] has been approved
+your account on the website: {@PAGE_TITLE|language} [URL:{link}{/link}] has been approved
by an administrator. You are now able to use your user account to itâs
-full extend.
-
-[1] {link}{/link}]]>
+full extend.]]>
@@ -3086,7 +3084,7 @@ user account to itâs full extent it is required that you confirm validity of y
you did not register an account with us.]]>
- getUser()->username},
-thank your for registering at: {@PAGE_TITLE|language} [1]. Before you are
+thank your for registering at: {@PAGE_TITLE|language} [URL:{link}{/link}]. Before you are
able to user your user account to it's full extent it is required that you
confirm the validity of your email address once:
@@ -3096,9 +3094,7 @@ Your activation code is: {@$mailbox->getUser()->activationCode} {* this line end
If you have troubles confirming your email address, please contect the
administrator at: {@MAIL_ADMIN_ADDRESS}. Please ignore this email if you did
-not register with us.
-
-[1] {link}{/link}]]>
+not register with us.]]>
- username}.