Merge branch 'MDL-52289-master' of git://github.com/jleyva/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 22 Dec 2015 05:51:14 +0000 (13:51 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 22 Dec 2015 05:51:14 +0000 (13:51 +0800)
message/output/airnotifier/classes/manager.php

index f395c28..6af514f 100644 (file)
@@ -139,6 +139,7 @@ class message_airnotifier_manager {
                 return $key['accesskey'];
             }
         }
+        debugging("Unexpected response from the Airnotifier server: $resp");
         return false;
     }
 
@@ -164,11 +165,12 @@ class message_airnotifier_manager {
         $params = array();
         $resp = $curl->post($serverurl, $params);
 
-        if ($resp = json_decode($resp, true)) {
-            if (!empty($resp['status'])) {
-                return $resp['status'] == 'ok' || $resp['status'] == 'token exists';
+        if ($token = json_decode($resp, true)) {
+            if (!empty($token['status'])) {
+                return $token['status'] == 'ok' || $token['status'] == 'token exists';
             }
         }
+        debugging("Unexpected response from the Airnotifier server: $resp");
         return false;
     }