]> git.mxchange.org Git - friendica.git/commitdiff
merged multipart email changes
authorChris Case <kahotep@bunda.dreamhost.com>
Sun, 22 May 2011 04:40:16 +0000 (21:40 -0700)
committerChris Case <kahotep@bunda.dreamhost.com>
Sun, 22 May 2011 04:40:16 +0000 (21:40 -0700)
1  2 
mod/dfrn_notify.php
mod/item.php

index 3ceb4b3fcc7e1433d0bdda282d5110e8db756b5e,9ea9803385de82e046677178baffa492571406d0..6709ed27551d4a29b7a8f2cc07efc27d79e3438f
@@@ -374,73 -389,22 +389,59 @@@ function dfrn_notify_post(&$a) 
                                                if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
                                                        require_once('bbcode.php');
                                                        $from = stripslashes($datarray['author-name']);
-                                                       /*
-                                                       $tpl = load_view_file('view/cmnt_received_eml.tpl');                    
 -                                                      $tpl = get_intltext_template('cmnt_received_eml.tpl');                  
--                                                      $email_tpl = replace_macros($tpl, array(
--                                                              '$sitename' => $a->config['sitename'],
--                                                              '$siteurl' =>  $a->get_baseurl(),
--                                                              '$username' => $importer['username'],
--                                                              '$email' => $importer['email'],
--                                                              '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, 
--                                                              '$from' => $from,
--                                                              '$body' => html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8')
-                                                       ));
-       
-                                                       $res = mail($importer['email'], $from . t(' commented on an item at ') . $a->config['sitename'],
-                                                               $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
-                                                       */
++
 +                                                      // name of the automated email sender
 +                                                      $msg['notificationfromname']    = stripslashes($datarray['author-name']);;
 +                                                      // noreply address to send from
 +                                                      $msg['notificationfromemail']   = t('noreply') . '@' . $a->get_hostname();                              
 +
 +                                                      // text version
 +                                                      // process the message body to display properly in text mode
 +                                                      $msg['textversion']
 +                                                              = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
 +                              
 +                                                      // html version
 +                                                      // process the message body to display properly in text mode
 +                                                      $msg['htmlversion']     
 +                                                              = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
 +
 +                                                      // load the template for private message notifications
-                                                       $tpl = load_view_file('view/cmnt_received_html_body_eml.tpl');
++                                                      $tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
 +                                                      $email_html_body_tpl = replace_macros($tpl,array(
 +                                                              '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                                              '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                                              '$thumb'                => $datarray['author-avatar'],                  // thumbnail url for sender icon
 +                                                              '$email'                => $importer['email'],                                  // email address to send to
 +                                                              '$url'                  => $datarray['author-link'],                    // full url for the site
 +                                                              '$from'                 => $from,                                                               // name of the person sending the message
 +                                                              '$body'                 => 'q1' .$msg['htmlversion'],                                   // html version of the message
 +                                                              '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
 +                                                      ));
 +                      
 +                                                      // load the template for private message notifications
