From a63de472cf1b5cff1ebda821d3a6ba39cf37f839 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 31 Aug 2014 20:51:05 -0700 Subject: various rss fixes --- include/items.php | 31 ++++++++++++++++++++----------- include/text.php | 5 +++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/include/items.php b/include/items.php index 4614aa642..f489eeb0a 100755 --- a/include/items.php +++ b/include/items.php @@ -1499,6 +1499,9 @@ function get_atom_elements($feed,$item,&$author) { if($d2 > $d3) $res['edited'] = datetime_convert(); + $res['created'] = datetime_convert('UTC','UTC',$res['created']); + $res['edited'] = datetime_convert('UTC','UTC',$res['edited']); + $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner'); if(! $rawowner) $rawowner = $item->get_item_tags(NAMESPACE_ZOT,'owner'); @@ -1560,7 +1563,7 @@ function get_atom_elements($feed,$item,&$author) { $termterm = notags(trim(unxmlify($term))); if($termterm) { - $terms = array( + $terms[] = array( 'otype' => TERM_OBJ_POST, 'type' => $termtype, 'url' => $termurl, @@ -1568,7 +1571,7 @@ function get_atom_elements($feed,$item,&$author) { ); } } - $res['term'] = implode(',', $tag_arr); + $res['term'] = $terms; } $attach = $item->get_enclosures(); @@ -1663,6 +1666,9 @@ function get_atom_elements($feed,$item,&$author) { $res['target'] = $obj; } + $res['public_policy'] = 'specific'; + $res['comment_policy'] = 'none'; + $arr = array('feed' => $feed, 'item' => $item, 'result' => $res); call_hooks('parse_atom', $arr); @@ -3207,14 +3213,14 @@ function consume_feed($xml,$importer,&$contact,$pass = 0) { $datarray['uid'] = $importer['channel_id']; //FIXME - $datarray['author_xchan'] = $contact['xchan_hash']; + $datarray['owner_xchan'] = $datarray['author_xchan'] = $contact['xchan_hash']; // FIXME pull out the author and owner logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA); -// $xx = item_store($datarray); + $xx = item_store($datarray); $r = $xx['item_id']; continue; } @@ -3267,18 +3273,21 @@ function consume_feed($xml,$importer,&$contact,$pass = 0) { $datarray['parent_mid'] = $item_id; $datarray['uid'] = $importer['channel_id']; //FIXME - $datarray['author_xchan'] = $contact['author_xchan']; - + $datarray['owner_xchan'] = $datarray['author_xchan'] = $contact['xchan_hash']; + if(! link_compare($author['owner_link'],$contact['xchan_url'])) { logger('consume_feed: Correcting item owner.', LOGGER_DEBUG); - $author['owner-name'] = $contact['name']; - $author['owner-link'] = $contact['url']; - $author['owner-avatar'] = $contact['thumb']; + $author['owner_name'] = $contact['name']; + $author['owner_link'] = $contact['url']; + $author['owner_avatar'] = $contact['thumb']; } + logger('consume_feed: author ' . print_r($author,true)); + + logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA); -// $xx = item_store($datarray); + $xx = item_store($datarray); $r = $xx['item_id']; continue; @@ -3311,7 +3320,7 @@ function handle_feed($uid,$abook_id,$url) { $recurse = 0; $z = z_fetch_url($url,false,$recurse,array('novalidate' => true)); -logger('handle_feed:' . print_r($z,true)); +//logger('handle_feed:' . print_r($z,true)); if($z['success']) { consume_feed($z['body'],$channel,$x[0],0); diff --git a/include/text.php b/include/text.php index 410d9bc96..7da6a8f2b 100644 --- a/include/text.php +++ b/include/text.php @@ -1865,6 +1865,11 @@ function xchan_query(&$items,$abook = true) { $chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash where xchan_hash in (" . implode(',', $arr) . ") and ( hubloc_flags & " . intval(HUBLOC_FLAGS_PRIMARY) . " )"); } + $xchans = q("select * from xchan where xchan_hash in (" . implode(',',$arr) . ") and xchan_network in ('rss','unknown')"); + if(! $chans) + $chans = $xchans; + else + $chans = array_merge($xchans,$chans); } if($items && count($items) && $chans && count($chans)) { for($x = 0; $x < count($items); $x ++) { -- cgit v1.2.3