From 3819cafdf98a496587b7b80f913b955650a0b449 Mon Sep 17 00:00:00 2001
From: furun <furun@arcor.de>
Date: Sun, 29 Mar 2015 14:16:49 +0200
Subject: [PATCH]  Cleanup of the mail text signature. #1088

mailwrap.html is back

@EMAILSIGNATURE@ added
---
 inc/Mailer.class.php               | 54 +++++++++++++++++-------------
 inc/lang/ar/mailwrap.html          |  2 +-
 inc/lang/bg/mailwrap.html          |  2 +-
 inc/lang/ca/mailwrap.html          |  2 +-
 inc/lang/cs/mailwrap.html          |  2 +-
 inc/lang/da/mailwrap.html          |  2 +-
 inc/lang/de-informal/mailwrap.html |  2 +-
 inc/lang/de/mailwrap.html          |  2 +-
 inc/lang/el/mailwrap.html          |  2 +-
 inc/lang/en/mailwrap.html          |  2 +-
 inc/lang/eo/mailwrap.html          |  2 +-
 inc/lang/es/mailwrap.html          |  2 +-
 inc/lang/eu/mailwrap.html          |  2 +-
 inc/lang/fa/mailwrap.html          |  5 ++-
 inc/lang/fi/mailwrap.html          |  2 +-
 inc/lang/fr/mailwrap.html          |  2 +-
 inc/lang/gl/mailwrap.html          |  2 +-
 inc/lang/hu/mailwrap.html          |  2 +-
 inc/lang/it/mailwrap.html          |  2 +-
 inc/lang/ja/mailwrap.html          |  2 +-
 inc/lang/ko/mailwrap.html          |  2 +-
 inc/lang/lv/mailwrap.html          |  2 +-
 inc/lang/nl/mailwrap.html          |  2 +-
 inc/lang/pl/mailwrap.html          |  2 +-
 inc/lang/pt-br/mailwrap.html       |  2 +-
 inc/lang/sk/mailwrap.html          |  2 +-
 inc/lang/sv/mailwrap.html          |  2 +-
 inc/lang/zh-tw/mailwrap.html       |  2 +-
 inc/lang/zh/mailwrap.html          |  2 +-
 29 files changed, 59 insertions(+), 54 deletions(-)

diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php
index 2fc728a6c..805b009ef 100644
--- a/inc/Mailer.class.php
+++ b/inc/Mailer.class.php
@@ -195,21 +195,24 @@ class Mailer {
         $htmlrep = (array)$htmlrep;
         $textrep = (array)$textrep;
 
-        $text = trim($text);
-
         // create HTML from text if not given
         if(is_null($html)) {
             $html = $text;
             $html = hsc($html);
             $html = preg_replace('/^----+$/m', '<hr >', $html);
             $html = nl2br($html);
-            $html .= '<br /><br /><br /><br /><hr /><small>' . $lang['email_signature'] . ':<br />@DOKUWIKIURL@</small>';
         }
         if($wrap) {
-            $html = '<html><head><title>' . hsc($conf['title']) . '</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>' . $html . '</body></html>';
+            $wrap = rawLocale('mailwrap', 'html');
+            $html = preg_replace('/\n-- <br \/>.*$/s', '', $html); //strip signature
+            $html = str_replace('@EMAILSIGNATURE@', '', $html); //strip @EMAILSIGNATURE@
+            $html = str_replace('@HTMLBODY@', $html, $wrap);
+        }
+
+        if(strpos($text, '@EMAILSIGNATURE@') === false) {
+            $text = rtrim($text);
+            $text .= "\n\n\n\n-- \n" . $lang['email_signature'] . ":\n@DOKUWIKIURL@\n";
         }
-		
-        $text .= "\n\n\n\n-- \n" . $lang['email_signature'] . ":\n@DOKUWIKIURL@\n";
 
         // copy over all replacements missing for HTML (autolink URLs)
         foreach($textrep as $key => $value) {
@@ -231,28 +234,31 @@ class Mailer {
         $ip   = clientIP();
         $cip  = gethostsbyaddrs($ip);
         $trep = array(
-            'DATE'        => dformat(),
-            'BROWSER'     => $INPUT->server->str('HTTP_USER_AGENT'),
-            'IPADDRESS'   => $ip,
-            'HOSTNAME'    => $cip,
-            'TITLE'       => $conf['title'],
-            'DOKUWIKIURL' => DOKU_URL,
-            'USER'        => $INPUT->server->str('REMOTE_USER'),
-            'NAME'        => $INFO['userinfo']['name'],
-            'MAIL'        => $INFO['userinfo']['mail'],
+            'DATE'           => dformat(),
+            'BROWSER'        => $INPUT->server->str('HTTP_USER_AGENT'),
+            'IPADDRESS'      => $ip,
+            'HOSTNAME'       => $cip,
+            'TITLE'          => $conf['title'],
+            'DOKUWIKIURL'    => DOKU_URL,
+            'USER'           => $INPUT->server->str('REMOTE_USER'),
+            'NAME'           => $INFO['userinfo']['name'],
+            'MAIL'           => $INFO['userinfo']['mail'],
+            'EMAILSIGNATURE' => "\n-- \n".$lang['email_signature'].":\n".DOKU_URL."\n",
         );
         $trep = array_merge($trep, (array)$textrep);
         $hrep = array(
-            'DATE'        => '<i>'.hsc(dformat()).'</i>',
-            'BROWSER'     => hsc($INPUT->server->str('HTTP_USER_AGENT')),
-            'IPADDRESS'   => '<code>'.hsc($ip).'</code>',
-            'HOSTNAME'    => '<code>'.hsc($cip).'</code>',
-            'TITLE'       => hsc($conf['title']),
-            'DOKUWIKIURL' => '<a href="'.DOKU_URL.'">'.DOKU_URL.'</a>',
-            'USER'        => hsc($INPUT->server->str('REMOTE_USER')),
-            'NAME'        => hsc($INFO['userinfo']['name']),
-            'MAIL'        => '<a href="mailto:"'.hsc($INFO['userinfo']['mail']).'">'.
+            'DATE'           => '<i>'.hsc(dformat()).'</i>',
+            'BROWSER'        => hsc($INPUT->server->str('HTTP_USER_AGENT')),
+            'IPADDRESS'      => '<code>'.hsc($ip).'</code>',
+            'HOSTNAME'       => '<code>'.hsc($cip).'</code>',
+            'TITLE'          => hsc($conf['title']),
+            'DOKUWIKIURL'    => '<a href="'.DOKU_URL.'">'.DOKU_URL.'</a>',
+            'USER'           => hsc($INPUT->server->str('REMOTE_USER')),
+            'NAME'           => hsc($INFO['userinfo']['name']),
+            'MAIL'           => '<a href="mailto:"'.hsc($INFO['userinfo']['mail']).'">'.
                 hsc($INFO['userinfo']['mail']).'</a>',
+            'EMAILSIGNATURE' => hsc($lang['email_signature']).':<br />' .
+                '<a href="'.DOKU_URL.'">'.DOKU_URL.'</a>',
         );
         $hrep = array_merge($hrep, (array)$htmlrep);
 
diff --git a/inc/lang/ar/mailwrap.html b/inc/lang/ar/mailwrap.html
index 554e34510..d25719094 100644
--- a/inc/lang/ar/mailwrap.html
+++ b/inc/lang/ar/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>تم انشاء هذا البريد الالكتروني بواسطة  DokuWiki في @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/bg/mailwrap.html b/inc/lang/bg/mailwrap.html
index 26b0a1e6a..7df0cdce7 100644
--- a/inc/lang/bg/mailwrap.html
+++ b/inc/lang/bg/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Писмото е генерирано от DokuWiki на адрес @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
diff --git a/inc/lang/ca/mailwrap.html b/inc/lang/ca/mailwrap.html
index ed3bb6e9d..d25719094 100644
--- a/inc/lang/ca/mailwrap.html
+++ b/inc/lang/ca/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Aquest correu electrònic ha estat generat per DokuWiki a @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/cs/mailwrap.html b/inc/lang/cs/mailwrap.html
index dacd38d57..f15ec0664 100644
--- a/inc/lang/cs/mailwrap.html
+++ b/inc/lang/cs/mailwrap.html
@@ -8,6 +8,6 @@
  @HTMLBODY@
 
  <br /><hr />
- <small>Tento mail byl vygenerován systémem DokuWiki na adrese @DOKUWIKIURL@.</small>
+ <small>@EMAILSIGNATURE@</small>
  </body>
  </html>
\ No newline at end of file
diff --git a/inc/lang/da/mailwrap.html b/inc/lang/da/mailwrap.html
index 0eb2e0bce..d25719094 100644
--- a/inc/lang/da/mailwrap.html
+++ b/inc/lang/da/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Denne mail blev sendt af DokuWiki på @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/de-informal/mailwrap.html b/inc/lang/de-informal/mailwrap.html
index 420fdf83e..7df0cdce7 100644
--- a/inc/lang/de-informal/mailwrap.html
+++ b/inc/lang/de-informal/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Diese Mail kommt vom DokuWiki auf @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
diff --git a/inc/lang/de/mailwrap.html b/inc/lang/de/mailwrap.html
index 420fdf83e..7df0cdce7 100644
--- a/inc/lang/de/mailwrap.html
+++ b/inc/lang/de/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Diese Mail kommt vom DokuWiki auf @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
diff --git a/inc/lang/el/mailwrap.html b/inc/lang/el/mailwrap.html
index b2e655789..d25719094 100644
--- a/inc/lang/el/mailwrap.html
+++ b/inc/lang/el/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Το email έχει δημιουργηθεί από το DokuWiki στις @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/en/mailwrap.html b/inc/lang/en/mailwrap.html
index f9f80fd80..7df0cdce7 100644
--- a/inc/lang/en/mailwrap.html
+++ b/inc/lang/en/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>This mail was generated by DokuWiki at @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
diff --git a/inc/lang/eo/mailwrap.html b/inc/lang/eo/mailwrap.html
index 9e92a00f7..d25719094 100644
--- a/inc/lang/eo/mailwrap.html
+++ b/inc/lang/eo/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Tiu retpoŝtaĵo venas de DokuWiki ĉe @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/es/mailwrap.html b/inc/lang/es/mailwrap.html
index 3cf255f79..d25719094 100644
--- a/inc/lang/es/mailwrap.html
+++ b/inc/lang/es/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Este correo ha sido generado por DokuWiki desde @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/eu/mailwrap.html b/inc/lang/eu/mailwrap.html
index 0cf92c28b..d25719094 100644
--- a/inc/lang/eu/mailwrap.html
+++ b/inc/lang/eu/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Mezu elektroniko hau DokuWiki-k sortua da @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/fa/mailwrap.html b/inc/lang/fa/mailwrap.html
index c313c0bf6..d25719094 100644
--- a/inc/lang/fa/mailwrap.html
+++ b/inc/lang/fa/mailwrap.html
@@ -1,4 +1,4 @@
-	<html>
+<html>
 <head>
 <title>@TITLE@</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -8,7 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>This mail was generated by DokuWiki at @DOKUWIKIURL@.</small>
-<small> این ایمیل توسط DokuWiki at @DOKUWIKIURL@ تولید شده است. </small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/fi/mailwrap.html b/inc/lang/fi/mailwrap.html
index 6ff63c04e..d25719094 100644
--- a/inc/lang/fi/mailwrap.html
+++ b/inc/lang/fi/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Tämä viesti on tehty DokuWiki:ssä  @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/fr/mailwrap.html b/inc/lang/fr/mailwrap.html
index aa5011021..d25719094 100644
--- a/inc/lang/fr/mailwrap.html
+++ b/inc/lang/fr/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Ce courriel a été automatiquement généré par DokuWiki depuis @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/gl/mailwrap.html b/inc/lang/gl/mailwrap.html
index 19927c117..d25719094 100644
--- a/inc/lang/gl/mailwrap.html
+++ b/inc/lang/gl/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Este correo era xerado por DokuWiki en @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/hu/mailwrap.html b/inc/lang/hu/mailwrap.html
index 50fc497fd..d25719094 100644
--- a/inc/lang/hu/mailwrap.html
+++ b/inc/lang/hu/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Ezt a levelet a @DOKUWIKIURL@ DokuWiki generálta.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/it/mailwrap.html b/inc/lang/it/mailwrap.html
index 24a2bc8a9..d25719094 100644
--- a/inc/lang/it/mailwrap.html
+++ b/inc/lang/it/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Questa email è stata generata da DokuWiki presso @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/ja/mailwrap.html b/inc/lang/ja/mailwrap.html
index a9dd41480..d25719094 100644
--- a/inc/lang/ja/mailwrap.html
+++ b/inc/lang/ja/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>このメールは次の DokuWiki によって生成されました: <br /> @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/ko/mailwrap.html b/inc/lang/ko/mailwrap.html
index ef061f10f..7df0cdce7 100644
--- a/inc/lang/ko/mailwrap.html
+++ b/inc/lang/ko/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
diff --git a/inc/lang/lv/mailwrap.html b/inc/lang/lv/mailwrap.html
index 34b723901..d25719094 100644
--- a/inc/lang/lv/mailwrap.html
+++ b/inc/lang/lv/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Šo vēstuli nosūtījusi programma DokuWiki no vietnes @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/nl/mailwrap.html b/inc/lang/nl/mailwrap.html
index 2ffe19a88..f15ec0664 100644
--- a/inc/lang/nl/mailwrap.html
+++ b/inc/lang/nl/mailwrap.html
@@ -8,6 +8,6 @@
  @HTMLBODY@
 
  <br /><hr />
- <small>Deze mail is gegenereerd door DokuWiki op @DOKUWIKIURL@.</small>
+ <small>@EMAILSIGNATURE@</small>
  </body>
  </html>
\ No newline at end of file
diff --git a/inc/lang/pl/mailwrap.html b/inc/lang/pl/mailwrap.html
index 61772866e..d25719094 100644
--- a/inc/lang/pl/mailwrap.html
+++ b/inc/lang/pl/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Ta wiadomość została wygenerowana przez DokuWiki na @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/pt-br/mailwrap.html b/inc/lang/pt-br/mailwrap.html
index 80bea7a22..d25719094 100644
--- a/inc/lang/pt-br/mailwrap.html
+++ b/inc/lang/pt-br/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Esta mensagem foi gerada pelo DokuWiki em @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/sk/mailwrap.html b/inc/lang/sk/mailwrap.html
index 2e42515fb..d25719094 100644
--- a/inc/lang/sk/mailwrap.html
+++ b/inc/lang/sk/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Táto správa bola zaslaná DokuWiki @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/sv/mailwrap.html b/inc/lang/sv/mailwrap.html
index d8ab9ba5b..d25719094 100644
--- a/inc/lang/sv/mailwrap.html
+++ b/inc/lang/sv/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>Denna e-post har genererats av DokuWiki vid @DOKUWIKIURL@.</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/zh-tw/mailwrap.html b/inc/lang/zh-tw/mailwrap.html
index 9cd5faacd..d25719094 100644
--- a/inc/lang/zh-tw/mailwrap.html
+++ b/inc/lang/zh-tw/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>這郵件由DokuWiki at @DOKUWIKIURL@. 生成</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/inc/lang/zh/mailwrap.html b/inc/lang/zh/mailwrap.html
index 0f00d95b1..d25719094 100644
--- a/inc/lang/zh/mailwrap.html
+++ b/inc/lang/zh/mailwrap.html
@@ -8,6 +8,6 @@
 @HTMLBODY@
 
 <br /><hr />
-<small>本邮件由位于 @DOKUWIKIURL@ 的 Dokuwiki 自动创建。</small>
+<small>@EMAILSIGNATURE@</small>
 </body>
 </html>
\ No newline at end of file
-- 
GitLab