aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php257
1 files changed, 195 insertions, 62 deletions
diff --git a/include/items.php b/include/items.php
index 05ff1b078..30a685ed3 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1233,13 +1233,14 @@ function get_atom_elements($feed,$item) {
$author = $item->get_author();
if($author) {
- $res['author-name'] = unxmlify($author->get_name());
- $res['author-link'] = unxmlify($author->get_link());
+ $res['author_name'] = unxmlify($author->get_name());
+ $res['author_link'] = unxmlify($author->get_link());
}
else {
- $res['author-name'] = unxmlify($feed->get_title());
- $res['author-link'] = unxmlify($feed->get_permalink());
+ $res['author_name'] = unxmlify($feed->get_title());
+ $res['author_link'] = unxmlify($feed->get_permalink());
}
+
$res['mid'] = unxmlify($item->get_id());
$res['title'] = unxmlify($item->get_title());
$res['body'] = unxmlify($item->get_content());
@@ -1264,9 +1265,9 @@ function get_atom_elements($feed,$item) {
if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
$base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) {
- if(!x($res, 'author-avatar') || !$res['author-avatar']) {
+ if(!x($res, 'author_photo') || !$res['author_photo']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
- $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
+ $res['author_photo'] = unxmlify($link['attribs']['']['href']);
}
}
}
@@ -1277,11 +1278,11 @@ function get_atom_elements($feed,$item) {
$base = $rawactor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
if($base && count($base)) {
foreach($base as $link) {
- if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link']))
- $res['author-link'] = unxmlify($link['attribs']['']['href']);
- if(!x($res, 'author-avatar') || !$res['author-avatar']) {
+ if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link']))
+ $res['author_link'] = unxmlify($link['attribs']['']['href']);
+ if(!x($res, 'author_photo') || !$res['author_photo']) {
if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo')
- $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
+ $res['author_photo'] = unxmlify($link['attribs']['']['href']);
}
}
}
@@ -1289,16 +1290,16 @@ function get_atom_elements($feed,$item) {
// No photo/profile-link on the item - look at the feed level
- if((! (x($res,'author-link'))) || (! (x($res,'author-avatar')))) {
+ if((! (x($res,'author_link'))) || (! (x($res,'author_photo')))) {
$rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author');
if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
$base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) {
- if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link']))
- $res['author-link'] = unxmlify($link['attribs']['']['href']);
- if(! $res['author-avatar']) {
+ if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link']))
+ $res['author_link'] = unxmlify($link['attribs']['']['href']);
+ if(! $res['author_photo']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
- $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
+ $res['author_photo'] = unxmlify($link['attribs']['']['href']);
}
}
}
@@ -1310,11 +1311,11 @@ function get_atom_elements($feed,$item) {
if($base && count($base)) {
foreach($base as $link) {
- if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link']))
- $res['author-link'] = unxmlify($link['attribs']['']['href']);
- if(! (x($res,'author-avatar'))) {
+ if($link['attribs']['']['rel'] === 'alternate' && (! $res['author_link']))
+ $res['author_link'] = unxmlify($link['attribs']['']['href']);
+ if(! (x($res,'author_photo'))) {
if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo')
- $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
+ $res['author_photo'] = unxmlify($link['attribs']['']['href']);
}
}
}
@@ -1378,9 +1379,9 @@ function get_atom_elements($feed,$item) {
$private = $item->get_item_tags(NAMESPACE_DFRN,'private');
if($private && intval($private[0]['data']) > 0)
- $res['private'] = intval($private[0]['data']);
+ $res['item_private'] = ((intval($private[0]['data'])) ? 1 : 0);
else
- $res['private'] = 0;
+ $res['item_private'] = 0;
$rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
if($rawlocation)
@@ -1419,21 +1420,21 @@ function get_atom_elements($feed,$item) {
$rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])
- $res['owner-name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
+ $res['owner_name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
elseif($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data'])
- $res['owner-name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']);
+ $res['owner_name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']);
if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])
- $res['owner-link'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']);
+ $res['owner_link'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']);
elseif($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data'])
- $res['owner-link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']);
+ $res['owner_link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']);
if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
$base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) {
- if(!x($res, 'owner-avatar') || !$res['owner-avatar']) {
+ if(!x($res, 'owner_photo') || !$res['owner_photo']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
- $res['owner-avatar'] = unxmlify($link['attribs']['']['href']);
+ $res['owner_photo'] = unxmlify($link['attribs']['']['href']);
}
}
}
@@ -1488,6 +1489,7 @@ function get_atom_elements($feed,$item) {
$attach = $item->get_enclosures();
if($attach) {
+ $res['attach'] = array();
$att_arr = array();
foreach($attach as $att) {
$len = intval($att->get_length());
@@ -1503,33 +1505,32 @@ function get_atom_elements($feed,$item) {
$title = ' ';
if(! $type)
$type = 'application/octet-stream';
-
- $att_arr[] = '[attach]href="' . $link . '" length="' . $len . '" type="' . $type . '" title="' . $title . '"[/attach]';
}
- $res['attach'] = implode(',', $att_arr);
+ $res['attach'][] = array('href' => $link, 'length' => $len, 'type' => $type, 'title' => $title );
}
$rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object');
if($rawobj) {
- $res['object'] = '<object>' . "\n";
+ $obj = array();
+
$child = $rawobj[0]['child'];
if($child[NAMESPACE_ACTIVITY]['obj_type'][0]['data']) {
$res['obj_type'] = $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'];
- $res['object'] .= '<type>' . $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'] . '</type>' . "\n";
+ $obj['type'] = $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'];
}
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'id') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
- $res['object'] .= '<id>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
+ $obj['id'] = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'];
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
- $res['object'] .= '<link>' . encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
+ $obj['link'] = encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']);
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'title') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
- $res['object'] .= '<title>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
+ $obj['title'] = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'];
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'content') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
$body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
if(! $body)
$body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
- $res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
+ $obj['orig'] = xmlify($body);
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
$body = purify_html($body);
@@ -1537,48 +1538,52 @@ function get_atom_elements($feed,$item) {
}
- $res['object'] .= '<content>' . $body . '</content>' . "\n";
+ $obj['content'] = $body;
}
- $res['object'] .= '</object>' . "\n";
+ $res['object'] = $obj;
}
$rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'target');
if($rawobj) {
- $res['target'] = '<target>' . "\n";
+ $obj = array();
+
$child = $rawobj[0]['child'];
if($child[NAMESPACE_ACTIVITY]['obj_type'][0]['data']) {
- $res['target'] .= '<type>' . $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'] . '</type>' . "\n";
+ $res['tgt_type'] = $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'];
+ $obj['type'] = $child[NAMESPACE_ACTIVITY]['obj_type'][0]['data'];
}
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'id') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'])
- $res['target'] .= '<id>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '</id>' . "\n";
+ $obj['id'] = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'];
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
- $res['target'] .= '<link>' . encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']) . '</link>' . "\n";
- if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'data') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
- $res['target'] .= '<title>' . $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '</title>' . "\n";
- if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'data') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
+ $obj['link'] = encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']);
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'title') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'])
+ $obj['title'] = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'];
+ if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'content') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']) {
$body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data'];
if(! $body)
$body = $child[SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
- $res['target'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
+ $obj['orig'] = xmlify($body);
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
$body = purify_html($body);
$body = html2bbcode($body);
+
}
- $res['target'] .= '<content>' . $body . '</content>' . "\n";
+ $obj['content'] = $body;
}
- $res['target'] .= '</target>' . "\n";
+ $res['target'] = $obj;
}
// This is some experimental stuff. By now retweets are shown with "RT:"
// But: There is data so that the message could be shown similar to native retweets
// There is some better way to parse this array - but it didn't worked for me.
+/*
$child = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["entry"][0]["child"]["http://activitystrea.ms/spec/1.0/"][object][0]["child"];
if (is_array($child)) {
$message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"];
@@ -1601,6 +1606,8 @@ function get_atom_elements($feed,$item) {
}
}
+*/
+
$arr = array('feed' => $feed, 'item' => $item, 'result' => $res);
call_hooks('parse_atom', $arr);
@@ -1613,6 +1620,10 @@ function encode_rel_links($links) {
$o = '';
if(! ((is_array($links)) && (count($links))))
return $o;
+
+//fixme
+ return '';
+
foreach($links as $link) {
$o .= '<link ';
if($link['attribs']['']['rel'])
@@ -2342,6 +2353,10 @@ function tag_deliver($uid,$item_id) {
$mention = false;
+ /**
+ * Fetch stuff we need - a channel and an item
+ */
+
$u = q("select * from channel where channel_id = %d limit 1",
intval($uid)
);
@@ -2367,6 +2382,10 @@ function tag_deliver($uid,$item_id) {
}
+ /**
+ * Seems like a good place to plug in a poke notification.
+ */
+
if (stristr($item['verb'],ACTIVITY_POKE)) {
$poke_notify = true;
@@ -2395,6 +2414,10 @@ function tag_deliver($uid,$item_id) {
}
}
+ /**
+ * Do community tagging
+ */
+
if($item['obj_type'] === ACTIVITY_OBJ_TAGTERM) {
// We received a community tag activity for a post.
@@ -2435,6 +2458,11 @@ function tag_deliver($uid,$item_id) {
logger('tag_deliver: tag permission denied for ' . $u[0]['channel_address']);
}
+ /**
+ * A "union" is a message which our channel has sourced from another channel.
+ * This sets up a second delivery chain just like forum tags do.
+ * Find out if this is a source-able post.
+ */
$union = check_item_source($uid,$item);
if($union)
@@ -2462,9 +2490,12 @@ function tag_deliver($uid,$item_id) {
$private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0);
-//FIXME - add check for public_policy
+ $new_public_policy = map_scope($u[0]['channel_r_stream'],true);
- $flag_bits = ITEM_WALL|ITEM_ORIGIN;
+ if((! $private) && $new_public_policy)
+ $private = 1;
+
+ $flag_bits = $item['item_flags'] | ITEM_WALL|ITEM_ORIGIN;
// maintain the original source, which will be the original item owner and was stored in source_xchan
// when we created the delivery fork
@@ -2474,8 +2505,28 @@ function tag_deliver($uid,$item_id) {
intval($item_id)
);
- $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
- deny_cid = '%s', deny_gid = '%s', item_private = %d where id = %d limit 1",
+ $title = $item['title'];
+ $body = $item['body'];
+
+ if($private) {
+ if(!($flag_bits & ITEM_OBSCURED)) {
+ $key = get_config('system','pubkey');
+ $flag_bits = $flag_bits|ITEM_OBSCURED;
+ $title = json_encode(aes_encapsulate($title,$key));
+ $body = json_encode(aes_encapsulate($body,$key));
+ }
+ }
+ else {
+ if($flag_bits & ITEM_OBSCURED) {
+ $key = get_config('system','prvkey');
+ $flag_bits = $flag_bits ^ ITEM_OBSCURED;
+ $title = json_encode(aes_unencapsulate($title,$key));
+ $body = json_encode(aes_unencapsulate($body,$key));
+ }
+ }
+
+ $r = q("update item set item_flags = %d, owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
+ deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s' where id = %d limit 1",
intval($flag_bits),
dbesc($u[0]['channel_hash']),
dbesc($u[0]['channel_allow_cid']),
@@ -2483,6 +2534,10 @@ function tag_deliver($uid,$item_id) {
dbesc($u[0]['channel_deny_cid']),
dbesc($u[0]['channel_deny_gid']),
intval($private),
+ dbesc($new_public_policy),
+ dbesc(map_scope($u[0]['channel_w_comment'])),
+ dbesc($title),
+ dbesc($body),
intval($item_id)
);
if($r)
@@ -2492,6 +2547,12 @@ function tag_deliver($uid,$item_id) {
}
}
+
+ /**
+ * Now we've got those out of the way. Let's see if this is a post that's tagged for re-delivery
+ */
+
+
$terms = get_terms_oftype($item['term'],TERM_MENTION);
if($terms)
@@ -2553,7 +2614,9 @@ function tag_deliver($uid,$item_id) {
$arr = array('channel_id' => $uid, 'item' => $item, 'body' => $body);
call_hooks('tagged',$arr);
- // Valid tag. Send a notification
+ /**
+ * Kill two birds with one stone. As long as we're here, send a mention notification.
+ */
require_once('include/enotify.php');
notification(array(
@@ -2597,6 +2660,10 @@ function tag_deliver($uid,$item_id) {
return;
}
+ /**
+ * At this point we're committed to setting up a second delivery chain. We just have to mangle some bits first.
+ */
+
logger('tag_deliver: creating second delivery chain.');
// now change this copy of the post to a forum head message and deliver to all the tgroup members
@@ -2604,9 +2671,12 @@ function tag_deliver($uid,$item_id) {
$private = (($u[0]['channel_allow_cid'] || $u[0]['channel_allow_gid'] || $u[0]['channel_deny_cid'] || $u[0]['channel_deny_gid']) ? 1 : 0);
-// FIXME set public_policy and recheck private
+ $new_public_policy = map_scope($u[0]['channel_r_stream'],true);
+
+ if((! $private) && $new_public_policy)
+ $private = 1;
- $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK;
+ $flag_bits = $item['item_flags'] | ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK;
// preserve the source
@@ -2614,8 +2684,30 @@ function tag_deliver($uid,$item_id) {
intval($item_id)
);
- $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
- deny_cid = '%s', deny_gid = '%s', item_private = %d where id = %d limit 1",
+ // make sure encryption matches the new scope
+
+ $title = $item['title'];
+ $body = $item['body'];
+
+ if($private) {
+ if(!($flag_bits & ITEM_OBSCURED)) {
+ $key = get_config('system','pubkey');
+ $flag_bits = $flag_bits|ITEM_OBSCURED;
+ $title = json_encode(aes_encapsulate($title,$key));
+ $body = json_encode(aes_encapsulate($body,$key));
+ }
+ }
+ else {
+ if($flag_bits & ITEM_OBSCURED) {
+ $key = get_config('system','prvkey');
+ $flag_bits = $flag_bits ^ ITEM_OBSCURED;
+ $title = json_encode(aes_unencapsulate($title,$key));
+ $body = json_encode(aes_unencapsulate($body,$key));
+ }
+ }
+
+ $r = q("update item set item_flags = %d, owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
+ deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s' where id = %d limit 1",
intval($flag_bits),
dbesc($u[0]['channel_hash']),
dbesc($u[0]['channel_allow_cid']),
@@ -2623,6 +2715,10 @@ function tag_deliver($uid,$item_id) {
dbesc($u[0]['channel_deny_cid']),
dbesc($u[0]['channel_deny_gid']),
intval($private),
+ dbesc($new_public_policy),
+ dbesc(map_scope($u[0]['channel_w_comment'])),
+ dbesc($title),
+ dbesc($body),
intval($item_id)
);
if($r)
@@ -2632,6 +2728,16 @@ function tag_deliver($uid,$item_id) {
}
+/**
+ * @function tgroup_check($uid,$item)
+ *
+ * This function is called pre-deliver to see if a post matches the criteria to be tag delivered.
+ * We don't actually do anything except check that it matches the criteria.
+ * This is so that the channel with tag_delivery enabled can receive the post even if they turn off
+ * permissions for the sender to send their stream. tag_deliver() can't be called until the post is actually stored.
+ * By then it would be too late to reject it.
+ */
+
function tgroup_check($uid,$item) {
@@ -2899,7 +3005,7 @@ function mail_store($arr) {
* recursion.
*/
-function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) {
+function consume_feed($xml,$importer,&$contact,$pass = 0) {
require_once('library/simplepie/simplepie.inc');
@@ -2943,8 +3049,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
else
$when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
}
+
+
if($deleted && is_array($contact)) {
-/* $r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join `contact` on `item`.`contact-id` = `contact`.`id`
+/*
+ $r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join `contact` on `item`.`contact-id` = `contact`.`id`
WHERE `mid` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
dbesc($mid),
intval($importer['channel_id']),
@@ -3021,14 +3130,15 @@ logger('consume_feed: processing ' . $item_id);
$item_id = $item->get_id();
$datarray = get_atom_elements($feed,$item);
+/*
if((! x($datarray,'author-name')) && ($contact['network'] != NETWORK_DFRN))
$datarray['author-name'] = $contact['name'];
if((! x($datarray,'author-link')) && ($contact['network'] != NETWORK_DFRN))
$datarray['author-link'] = $contact['url'];
if((! x($datarray,'author-avatar')) && ($contact['network'] != NETWORK_DFRN))
$datarray['author-avatar'] = $contact['thumb'];
-
- if((! x($datarray,'author-name')) || (! x($datarray,'author-link'))) {
+*/
+ if((! x($datarray,'author_name')) || (! x($datarray,'author_link'))) {
logger('consume_feed: no author information! ' . print_r($datarray,true));
continue;
}
@@ -3063,7 +3173,8 @@ logger('consume_feed: processing ' . $item_id);
$datarray['parent_mid'] = $parent_mid;
$datarray['uid'] = $importer['channel_id'];
- $datarray['contact-id'] = $contact['id'];
+// $datarray['contact-id'] = $contact['id'];
+
if((activity_match($datarray['verb'],ACTIVITY_LIKE)) || (activity_match($datarray['verb'],ACTIVITY_DISLIKE))) {
$datarray['type'] = 'activity';
$datarray['gravity'] = GRAVITY_LIKE;
@@ -3250,6 +3361,28 @@ logger('consume_feed: ' . print_r($datarray,true));
}
+function handle_feed($uid,$abook_id,$url) {
+
+ require_once('include/Contact.php');
+ $channel = channelx_by_n($uid);
+ if(! $channel)
+ return;
+ $x = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d limit 1",
+ dbesc($abook_id),
+ intval($uid)
+ );
+
+ $recurse = 0;
+ $z = z_fetch_url($url,false,$recurse,array('novalidate' => true));
+
+logger('handle_feed:' . print_r($z,true));
+
+ if($z['success']) {
+ consume_feed($z['body'],$channel,$x[0],0);
+ consume_feed($z['body'],$channel,$x[0],1);
+ }
+}
+
function atom_author($tag,$name,$uri,$h,$w,$type,$photo) {
$o = '';