From 71347bb9e0c5daca206b0ea32812874e165b7b63 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 6 Aug 2013 03:29:57 -0700 Subject: we've been storing json_encoded structures on disk in several places because it's a lot easier to parse than xml - but OMG do they get mangled - stored as single quoted strings when escaped as if double quoted. We need to use my new function json_decode_plus() wherever we need to parse one of these babies to make sure we get it right. Maybe we should've just used serialize(). --- include/conversation.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index fab8da9f9..2d92b37be 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -92,8 +92,8 @@ function item_redir_and_replace_images($body, $images, $cid) { function localize_item(&$item){ if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){ - - $obj= json_decode($item['object'],true); + + $obj = json_decode_plus($item['object']); if($obj['author'] && $obj['author']['link']) $author_link = get_rel_link($obj['author']['link'],'alternate'); @@ -106,7 +106,7 @@ function localize_item(&$item){ $Bphoto = ''; - switch($obj->type) { + switch($obj['type']) { case ACTIVITY_OBJ_PHOTO: $post_type = t('photo'); break; @@ -142,12 +142,10 @@ function localize_item(&$item){ break; } - // If we couldn't parse something useful, don't bother translating. // We need something better than zid here, probably magic_link(), but it needs writing if($author_link && $author_name && $item_url) { - $author = '[zrl=' . chanlink_url($item['author']['xchan_url']) . ']' . $item['author']['xchan_name'] . '[/zrl]'; $objauthor = '[zrl=' . chanlink_url($author_link) . ']' . $author_name . '[/zrl]'; -- cgit v1.2.3