From 134a2dadde7373364916794c7aee7c1c029c0468 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 25 Jul 2008 10:07:21 +0000 Subject: git-svn-id: https://code.elgg.org/elgg/trunk@1520 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/api.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/engine/lib/api.php b/engine/lib/api.php index 5ce1f62fc..0a3dbe8f5 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -770,7 +770,7 @@ $time = microtime(true); // Hard code the format - we're using PHP, so lets use PHP serialisation. - $call['format'] = "php"; + $call['view'] = "php"; // URL encode all the parameters foreach ($call as $k => $v){ @@ -785,20 +785,24 @@ // Construct headers if ($method == 'POST') $posthash = calculate_posthash($post_data, 'md5'); - $headers['X-Elgg-apikey'] = $keys['public']; - $headers['X-Elgg-time'] = $time; - $headers['X-Elgg-hmac-algo'] = 'sha1'; - $headers['X-Elgg-hmac'] = calculate_hmac('sha1', - $time, - $keys['public'], - $keys['private'], - $params, - $posthash - ); + if ((isset($keys['public'])) && (isset($keys['private']))) + { + $headers['X-Elgg-apikey'] = $keys['public']; + $headers['X-Elgg-time'] = $time; + $headers['X-Elgg-hmac-algo'] = 'sha1'; + $headers['X-Elgg-hmac'] = calculate_hmac('sha1', + $time, + $keys['public'], + $keys['private'], + $params, + $posthash + ); + } if ($method == 'POST') { $headers['X-Elgg-posthash'] = $posthash; $headers['X-Elgg-posthash-algo'] = 'md5'; + $headers['Content-type'] = $content_type; $headers['Content-Length'] = strlen($post_data); } -- cgit v1.2.3