aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dfrn_notify.php
diff options
context:
space:
mode:
authorChris Case <kahotep@bunda.dreamhost.com>2011-05-21 19:27:56 -0700
committerChris Case <kahotep@bunda.dreamhost.com>2011-05-21 19:27:56 -0700
commit2cf696d0b5d647e1741d2f94ee379aa19b25ae1b (patch)
tree69f5be66affbc90b7060456174d8f91d2925a44a /mod/dfrn_notify.php
parentdfc05af73b784c5c16abf31b3df8ee07ec0201b7 (diff)
downloadvolse-hubzilla-2cf696d0b5d647e1741d2f94ee379aa19b25ae1b.tar.gz
volse-hubzilla-2cf696d0b5d647e1741d2f94ee379aa19b25ae1b.tar.bz2
volse-hubzilla-2cf696d0b5d647e1741d2f94ee379aa19b25ae1b.zip
image updates
Diffstat (limited to 'mod/dfrn_notify.php')
-rw-r--r--mod/dfrn_notify.php113
1 files changed, 112 insertions, 1 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index f447b5453..3ceb4b3fc 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -374,6 +374,7 @@ 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');
$email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'],
@@ -387,6 +388,60 @@ function dfrn_notify_post(&$a) {
$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');
+ $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');
+ $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,
+ ));
+
+ // 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
+ );
+
}
}
xml_status(0);
@@ -449,7 +504,7 @@ function dfrn_notify_post(&$a) {
if(($datarray['type'] != 'activity') && ($importer['notify-flags'] & NOTIFY_COMMENT)) {
- $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
+ $myconv = q("SELECT `author-link`, `author-avatar` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
dbesc($parent_uri),
intval($importer['importer_uid'])
);
@@ -460,6 +515,7 @@ function dfrn_notify_post(&$a) {
continue;
require_once('bbcode.php');
$from = stripslashes($datarray['author-name']);
+ /*
$tpl = load_view_file('view/cmnt_received_eml.tpl');
$email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'],
@@ -474,6 +530,61 @@ function dfrn_notify_post(&$a) {
$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');
+ $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');
+ $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,
+ ));
+
+ // 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;
}
}