new notifications - implement storage

This commit is contained in:
friendica 2012-02-18 02:57:42 -08:00
parent 4222f506a8
commit 1b9c03f6fc
5 changed files with 34 additions and 6 deletions

View file

@ -1308,6 +1308,7 @@ function diaspora_conversation($importer,$xml,$msg) {
'language' => $importer['language'], 'language' => $importer['language'],
'to_name' => $importer['username'], 'to_name' => $importer['username'],
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' =>$importer['importer_uid'],
'item' => array('subject' => $subject, 'body' => $body), 'item' => array('subject' => $subject, 'body' => $body),
'source_name' => $person['name'], 'source_name' => $person['name'],
'source_link' => $person['url'], 'source_link' => $person['url'],

View file

@ -32,7 +32,7 @@ function notification($params) {
$sitelink = t('Please visit %s to view and/or reply to your private messages.'); $sitelink = t('Please visit %s to view and/or reply to your private messages.');
$tsitelink = sprintf( $sitelink, $siteurl . '/message' ); $tsitelink = sprintf( $sitelink, $siteurl . '/message' );
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message">' . $sitename . '</a>'); $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message">' . $sitename . '</a>');
$itemlink = ''; $itemlink = $siteurl . '/message';
} }
if($params['type'] == NOTIFY_COMMENT) { if($params['type'] == NOTIFY_COMMENT) {
@ -100,9 +100,27 @@ function notification($params) {
} }
// TODO - create notification entry in DB // from here on everything is in the recipients language
push_lang($params['language']);
require_once('include/html2bbcode.php');
// create notification entry in DB
$r = q("insert into notify (name,url,photo,date,msg,uid,link,type,verb,otype)
values('%s','%s','%s','%s','%s',%d,'%s',%d,'%s','%s')",
dbesc($params['source_name']),
dbesc($params['source_link']),
dbesc($params['source_photo']),
dbesc(datetime_convert()),
dbesc($preamble),
intval($params['uid']),
dbesc($itemlink),
intval($params['type']),
dbesc($params['verb']),
dbesc($params['otype'])
);
// send email notification if notification preferences permit // send email notification if notification preferences permit
@ -111,7 +129,6 @@ function notification($params) {
logger('notification: sending notification email'); logger('notification: sending notification email');
push_lang($params['language']);
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n", $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",
$body))),ENT_QUOTES,'UTF-8')); $body))),ENT_QUOTES,'UTF-8'));
@ -126,7 +143,7 @@ function notification($params) {
'$preamble' => $preamble, '$preamble' => $preamble,
'$sitename' => $sitename, '$sitename' => $sitename,
'$siteurl' => $siteurl, '$siteurl' => $siteurl,
'$source_name' => $parama['source_name'], '$source_name' => $params['source_name'],
'$source_link' => $params['source_link'], '$source_link' => $params['source_link'],
'$source_photo' => $params['source_photo'], '$source_photo' => $params['source_photo'],
'$username' => $params['to_name'], '$username' => $params['to_name'],
@ -146,7 +163,7 @@ function notification($params) {
'$preamble' => $preamble, '$preamble' => $preamble,
'$sitename' => $sitename, '$sitename' => $sitename,
'$siteurl' => $siteurl, '$siteurl' => $siteurl,
'$source_name' => $parama['source_name'], '$source_name' => $params['source_name'],
'$source_link' => $params['source_link'], '$source_link' => $params['source_link'],
'$source_photo' => $params['source_photo'], '$source_photo' => $params['source_photo'],
'$username' => $params['to_name'], '$username' => $params['to_name'],
@ -171,8 +188,10 @@ function notification($params) {
'htmlVersion' => $email_html_body, 'htmlVersion' => $email_html_body,
'textVersion' => $email_text_body 'textVersion' => $email_text_body
)); ));
pop_lang();
} }
pop_lang();
} }
require_once('include/email.php'); require_once('include/email.php');

View file

@ -977,6 +977,7 @@ function tag_deliver($uid,$item_id) {
'language' => $u[0]['language'], 'language' => $u[0]['language'],
'to_name' => $u[0]['username'], 'to_name' => $u[0]['username'],
'to_email' => $u[0]['email'], 'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'],
'item' => $item, 'item' => $item,
'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
'source_name' => $item['author-name'], 'source_name' => $item['author-name'],
@ -1848,6 +1849,7 @@ function local_delivery($importer,$data) {
'language' => $importer['language'], 'language' => $importer['language'],
'to_name' => $importer['username'], 'to_name' => $importer['username'],
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'],
'item' => $fsugg, 'item' => $fsugg,
'link' => $a->get_baseurl() . '/notifications/intros', 'link' => $a->get_baseurl() . '/notifications/intros',
'source_name' => $importer['name'], 'source_name' => $importer['name'],
@ -1899,6 +1901,7 @@ function local_delivery($importer,$data) {
'language' => $importer['language'], 'language' => $importer['language'],
'to_name' => $importer['username'], 'to_name' => $importer['username'],
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'],
'item' => $msg, 'item' => $msg,
'source_name' => $msg['from-name'], 'source_name' => $msg['from-name'],
'source_link' => $importer['url'], 'source_link' => $importer['url'],
@ -2171,6 +2174,7 @@ function local_delivery($importer,$data) {
'language' => $importer['language'], 'language' => $importer['language'],
'to_name' => $importer['username'], 'to_name' => $importer['username'],
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, 'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
'source_name' => stripslashes($datarray['author-name']), 'source_name' => stripslashes($datarray['author-name']),
@ -2291,6 +2295,7 @@ function local_delivery($importer,$data) {
'language' => $importer['language'], 'language' => $importer['language'],
'to_name' => $importer['username'], 'to_name' => $importer['username'],
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, 'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
'source_name' => stripslashes($datarray['author-name']), 'source_name' => stripslashes($datarray['author-name']),

View file

@ -577,6 +577,7 @@ function dfrn_request_content(&$a) {
'language' => $r[0]['language'], 'language' => $r[0]['language'],
'to_name' => $r[0]['username'], 'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'], 'to_email' => $r[0]['email'],
'uid' => $r[0]['uid'],
'link' => $a->get_baseurl() . '/notifications/intros', 'link' => $a->get_baseurl() . '/notifications/intros',
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
'source_link' => $r[0]['url'], 'source_link' => $r[0]['url'],

View file

@ -746,6 +746,7 @@ function item_post(&$a) {
'language' => $user['language'], 'language' => $user['language'],
'to_name' => $user['username'], 'to_name' => $user['username'],
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
@ -788,6 +789,7 @@ function item_post(&$a) {
'language' => $user['language'], 'language' => $user['language'],
'to_name' => $user['username'], 'to_name' => $user['username'],
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],