From a4901402184f6d339d6fd068ea2698ebdb9bf5f8 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Thu, 16 Oct 2014 10:51:36 +0200 Subject: [PATCH 1/2] add jsonp support to api --- include/api.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index f6096f2907..db55c05fed 100644 --- a/include/api.php +++ b/include/api.php @@ -166,7 +166,10 @@ case "json": header ("Content-Type: application/json"); foreach($r as $rr) - return json_encode($rr); + $json = json_encode($rr); + if ($_GET['callback']) + $json = $_GET['callback']."(".$json.")"; + return $json; break; case "rss": header ("Content-Type: application/rss+xml"); From 905341717960ea444f9937867c0e5770f5eab0b4 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Thu, 16 Oct 2014 11:55:59 +0200 Subject: [PATCH 2/2] fix small bug in direct messages api --- include/api.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/api.php b/include/api.php index db55c05fed..e22fb9d74a 100644 --- a/include/api.php +++ b/include/api.php @@ -2295,12 +2295,10 @@ $recipient = $user_info; $sender = api_get_user($a,normalise_link($item['contact-url'])); } - elseif ($box == "sentbox" || $item['from-url'] != $profile_url){ + elseif ($box == "sentbox" || $item['from-url'] == $profile_url){ $recipient = api_get_user($a,normalise_link($item['contact-url'])); $sender = $user_info; - } - $ret[]=api_format_messages($item, $recipient, $sender); }