require_once("datetime.php");
require_once('include/items.php');
require_once('include/bbcode.php');
require_once("datetime.php");
require_once('include/items.php');
require_once('include/bbcode.php');
return;
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
return;
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
if(strpos($localhost,':'))
$localhost = substr($localhost,0,strpos($localhost,':'));
/**
*
if(strpos($localhost,':'))
$localhost = substr($localhost,0,strpos($localhost,':'));
/**
*
+ if(($cmd === 'uplink') && (intval($parent['forum_mode'])) && (! $top_level)) {
+ $relay_to_owner = true;
+ }
+
+ // until the 'origin' flag has been in use for several months
+ // we will just use it as a fallback test
+ // later we will be able to use it as the primary test of whether or not to relay.
+
+ if(! $target_item['origin'])
+ $relay_to_owner = false;
+
+ if($parent['origin'])
+ $relay_to_owner = false;
+
+
+
if($relay_to_owner) {
logger('notifier: followup', LOGGER_DEBUG);
// local followup to remote post
if($relay_to_owner) {
logger('notifier: followup', LOGGER_DEBUG);
// local followup to remote post
$deny_people = expand_acl($parent['deny_cid']);
$deny_groups = expand_groups(expand_acl($parent['deny_gid']));
$deny_people = expand_acl($parent['deny_cid']);
$deny_groups = expand_groups(expand_acl($parent['deny_gid']));
+ // if our parent is a forum, uplink to the origional author causing
+ // a delivery fork
+
+ if(intval($parent['forum_mode']) && (! $top_level) && ($cmd !== 'uplink')) {
+ proc_run('php','include/notifier','uplink',$item_id);
+ }
+
$birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
$atom .= replace_macros($feed_template, array(
$birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
$atom .= replace_macros($feed_template, array(
'$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ),
'$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
'$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ),
'$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
continue;
if($item['id'] == $item_id) {
logger('notifier: followup: item: ' . print_r($item,true), LOGGER_DATA);
continue;
if($item['id'] == $item_id) {
logger('notifier: followup: item: ' . print_r($item,true), LOGGER_DATA);
- $slap = atom_entry($item,'html',$owner,$owner,false);
- $atom .= atom_entry($item,'text',$owner,$owner,false);
+ $slap = atom_entry($item,'html',null,$owner,false);
+ $atom .= atom_entry($item,'text',null,$owner,false);
// older sites without a corresponding dfrn_notify change may do the wrong thing.
if($item_id == $item['id'] || $item['id'] == $item['parent'])
// older sites without a corresponding dfrn_notify change may do the wrong thing.
if($item_id == $item['id'] || $item['id'] == $item['parent'])
- $atom .= atom_entry($item,'text',$contact,$owner,true);
+ $atom .= atom_entry($item,'text',null,$owner,true);
- $atom .= atom_entry($item,'text',$contact,$owner,true);
+ $atom .= atom_entry($item,'text',null,$owner,true);
- $slaps[] = atom_entry($item,'html',$contact,$owner,true);
+ $slaps[] = atom_entry($item,'html',null,$owner,true);
require_once('library/simplepie/simplepie.inc');
logger('mod-delivery: local delivery');
local_delivery($x[0],$atom);
require_once('library/simplepie/simplepie.inc');
logger('mod-delivery: local delivery');
local_delivery($x[0],$atom);
-
- $subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
- $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
+
+ $subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ;
+
+ // only expose our real email address to true friends
+
+ if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked']))
+ $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n";
+ else
+ $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n";
- $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n";
+ // for testing purposes: Collect exported mails
+ //$file = tempnam("/tmp/friendica/", "mail-out2-");
+ //file_put_contents($file, json_encode($it));
+
+ $headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n";
- dbesc($it['parent-uri'])
- );
- if(count($r)) {
- $subtitle = $r[0]['title'];
- if($subtitle) {
- if(strncasecmp($subtitle,'RE:',3))
- $subject = $subtitle;
- else
- $subject = 'Re: ' . $subtitle;
- }
- }
+ dbesc($it['parent-uri']));
+
+ if(count($r) AND ($r[0]['title'] != ''))
+ $subject = $r[0]['title'];
-
- $headers .= 'MIME-Version: 1.0' . "\n";
- $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
- $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
- $html = prepare_body($it);
- $message = '<html><body>' . $html . '</body></html>';
- logger('notifier: email delivery to ' . $addr);
- mail($addr, $subject, $message, $headers);
+ email_send($addr, $subject, $headers, $it);
- if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')) || (! $normal_mode))
+ if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')))
+ break;
+
+ if($mail) {
+ diaspora_send_mail($item,$owner,$contact);
+ break;
+ }
+
+ if(! $normal_mode)
// we are the relay - send comments, likes and unlikes to our conversants
diaspora_send_relay($target_item,$owner,$contact);
break;
// we are the relay - send comments, likes and unlikes to our conversants
diaspora_send_relay($target_item,$owner,$contact);
break;
elseif(($top_level) && (! $walltowall)) {
// currently no workable solution for sending walltowall
diaspora_send_status($target_item,$owner,$contact);
elseif(($top_level) && (! $walltowall)) {
// currently no workable solution for sending walltowall
diaspora_send_status($target_item,$owner,$contact);