From 5eebb373e5ac761ba0f2020a85fa6db7544f7229 Mon Sep 17 00:00:00 2001 From: Chris Case Date: Mon, 14 Feb 2011 03:59:54 -0800 Subject: [PATCH] revamped private message templates, added multipart messages with text and html versions, updated de, en, fr and it. Translated the french version of the private message template. --- mod/dfrn_notify.php | 40 ++++++++++++++++++++++----- view/de/mail_received_eml.tpl | 48 ++++++++++++++++++++++++++------ view/en/mail_received_eml.tpl | 30 +++++++++++++++++--- view/fr/mail_received_eml.tpl | 52 +++++++++++++++++++++++++++-------- view/it/mail_received_eml.tpl | 48 ++++++++++++++++++++++++++------ 5 files changed, 178 insertions(+), 40 deletions(-) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 49276647ae..ffd9020c59 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -181,8 +181,28 @@ function dfrn_notify_post(&$a) { else $body = qp($body);*/ - $msg['body'] = str_replace(array("\\r\\n", "\\r", "\\n"), "
", $msg['body']); - $msg['body'] = html_entity_decode(strip_tags(bbcode($msg['body']))); + //$msg['body'] = str_replace(array("\\r\\n", "\\r", "\\n"), "
", $msg['body']); + //$msg['body'] = html_entity_decode(strip_tags(bbcode($msg['body']))); + $msg['mimeboundary'] =rand(0,9)."-" + .rand(10000000000,9999999999)."-" + .rand(10000000000,9999999999)."=:" + .rand(10000,99999); + + $msg['notificationfromname'] = t('Administrator'); + $msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname(); + $msg['headers'] = + "From: {$msg['notificationfromname']} <{$msg['notificationfromemail']}>\n" . + "Reply-To: {$msg['notificationfromemail']}\n" . + "MIME-Version: 1.0\n" . + "Content-Type: multipart/alternative; boundary=\"{$msg['mimeboundary']}\""; + + + $msg['textversion'] + = html_entity_decode(strip_tags(bbcode(stripslashes($msg['body']))),ENT_QUOTES,'UTF-8'); + //$TextMessage = html_entity_decode(strip_tags(bbcode(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",$msg['body'])))); ; + $msg['htmlversion'] + = str_replace(array("\\r\\n", "\\r", "\\n"), "
\n",html_entity_decode($msg['body'])); + $tpl = load_view_file('view/mail_received_eml.tpl'); $email_tpl = replace_macros($tpl, array( '$siteName' => $a->config['sitename'], @@ -194,16 +214,22 @@ function dfrn_notify_post(&$a) { '$senderName' => $importer['senderName'], '$from' => $msg['from-name'], '$title' => stripslashes($msg['title']), - '$body' => $msg['body'], + '$textversion' => $msg['textversion'], + '$htmlversion' => $msg['htmlversion'], + '$mimeboundary' => $msg['mimeboundary'], '$hostname' => $a->get_hostname() )); + logger("message headers: " . $msg['headers']); + logger("message body: " . $mail_tpl); + + $res = mail($importer['email'], t('New mail received at ') . $a->config['sitename'], - $email_tpl, - 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n" + $email_tpl, $msg['headers'] + /* 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" - . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" - . 'Content-transfer-encoding: 7-bit' . "\r\n" + . 'Content-type: text/html; charset=utf-8' . "\r\n" + . 'Content-transfer-encoding: quoted-printable' . "\r\n" */ ); } xml_status(0); diff --git a/view/de/mail_received_eml.tpl b/view/de/mail_received_eml.tpl index 466d31e793..174aa4f976 100644 --- a/view/de/mail_received_eml.tpl +++ b/view/de/mail_received_eml.tpl @@ -1,17 +1,47 @@ +--$mimeboundary +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit -Lieber $username, - -du hast eine neue private Nachricht von '$from' auf '$sitename' erhhalten. ------ +Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten. + $title ------ -$body ------ + +$textversion + Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu beantworten. Viele Grüße, - $sitename Administrator +$siteName Administrator - +--$mimeboundary +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: 8bit + + + + + Friendika Nachricht + + + + + + + + + + + + + + + + + +
Friendika
Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten.
$from
$title
$htmlversion
Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu beantworten.
Viele Grüße,
$siteName Administrator
+ + + +--$mimeboundary-- \ No newline at end of file diff --git a/view/en/mail_received_eml.tpl b/view/en/mail_received_eml.tpl index 5109785829..68df07c3d0 100644 --- a/view/en/mail_received_eml.tpl +++ b/view/en/mail_received_eml.tpl @@ -1,3 +1,22 @@ +--$mimeboundary +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +$from sent you a new private message at $siteName. + +$title + +$textversion + +Please login at $siteurl to read and reply to your private messages. + +Thank you, +$siteName administrator + +--$mimeboundary +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: 8bit + @@ -15,11 +34,14 @@ $from $title - $body + $htmlversion Please login at $siteurl to read and reply to your private messages. - Thank you, - $siteName administrator + Thank You, + $siteName Administrator - \ No newline at end of file + + +--$mimeboundary-- + diff --git a/view/fr/mail_received_eml.tpl b/view/fr/mail_received_eml.tpl index 261aec4bed..972d141c3f 100644 --- a/view/fr/mail_received_eml.tpl +++ b/view/fr/mail_received_eml.tpl @@ -1,16 +1,46 @@ +--$mimeboundary +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit -Dear $username, - - You've received a new private message at $sitename from '$from'. ------ +$from t'a envoyŽ un message ˆ $siteName. + $title ------ -$body ------ -Please login at $siteurl to read and reply to your private messages. -Thank you, - $sitename administrator +$textversion - +Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs. +Merci, +$siteName Administrateur + +--$mimeboundary +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: 8bit + + + + + Friendika Message + + + + + + + + + + + + + + + + + + +
Friendika
$from t'a envoyŽ un message ˆ $siteName.
$from
$title
$htmlversion
Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs.
Merci,
$siteName Administrateur
+ + + +--$mimeboundary-- \ No newline at end of file diff --git a/view/it/mail_received_eml.tpl b/view/it/mail_received_eml.tpl index 137614ca42..c51917a884 100644 --- a/view/it/mail_received_eml.tpl +++ b/view/it/mail_received_eml.tpl @@ -1,16 +1,46 @@ +--$mimeboundary +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit -Caro/a $username, - - Hai ricevuto un nuovo messsaggio privato su $sitename da '$from'. ------ +Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'. + $title ------ -$body ------ + +$textversion + Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati. Grazie, - L'amministratore di $sitename +L'amministratore di $siteName - +--$mimeboundary +Content-Type: text/html; charset=utf-8 +Content-Transfer-Encoding: 8bit + + + + + Friendika Messsaggio + + + + + + + + + + + + + + + + + +
Friendika
Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'.
$from
$title
$htmlversion
Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati.
Grazie,
L'amministratore di $siteName
+ + + +--$mimeboundary-- \ No newline at end of file