-                                                       $tpl = load_view_file('view/cmnt_received_text_body_eml.tpl');
++                                                      $tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
 +                                                      $email_text_body_tpl = replace_macros($tpl,array(
 +                                                              '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                                              '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                                              '$thumb'                => $datarray['author-avatar'],                  // thumbnail url for sender icon
 +                                                              '$email'                => $importer['email'],                                  // email address to send to
 +                                                              '$url'                  => $datarray['author-link'],                    // full url for the site
 +                                                              '$from'                 => $from,                                                               // name of the person sending the message
 +                                                              '$body'                 => $msg['textversion'],                                 // text version of the message
 +                                                              '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
                                                        ));
 -      
 -                                                      $res = mail($importer['email'], sprintf(t('%s commented on an item at %s'), $from , $a->config['sitename']),
 -                                                              $email_tpl, 
 -                                                              'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
 -                                                              . 'Content-type: text/plain; charset=UTF-8' . "\n"
 -                                                              . 'Content-transfer-encoding: 8bit' );
 +
 +                                                      // use the EmailNotification library to send the message
 +                                                      require_once("include/EmailNotification.php");
 +                                                      EmailNotification::sendTextHtmlEmail(
 +                                                              $msg['notificationfromname'],
 +                                                              t("Administrator@") . $a->get_hostname(),
 +                                                              t("noreply") . '@' . $a->get_hostname(),
 +                                                              $importer['email'],
 +                                                              $from . t(" commented on an item at ") . $a->config['sitename'],
 +                                                              $email_html_body_tpl,
 +                                                              $email_text_body_tpl
 +                                                      );
  
                                                }
                                        }
                                                                continue;
                                                        require_once('bbcode.php');
                                                        $from = stripslashes($datarray['author-name']);
-                                                       /*
-                                                       $tpl = load_view_file('view/cmnt_received_eml.tpl');    
 -                                                      $tpl = get_intltext_template('cmnt_received_eml.tpl');  
--                                                      $email_tpl = replace_macros($tpl, array(
--                                                              '$sitename' => $a->config['sitename'],
--                                                              '$siteurl' =>  $a->get_baseurl(),
--                                                              '$username' => $importer['username'],
--                                                              '$email' => $importer['email'],
--                                                              '$from' => $from,
--                                                              '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
--                                                              '$body' => html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8')
-                                                       ));
-                                                       $res = mail($importer['email'], $from . t(" commented on an item at ") 
-                                                               . $a->config['sitename'],
-                                                               $email_tpl,t("From: Administrator@") . $a->get_hostname() );
-                                                       */      
-                                                       
-                                                               
 +                                                      
 +                                                      // name of the automated email sender
 +                                                      $msg['notificationfromname']    = stripslashes($datarray['author-name']);;
 +                                                      // noreply address to send from
 +                                                      $msg['notificationfromemail']   = t('noreply') . '@' . $a->get_hostname();                              
 +
 +                                                      // text version
 +                                                      // process the message body to display properly in text mode
 +                                                      $msg['textversion']
 +                                                              = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
 +                              
 +                                                      // html version
 +                                                      // process the message body to display properly in text mode
 +                                                      $msg['htmlversion']     
 +                                                              = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
 +
 +                                                      // load the template for private message notifications
-                                                       $tpl = load_view_file('view/cmnt_received_html_body_eml.tpl');
++                                                      $tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
 +                                                      $email_html_body_tpl = replace_macros($tpl,array(
 +                                                              '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                                              '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                                              '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                                              '$url'                  => $conv['author-link'],                                // full url for the site
 +                                                              '$from'                 => $from,                                                               // name of the person sending the message
 +                                                              '$body'                 => $msg['htmlversion'],                                 // html version of the message
 +                                                              '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
 +                                                      ));
 +                      
 +                                                      // load the template for private message notifications
-                                                       $tpl = load_view_file('view/cmnt_received_text_body_eml.tpl');
++                                                      $tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
 +                                                      $email_text_body_tpl = replace_macros($tpl,array(
 +                                                              '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                                              '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                                              '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                                              '$url'                  => $conv['author-link'],                                // full url for the site
 +                                                              '$from'                 => $from,                                                               // name of the person sending the message
 +                                                              '$body'                 => $msg['textversion'],                                 // text version of the message
 +                                                              '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
                                                        ));
  
 -                                                      $res = mail($importer['email'], sprintf( t("%s commented on an item at %s") , $from ,$a->config['sitename']),
 -                                                              $email_tpl, 
 -                                                              'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
 -                                                              . 'Content-type: text/plain; charset=UTF-8' . "\n"
 -                                                              . 'Content-transfer-encoding: 8bit' );
 +                                                      // use the EmailNotification library to send the message
 +                                                      require_once("include/EmailNotification.php");
 +                                                      EmailNotification::sendTextHtmlEmail(
 +                                                              $msg['notificationfromname'],
 +                                                              t("Administrator@") . $a->get_hostname(),
 +                                                              t("noreply") . '@' . $a->get_hostname(),
 +                                                              $importer['email'],
 +                                                              $from . t(" commented on an item at ") . $a->config['sitename'],
 +                                                              $email_html_body_tpl,
 +                                                              $email_text_body_tpl
 +                                                      );
  
                                                        break;
                                                }
