migrate more notifications
This commit is contained in:
parent
c735582ead
commit
a76be1934a
3 changed files with 31 additions and 121 deletions
2
boot.php
2
boot.php
|
@ -9,7 +9,7 @@ require_once('include/nav.php');
|
||||||
require_once('include/cache.php');
|
require_once('include/cache.php');
|
||||||
|
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1209' );
|
define ( 'FRIENDICA_VERSION', '2.3.1210' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1112 );
|
define ( 'DB_UPDATE_VERSION', 1112 );
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ function notification($params) {
|
||||||
|
|
||||||
if($params['type'] == NOTIFY_COMMENT) {
|
if($params['type'] == NOTIFY_COMMENT) {
|
||||||
|
|
||||||
$preamble = $subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename);
|
$subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename);
|
||||||
|
$preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']);
|
||||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||||
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
||||||
|
|
|
@ -2092,68 +2092,22 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","comment-import","$posted_id");
|
proc_run('php',"include/notifier.php","comment-import","$posted_id");
|
||||||
|
|
||||||
if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
if((! $is_like) && (! $importer['self'])) {
|
||||||
push_lang($importer['language']);
|
|
||||||
require_once('bbcode.php');
|
|
||||||
$from = stripslashes($datarray['author-name']);
|
|
||||||
|
|
||||||
// name of the automated email sender
|
notification(array(
|
||||||
$msg['notificationfromname'] = stripslashes($datarray['author-name']);;
|
'type' => NOTIFY_COMMENT,
|
||||||
// noreply address to send from
|
'notify_flags' => $importer['notify-flags'],
|
||||||
$msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
|
'language' => $importer['language'],
|
||||||
|
'to_name' => $importer['username'],
|
||||||
// text version
|
'to_email' => $importer['email'],
|
||||||
// process the message body to display properly in text mode
|
'item' => $datarray,
|
||||||
$msg['textversion']
|
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
||||||
= html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
|
'source_link' => $datarray['author-link'],
|
||||||
// html version
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
// process the message body to display properly in text mode
|
? $importer['thumb'] : $datarray['author-avatar'])
|
||||||
$msg['htmlversion']
|
|
||||||
= html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
|
|
||||||
|
|
||||||
$imgtouse = ((link_compare($datarray['author-link'],$importer['url'])) ? $importer['thumb'] : $datarray['author-avatar']);
|
|
||||||
|
|
||||||
// load the template for private message notifications
|
|
||||||
$tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
|
|
||||||
$email_html_body_tpl = replace_macros($tpl,array(
|
|
||||||
'$username' => $importer['username'],
|
|
||||||
'$sitename' => $a->config['sitename'], // name of this site
|
|
||||||
'$siteurl' => $a->get_baseurl(), // descriptive url of this site
|
|
||||||
'$thumb' => $imgtouse, // 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['htmlversion'], // html version of the message
|
|
||||||
'$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// load the template for private message notifications
|
|
||||||
$tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
|
|
||||||
$email_text_body_tpl = replace_macros($tpl,array(
|
|
||||||
'$username' => $importer['username'],
|
|
||||||
'$sitename' => $a->config['sitename'], // name of this site
|
|
||||||
'$siteurl' => $a->get_baseurl(), // descriptive url of this site
|
|
||||||
'$thumb' => $imgtouse, // 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'] . '/' . $posted_id,
|
|
||||||
));
|
|
||||||
|
|
||||||
// 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'],
|
|
||||||
sprintf( t('%s commented on an item at %s'), $from , $a->config['sitename']),
|
|
||||||
$email_html_body_tpl,
|
|
||||||
$email_text_body_tpl
|
|
||||||
);
|
|
||||||
pop_lang();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2240,78 +2194,34 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
// find out if our user is involved in this conversation and wants to be notified.
|
// find out if our user is involved in this conversation and wants to be notified.
|
||||||
|
|
||||||
if(($datarray['type'] != 'activity') && ($importer['notify-flags'] & NOTIFY_COMMENT)) {
|
if($datarray['type'] != 'activity') {
|
||||||
|
|
||||||
$myconv = q("SELECT `author-link`, `author-avatar` 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),
|
dbesc($parent_uri),
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if(count($myconv)) {
|
if(count($myconv)) {
|
||||||
$importer_url = $a->get_baseurl() . '/profile/' . $importer['nickname'];
|
$importer_url = $a->get_baseurl() . '/profile/' . $importer['nickname'];
|
||||||
foreach($myconv as $conv) {
|
foreach($myconv as $conv) {
|
||||||
|
|
||||||
if(! link_compare($conv['author-link'],$importer_url))
|
if(! link_compare($conv['author-link'],$importer_url))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
push_lang($importer['language']);
|
notification(array(
|
||||||
require_once('bbcode.php');
|
'type' => NOTIFY_COMMENT,
|
||||||
$from = stripslashes($datarray['author-name']);
|
'notify_flags' => $importer['notify-flags'],
|
||||||
|
'language' => $importer['language'],
|
||||||
// name of the automated email sender
|
'to_name' => $importer['username'],
|
||||||
$msg['notificationfromname'] = stripslashes($datarray['author-name']);;
|
'to_email' => $importer['email'],
|
||||||
// noreply address to send from
|
'item' => $datarray,
|
||||||
$msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
|
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
||||||
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
// text version
|
'source_link' => $datarray['author-link'],
|
||||||
// process the message body to display properly in text mode
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
$msg['textversion']
|
? $importer['thumb'] : $datarray['author-avatar'])
|
||||||
= 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']))));
|
|
||||||
|
|
||||||
$imgtouse = ((link_compare($datarray['author-link'],$importer['url'])) ? $importer['thumb'] : $datarray['author-avatar']);
|
|
||||||
|
|
||||||
|
|
||||||
// load the template for private message notifications
|
|
||||||
$tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
|
|
||||||
$email_html_body_tpl = replace_macros($tpl,array(
|
|
||||||
'$username' => $importer['username'],
|
|
||||||
'$sitename' => $a->config['sitename'], // name of this site
|
|
||||||
'$siteurl' => $a->get_baseurl(), // descriptive url of this site
|
|
||||||
'$thumb' => $imgtouse, // thumbnail url for sender icon
|
|
||||||
'$url' => $datarray['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'] . '/' . $posted_id,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// load the template for private message notifications
|
|
||||||
$tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
|
|
||||||
$email_text_body_tpl = replace_macros($tpl,array(
|
|
||||||
'$username' => $importer['username'],
|
|
||||||
'$sitename' => $a->config['sitename'], // name of this site
|
|
||||||
'$siteurl' => $a->get_baseurl(), // descriptive url of this site
|
|
||||||
'$thumb' => $imgtouse, // thumbnail url for sender icon
|
|
||||||
'$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'] . '/' . $posted_id,
|
|
||||||
));
|
|
||||||
|
|
||||||
// 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'],
|
|
||||||
sprintf( t('%s commented on an item at %s'), $from , $a->config['sitename']),
|
|
||||||
$email_html_body_tpl,
|
|
||||||
$email_text_body_tpl
|
|
||||||
);
|
|
||||||
pop_lang();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue