]> git.mxchange.org Git - friendica.git/commitdiff
preserve utf-8 on notification emails
authorMike Macgirvin <mike@macgirvin.com>
Thu, 28 Oct 2010 23:05:09 +0000 (16:05 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Thu, 28 Oct 2010 23:05:09 +0000 (16:05 -0700)
boot.php
mod/dfrn_notify.php

index 1c74cc156f06bb6ec0beae5a401fe6a53988f605..07810a50eb4cfc3773337705dded272855a66532 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1295,4 +1295,18 @@ function activity_match($haystack,$needle) {
        if(($haystack === $needle) || (($basename($needle) === $haystack) && strstr($needle,NAMESPACE_ACTIVITY_SCHEMA)))
                return true;
        return false;
-}}
\ No newline at end of file
+}}
+
+
+if(! function_exists('get_tags')) {
+function get_tags($s) {
+       if(preg_match_all('/([@#][^ ,.:?\-]*)[ ,.:?\-]/',$s,$match))
+               return $match[1];
+}}
+
+
+if(! function_exists('qp')) {
+function qp($s) {
+return str_replace ("%","=",rawurlencode($s));
+}} 
+
index fc609ddc080ee4aad84af6105287a4183d0c14f1..630af83981b2fc78f85477453ec6ba63df5fd885 100644 (file)
@@ -111,8 +111,18 @@ function dfrn_notify_post(&$a) {
 
                // send email notification if requested.
 
+               $body = html_entity
+
                require_once('bbcode.php');
                if($importer['notify-flags'] & NOTIFY_MAIL) {
+
+                       $body = html_entity_decode(strip_tags(bbcode(stripslashes($msg['body']))),ENT_QUOTES,'UTF-8');
+
+                       if(function_exists('quoted_printable_encode'))
+                               $body = quoted_printable_encode($body);
+                       else
+                               $body = qp($body);
+
                        $tpl = load_view_file('view/mail_received_eml.tpl');                    
                        $email_tpl = replace_macros($tpl, array(
                                '$sitename' => $a->config['sitename'],
@@ -121,11 +131,15 @@ function dfrn_notify_post(&$a) {
                                '$email' => $importer['email'],
                                '$from' => $msg['from-name'],
                                '$title' => stripslashes($msg['title']),
-                               '$body' => strip_tags(bbcode(stripslashes($msg['body'])))
+                               '$body' => $body
                        ));
 
                        $res = mail($importer['email'], t('New mail received at ') . $a->config['sitename'],
-                               $email_tpl, 'From: ' . t('Administrator') . '@' . $a->get_hostname() );
+                               $email_tpl, 'From: ' . t('Administrator') . '@' . $a->get_hostname() . "\r\n"
+                                       . 'MIME-Version: 1.0' . "\r\n"
+                                       . 'Content-type: text/plain; charset=UTF-8' . "\r\n" 
+                                       . 'Content-transfer-encoding: quoted-printable' . "\r\n"
+                       );
                }
                xml_status(0);
                // NOTREACHED