From 29b9d1887176ca2f477f1301f6aac463375c2a5f Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 9 Nov 2010 20:38:24 -0800 Subject: [PATCH] lint --- include/items.php | 60 ++++++++++++++++++++++++++-------------------- view/atom_feed.tpl | 2 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/include/items.php b/include/items.php index 8dbb591288..65041418bc 100644 --- a/include/items.php +++ b/include/items.php @@ -293,7 +293,7 @@ function get_atom_elements($feed,$item) { // No photo/profile-link on the item - look at the feed level - if((! $res['author-link']) || (! $res['author-avatar'])) { + if((! (x($res,'author-link'))) || (! (x($res,'author-avatar')))) { $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']; @@ -316,7 +316,7 @@ function get_atom_elements($feed,$item) { foreach($base as $link) { if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link'])) $res['author-link'] = unxmlify($link['attribs']['']['href']); - if(! $res['author-avatar']) { + if(! (x($res,'author-avatar'))) { if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') $res['author-avatar'] = unxmlify($link['attribs']['']['href']); } @@ -517,31 +517,35 @@ function item_store($arr) { $arr['gravity'] = 0; elseif(activity_match($arr['verb'],ACTIVITY_POST)) $arr['gravity'] = 6; + else + $arr['gravity'] = 6; // extensible catchall if(! x($arr,'type')) - $arr['type'] = 'remote'; - $arr['wall'] = ((intval($arr['wall'])) ? 1 : 0); - $arr['uri'] = notags(trim($arr['uri'])); - $arr['author-name'] = notags(trim($arr['author-name'])); - $arr['author-link'] = notags(trim($arr['author-link'])); - $arr['author-avatar'] = notags(trim($arr['author-avatar'])); - $arr['owner-name'] = notags(trim($arr['owner-name'])); - $arr['owner-link'] = notags(trim($arr['owner-link'])); - $arr['owner-avatar'] = notags(trim($arr['owner-avatar'])); - $arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert()); - $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert()); - $arr['changed'] = datetime_convert(); - $arr['title'] = notags(trim($arr['title'])); - $arr['location'] = notags(trim($arr['location'])); - $arr['coord'] = notags(trim($arr['coord'])); - $arr['body'] = escape_tags(trim($arr['body'])); - $arr['last-child'] = intval($arr['last-child']); - $arr['visible'] = ((x($arr,'visible') !== false) ? intval($arr['visible']) : 1); - $arr['deleted'] = 0; - $arr['parent-uri'] = notags(trim($arr['parent-uri'])); - $arr['verb'] = notags(trim($arr['verb'])); - $arr['object-type'] = notags(trim($arr['object-type'])); - $arr['object'] = trim($arr['object']); + $arr['type'] = 'remote'; + $arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0); + $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string()); + $arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : ''); + $arr['author-link'] = ((x($arr,'author-link')) ? notags(trim($arr['author-link'])) : ''); + $arr['author-avatar'] = ((x($arr,'author-avatar')) ? notags(trim($arr['author-avatar'])) : ''); + $arr['owner-name'] = ((x($arr,'owner-name')) ? notags(trim($arr['owner-name'])) : ''); + $arr['owner-link'] = ((x($arr,'owner-link')) ? notags(trim($arr['owner-link'])) : ''); + $arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : ''); + $arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert()); + $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert()); + $arr['changed'] = datetime_convert(); + $arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : ''); + $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : ''); + $arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : ''); + $arr['body'] = ((x($arr,'body')) ? escape_tags(trim($arr['body'])) : ''); + $arr['last-child'] = ((x($arr,'last-child')) ? intval($arr['last-child']) : 0 ); + $arr['visible'] = ((x($arr,'visible') !== false) ? intval($arr['visible']) : 1 ); + $arr['deleted'] = 0; + $arr['parent-uri'] = ((x($arr,'parent-uri')) ? notags(trim($arr['parent-uri'])) : ''); + $arr['verb'] = ((x($arr,'verb')) ? notags(trim($arr['verb'])) : ''); + $arr['object-type'] = ((x($arr,'object-type')) ? notags(trim($arr['object-type'])) : ''); + $arr['object'] = ((x($arr,'object')) ? trim($arr['object']) : ''); + $arr['target-type'] = ((x($arr,'target-type')) ? notags(trim($arr['target-type'])) : ''); + $arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : ''); $parent_id = 0; $parent_missing = false; @@ -1179,8 +1183,12 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { $o .= '' . "\r\n"; if($comment) $o .= '' . intval($item['last-child']) . '' . "\r\n"; - if($item['location']) + + if($item['location']) { $o .= '' . xmlify($item['location']) . '' . "\r\n"; + $o .= '' . xmlify($item['location']) . '' . "\r\n"; + } + if($item['coord']) $o .= '' . xmlify($item['coord']) . '' . "\r\n"; diff --git a/view/atom_feed.tpl b/view/atom_feed.tpl index ef02728b8c..e993a622e4 100644 --- a/view/atom_feed.tpl +++ b/view/atom_feed.tpl @@ -6,7 +6,7 @@ xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:georss="http://www.georss.org/georss" - xmlns:poco="http://portablecontacts.net/spec/1.0" > + xmlns:poco="http://portablecontacts.net/spec/1.0" > $feed_id $feed_title