diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-25 10:07:21 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-25 10:07:21 +0000 |
commit | 134a2dadde7373364916794c7aee7c1c029c0468 (patch) | |
tree | 68e13b3438ef588fb55cb27724ff058383202ac0 /engine/lib | |
parent | 0e7ce9d8b2da9b81747ae7fcab434934e4618c38 (diff) | |
download | elgg-134a2dadde7373364916794c7aee7c1c029c0468.tar.gz elgg-134a2dadde7373364916794c7aee7c1c029c0468.tar.bz2 |
git-svn-id: https://code.elgg.org/elgg/trunk@1520 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/api.php | 26 |
1 files 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); } |