]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/APContact.php
Replace profile tab GET parameter by route
[friendica.git] / src / Model / APContact.php
index bae420c55dc549761fd0a101edb315bfe96c92a6..dd27daf10d36374d803730264db0638b8b4d684c 100644 (file)
@@ -6,18 +6,17 @@
 
 namespace Friendica\Model;
 
-use Friendica\BaseObject;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Logger;
-use Friendica\Core\Config;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Util\Network;
 use Friendica\Util\JsonLD;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Strings;
 
-class APContact extends BaseObject
+class APContact
 {
        /**
         * Resolves the profile url from the address by using webfinger
@@ -34,7 +33,7 @@ class APContact extends BaseObject
                        return false;
                }
 
-               $xrd_timeout = Config::get('system', 'xrd_timeout');
+               $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
 
                $webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
 
@@ -84,7 +83,7 @@ class APContact extends BaseObject
        public static function getByURL($url, $update = null)
        {
                if (empty($url)) {
-                       return false;
+                       return [];
                }
 
                $fetched_contact = false;
@@ -110,7 +109,7 @@ class APContact extends BaseObject
                        }
 
                        if (!is_null($update)) {
-                               return DBA::isResult($apcontact) ? $apcontact : false;
+                               return DBA::isResult($apcontact) ? $apcontact : [];
                        }
 
                        if (DBA::isResult($apcontact)) {
@@ -192,6 +191,7 @@ class APContact extends BaseObject
                        $apcontact['addr'] = '';
                }
 
+               $apcontact['pubkey'] = null;
                if (!empty($compacted['w3id:publicKey'])) {
                        $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value'));
                }
@@ -229,9 +229,7 @@ class APContact extends BaseObject
                                }
                        }
                }
-/*
-               $apcontact['inbox'] = JsonLD::fetchElement($compacted, 'ldp:inbox', '@id');
-*/
+
                // To-Do
 
                // Unhandled