From 2cf696d0b5d647e1741d2f94ee379aa19b25ae1b Mon Sep 17 00:00:00 2001 From: Chris Case Date: Sat, 21 May 2011 19:27:56 -0700 Subject: image updates --- mod/item.php | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 1 deletion(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index 5989d0967..ad3298592 100644 --- a/mod/item.php +++ b/mod/item.php @@ -408,6 +408,7 @@ 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'); $email_tpl = replace_macros($tpl, array( '$sitename' => $a->config['sitename'], @@ -420,7 +421,60 @@ function item_post(&$a) { )); $res = mail($user['email'], $from . t(" commented on your item at ") . $a->config['sitename'], - $email_tpl,t("From: Administrator@") . $a->get_hostname() ); + $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"), "
\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 + '$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'); + $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, + )); + + // 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 { @@ -431,6 +485,7 @@ function item_post(&$a) { 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'); $email_tpl = replace_macros($tpl, array( '$sitename' => $a->config['sitename'], @@ -444,6 +499,59 @@ function item_post(&$a) { $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"), "
\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, + )); + + // 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 + ); } } -- cgit v1.2.3 From f4cb6b9b08f6dc392b1f008f0aa9e9181f9e8b21 Mon Sep 17 00:00:00 2001 From: Chris Case Date: Sat, 21 May 2011 23:19:50 -0700 Subject: fixed a couple of bugs --- mod/item.php | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index 0b5e32e88..8c9e004c3 100644 --- a/mod/item.php +++ b/mod/item.php @@ -485,12 +485,12 @@ function item_post(&$a) { $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 + '$thumb' => $author['thumb'], // 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 + '$url' => $author['url'], // 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, + '$display' => $a->get_baseurl() . '/display/' . $author['nick'] . '/' . $post_id, )); // load the template for private message notifications @@ -498,12 +498,12 @@ function item_post(&$a) { $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 + '$thumb' => $author['thumb'], // 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 + '$url' => $author['url'], // 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, + '$display' => $a->get_baseurl() . '/display/' . $author['nick'] . '/' . $post_id, )); // use the EmailNotification library to send the message @@ -548,11 +548,11 @@ function item_post(&$a) { $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 + '$thumb' => $author['thumb'], // thumbnail url for sender icon + '$url' => $author['url'], // 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, + '$display' => $a->get_baseurl() . '/display/' . $author['nick'] . '/' . $post_id, )); // load the template for private message notifications @@ -560,11 +560,11 @@ function item_post(&$a) { $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 + '$thumb' => $author['thumb'], // thumbnail url for sender icon + '$url' => $author['url'], // 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, + '$display' => $a->get_baseurl() . '/display/' . $author['nick'] . '/' . $post_id, )); // use the EmailNotification library to send the message @@ -589,6 +589,9 @@ function item_post(&$a) { dbesc(datetime_convert()), intval($post_id) ); + foreach( $r as $key => $val) { + logger("key: " . $key . " val: " . $val); + } // photo comments turn the corresponding item visible to the profile wall // This way we don't see every picture in your new photo album posted to your wall at once. -- cgit v1.2.3