diff --cc mod/item.php
index ad32985921fd71dac5f976aec71554b186dbea1e,62899868e7f788848d9215a292cd558b7052b65c..0b5e32e8886565743a46e37e171efff855f4be16
@@@ -408,73 -464,22 +464,59 @@@ function item_post(&$a) 
                        if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) {
                                require_once('bbcode.php');
                                $from = $author['name'];
-                               /*
-                               $tpl = load_view_file('view/cmnt_received_eml.tpl');                    
 -                              $tpl = get_intltext_template('cmnt_received_eml.tpl');                  
--                              $email_tpl = replace_macros($tpl, array(
--                                      '$sitename' => $a->config['sitename'],
--                                      '$siteurl' =>  $a->get_baseurl(),
--                                      '$username' => $user['username'],
--                                      '$email' => $user['email'],
--                                      '$from' => $from,
--                                      '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
--                                      '$body' => strip_tags(bbcode($datarray['body']))
-                               ));
 +
-                               $res = mail($user['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );    
-                               */
 +                              // name of the automated email sender
 +                              $msg['notificationfromname']    = stripslashes($datarray['author-name']);;
 +                              // noreply address to send from
 +                              $msg['notificationfromemail']   = t('noreply') . '@' . $a->get_hostname();                              
 +
 +                              // text version
 +                              // process the message body to display properly in text mode
 +                              $msg['textversion']
 +                                      = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
 +                              
 +                              // html version
 +                              // process the message body to display properly in text mode
 +                              $msg['htmlversion']     
 +                                      = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
 +
 +                              // load the template for private message notifications
-                               $tpl = load_view_file('view/cmnt_received_html_body_eml.tpl');
++                              $tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
 +                              $email_html_body_tpl = replace_macros($tpl,array(
 +                                      '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                      '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                      '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                      '$email'                => $importer['email'],                                  // email address to send to
 +                                      '$url'                  => $conv['author-link'],                                // full url for the site
 +                                      '$from'                 => $from,                                                               // name of the person sending the message
 +                                      '$body'                 => $msg['htmlversion'],                                 // html version of the message
 +                                      '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
 +                              ));
 +                      
 +                              // load the template for private message notifications
-                               $tpl = load_view_file('view/cmnt_received_text_body_eml.tpl');
++                              $tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
 +                              $email_text_body_tpl = replace_macros($tpl,array(
 +                                      '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                      '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                      '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                      '$email'                => $importer['email'],                                  // email address to send to
 +                                      '$url'                  => $conv['author-link'],                                // full url for the site
 +                                      '$from'                 => $from,                                                               // name of the person sending the message
 +                                      '$body'                 => $msg['textversion'],                                 // text version of the message
 +                                      '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
                                ));
  
 -                              $res = mail($user['email'], sprintf( t("%s commented on your item at %s") ,$from,$a->config['sitename']),
 -                                      $email_tpl,
 -                                      'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
 -                                      . 'Content-type: text/plain; charset=UTF-8' . "\n"
 -                                      . 'Content-transfer-encoding: 8bit' );
 +                              // use the EmailNotification library to send the message
 +                              require_once("include/EmailNotification.php");
 +                              EmailNotification::sendTextHtmlEmail(
 +                                      $msg['notificationfromname'],
 +                                      t("Administrator@") . $a->get_hostname(),
 +                                      t("noreply") . '@' . $a->get_hostname(),
 +                                      $user['email'],
 +                                      $from . t(" commented on an item at ") . $a->config['sitename'],
 +                                      $email_html_body_tpl,
 +                                      $email_text_body_tpl
 +                              );
                        }
                }
                else {
                        if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) {
                                require_once('bbcode.php');
                                $from = $author['name'];
-                               /*
-                               $tpl = load_view_file('view/wall_received_eml.tpl');                    
 -                              $tpl = get_intltext_template('wall_received_eml.tpl');                  
--                              $email_tpl = replace_macros($tpl, array(
--                                      '$sitename' => $a->config['sitename'],
--                                      '$siteurl' =>  $a->get_baseurl(),
--                                      '$username' => $user['username'],
--                                      '$email' => $user['email'],
--                                      '$from' => $from,
--                                      '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
--                                      '$body' => strip_tags(bbcode($datarray['body']))
-                               ));
-                               $res = mail($user['email'], $from . t(" posted on your profile wall at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );
-                               */
-                                                                                               
 +                                                      
 +                              // name of the automated email sender
 +                              $msg['notificationfromname']    = $from;
 +                              // noreply address to send from
 +                              $msg['notificationfromemail']   = t('noreply') . '@' . $a->get_hostname();                              
 +
 +                              // text version
 +                              // process the message body to display properly in text mode
 +                              $msg['textversion']
 +                                      = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
 +                              
 +                              // html version
 +                              // process the message body to display properly in text mode
 +                              $msg['htmlversion']     
 +                                      = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
 +
 +                              // load the template for private message notifications
 +                              $tpl = load_view_file('view/wall_received_html_body_eml.tpl');
 +                              $email_html_body_tpl = replace_macros($tpl,array(
 +                                      '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                      '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                      '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                      '$url'                  => $conv['author-link'],                                // full url for the site
 +                                      '$from'                 => $from,                                                               // name of the person sending the message
 +                                      '$body'                 => $msg['htmlversion'],                                 // html version of the message
 +                                      '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
 +                              ));
 +                      
 +                              // load the template for private message notifications
 +                              $tpl = load_view_file('view/wall_received_text_body_eml.tpl');
 +                              $email_text_body_tpl = replace_macros($tpl,array(
 +                                      '$sitename'             => $a->config['sitename'],                              // name of this site
 +                                      '$siteurl'              => $a->get_baseurl(),                                   // descriptive url of this site
 +                                      '$thumb'                => $conv['author-avatar'],                              // thumbnail url for sender icon
 +                                      '$url'                  => $conv['author-link'],                                // full url for the site
 +                                      '$from'                 => $from,                                                               // name of the person sending the message
 +                                      '$body'                 => $msg['textversion'],                                 // text version of the message
 +                                      '$display'              => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $r,
                                ));
  
 -                              $res = mail($user['email'], sprintf( t("%s posted on your profile wall at %s") ,$from, $a->config['sitename']),
 -                                      $email_tpl,
 -                                      'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
 -                                      . 'Content-type: text/plain; charset=UTF-8' . "\n"
 -                                      . 'Content-transfer-encoding: 8bit' );
 -
 +                              // use the EmailNotification library to send the message
 +                              require_once("include/EmailNotification.php");
 +                              EmailNotification::sendTextHtmlEmail(
 +                                      $msg['notificationfromname'],
 +                                      t("Administrator@") . $a->get_hostname(),
 +                                      t("noreply") . '@' . $a->get_hostname(),
 +                                      $user['email'],
 +                                      $from . t(" commented on an item at ") . $a->config['sitename'],
 +                                      $email_html_body_tpl,
 +                                      $email_text_body_tpl
 +                              );
                        }
                }
  
@@@ -726,4 -682,4 +753,4 @@@ function item_content(&$a) 
                        //NOTREACHED
                }
        }
--}
++}