]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Magic.php
Merge pull request #7465 from nupplaphil/task/dice_cache_lock
[friendica.git] / src / Module / Magic.php
index 694af23208fb025d3b74266272def9ab560748bf..441fe7f157a33c61609744422dd94385a2cbb3ae 100644 (file)
@@ -28,10 +28,10 @@ class Magic extends BaseModule
 
                Logger::log('args: ' . print_r($_REQUEST, true), Logger::DATA);
 
-               $addr = ((x($_REQUEST, 'addr')) ? $_REQUEST['addr'] : '');
-               $dest = ((x($_REQUEST, 'dest')) ? $_REQUEST['dest'] : '');
-               $test = ((x($_REQUEST, 'test')) ? intval($_REQUEST['test']) : 0);
-               $owa  = ((x($_REQUEST, 'owa'))  ? intval($_REQUEST['owa'])  : 0);
+               $addr = defaults($_REQUEST, 'addr', '');
+               $dest = defaults($_REQUEST, 'dest', '');
+               $test = (!empty($_REQUEST['test']) ? intval($_REQUEST['test']) : 0);
+               $owa  = (!empty($_REQUEST['owa'])  ? intval($_REQUEST['owa'])  : 0);
 
                // NOTE: I guess $dest isn't just the profile url (could be also
                // other profile pages e.g. photo). We need to find a solution
@@ -74,7 +74,7 @@ class Magic extends BaseModule
                                $basepath = $exp[0];
 
                                $headers = [];
-                               $headers['Accept'] = 'application/x-dfrn+json';
+                               $headers['Accept'] = 'application/x-dfrn+json, application/x-zot+json';
                                $headers['X-Open-Web-Auth'] = Strings::getRandomHex();
 
                                // Create a header that is signed with the local users private key.
@@ -85,7 +85,7 @@ class Magic extends BaseModule
                                );
 
                                // Try to get an authentication token from the other instance.
-                               $curlResult = Network::curl($basepath . '/owa', false, $redirects, ['headers' => $headers]);
+                               $curlResult = Network::curl($basepath . '/owa', false, ['headers' => $headers]);
 
                                if ($curlResult->isSuccess()) {
                                        $j = json_decode($curlResult->getBody(), true);