X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdelivery.php;h=021ceb9968a8496e738685021af242f60102aaa4;hb=1127150c79d67ff8a1b0b10131ac5ad5993ad63b;hp=482a759498dd035b4e0980d42ee8c86a8ef44088;hpb=444b417de0e6a71ed6057bf9836a2ab21fb0b770;p=friendica.git
diff --git a/include/delivery.php b/include/delivery.php
index 482a759498..021ceb9968 100644
--- a/include/delivery.php
+++ b/include/delivery.php
@@ -265,8 +265,6 @@ function delivery_run(&$argv, &$argc){
if(count($r))
$contact = $r[0];
- $hubxml = feed_hublinks();
-
if($contact['self'])
continue;
@@ -280,13 +278,13 @@ function delivery_run(&$argv, &$argc){
logger('notifier: '.$target_item["guid"].' dfrndelivery: ' . $contact['name']);
if ($mail) {
- $item["body"] = $body;
- $atom = dfrn_mail($item, $owner);
+ $item['body'] = fix_private_photos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
+ $atom = dfrn::mail($item, $owner);
} elseif ($fsuggest) {
- $atom = dfrn_fsuggest($item, $owner);
- // q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id'])
+ $atom = dfrn::fsuggest($item, $owner);
+ q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
} elseif ($relocate)
- $atom = dfrn_relocate($owner, $uid);
+ $atom = dfrn::relocate($owner, $uid);
elseif($followup) {
$msgitems = array();
foreach($items as $item) { // there is only one item
@@ -297,7 +295,7 @@ function delivery_run(&$argv, &$argc){
$msgitems[] = $item;
}
}
- $atom = dfrn_entries($msgitems,$owner);
+ $atom = dfrn::entries($msgitems,$owner);
} else {
$msgitems = array();
foreach($items as $item) {
@@ -323,140 +321,9 @@ function delivery_run(&$argv, &$argc){
$msgitems[] = $item;
}
}
- $atom = dfrn_entries($msgitems,$owner);
- }
-/*
- $feed_template = get_markup_template('atom_feed.tpl');
- $mail_template = get_markup_template('atom_mail.tpl');
-
- $atom = '';
-
-
- $birthday = feed_birthday($owner['uid'],$owner['timezone']);
-
- if(strlen($birthday))
- $birthday = '' . xmlify($birthday) . '';
-
- $atom .= replace_macros($feed_template, array(
- '$version' => xmlify(FRIENDICA_VERSION),
- '$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)) ,
- '$hub' => $hubxml,
- '$salmon' => '', // private feed, we don't use salmon here
- '$name' => xmlify($owner['name']),
- '$profile_page' => xmlify($owner['url']),
- '$photo' => xmlify($owner['photo']),
- '$thumb' => xmlify($owner['thumb']),
- '$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)) ,
- '$birthday' => $birthday,
- '$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '1' : '')
- ));
-
- if($mail) {
- $public_message = false; // mail is not public
-
- $body = fix_private_photos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
-
- $atom .= replace_macros($mail_template, array(
- '$name' => xmlify($owner['name']),
- '$profile_page' => xmlify($owner['url']),
- '$thumb' => xmlify($owner['thumb']),
- '$item_id' => xmlify($item['uri']),
- '$subject' => xmlify($item['title']),
- '$created' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
- '$content' => xmlify($body),
- '$parent_id' => xmlify($item['parent-uri'])
- ));
- } elseif($fsuggest) {
- $public_message = false; // suggestions are not public
-
- $sugg_template = get_markup_template('atom_suggest.tpl');
-
- $atom .= replace_macros($sugg_template, array(
- '$name' => xmlify($item['name']),
- '$url' => xmlify($item['url']),
- '$photo' => xmlify($item['photo']),
- '$request' => xmlify($item['request']),
- '$note' => xmlify($item['note'])
- ));
-
- // We don't need this any more
-
- q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
- intval($item['id'])
- );
- } elseif($relocate) {
- $public_message = false; // suggestions are not public
-
- $sugg_template = get_markup_template('atom_relocate.tpl');
-
- // get site pubkey. this could be a new installation with no site keys
- $pubkey = get_config('system','site_pubkey');
- if(! $pubkey) {
- $res = new_keypair(1024);
- set_config('system','site_prvkey', $res['prvkey']);
- set_config('system','site_pubkey', $res['pubkey']);
- }
-
- $rp = q("SELECT `resource-id` , `scale`, type FROM `photo`
- WHERE `profile` = 1 AND `uid` = %d ORDER BY scale;", $uid);
- $photos = array();
- $ext = Photo::supportedTypes();
- foreach($rp as $p){
- $photos[$p['scale']] = $a->get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
- }
- unset($rp, $ext);
-
- $atom .= replace_macros($sugg_template, array(
- '$name' => xmlify($owner['name']),
- '$photo' => xmlify($photos[4]),
- '$thumb' => xmlify($photos[5]),
- '$micro' => xmlify($photos[6]),
- '$url' => xmlify($owner['url']),
- '$request' => xmlify($owner['request']),
- '$confirm' => xmlify($owner['confirm']),
- '$notify' => xmlify($owner['notify']),
- '$poll' => xmlify($owner['poll']),
- '$sitepubkey' => xmlify(get_config('system','site_pubkey')),
- //'$pubkey' => xmlify($owner['pubkey']),
- //'$prvkey' => xmlify($owner['prvkey']),
- ));
- unset($photos);
- } elseif($followup) {
- foreach($items as $item) { // there is only one item
- if(! $item['parent'])
- continue;
- if($item['id'] == $item_id) {
- logger('followup: item: ' . print_r($item,true), LOGGER_DATA);
- $atom .= atom_entry($item,'text',null,$owner,false);
- }
- }
- } else {
- foreach($items as $item) {
- if(! $item['parent'])
- continue;
-
- // private emails may be in included in public conversations. Filter them.
- if(($public_message) && $item['private'] == 1)
- continue;
-
- $item_contact = get_item_contact($item,$icontacts);
- if(! $item_contact)
- continue;
-
- if($normal_mode) {
- if($item_id == $item['id'] || $item['id'] == $item['parent'])
- $atom .= atom_entry($item,'text',null,$owner,true,(($top_level) ? $contact['id'] : 0));
- } else
- $atom .= atom_entry($item,'text',null,$owner,true);
- }
+ $atom = dfrn::entries($msgitems,$owner);
}
- $atom .= '' . "\r\n";
-*/
logger('notifier entry: '.$contact["url"].' '.$target_item["guid"].' entry: '.$atom, LOGGER_DEBUG);
logger('notifier: ' . $atom, LOGGER_DATA);
@@ -507,13 +374,13 @@ function delivery_run(&$argv, &$argc){
break;
logger('mod-delivery: local delivery');
- local_delivery($x[0],$atom);
+ dfrn::import($atom, $x[0]);
break;
}
}
if(! was_recently_delayed($contact['id']))
- $deliver_status = dfrn_deliver($owner,$contact,$atom);
+ $deliver_status = dfrn::deliver($owner,$contact,$atom);
else
$deliver_status = (-1);