aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/api.php26
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);
}