diff --git a/src/Model/Contact.php b/src/Model/Contact.php index a6bb882e86..01ef3d664e 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -704,22 +704,31 @@ class Contact $file_suffix = 'jpg'; - $fields = ['name' => $profile['name'], 'nick' => $user['nickname'], - 'avatar-date' => $self['avatar-date'], 'location' => Profile::formatLocation($profile), - 'about' => $profile['about'], 'keywords' => $profile['pub_keywords'], - 'contact-type' => $user['account-type'], 'prvkey' => $user['prvkey'], - 'pubkey' => $user['pubkey'], 'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'], 'network' => Protocol::DFRN]; + $fields = [ + 'name' => $profile['name'], + 'nick' => $user['nickname'], + 'avatar-date' => $self['avatar-date'], + 'location' => Profile::formatLocation($profile), + 'about' => $profile['about'], + 'keywords' => $profile['pub_keywords'], + 'contact-type' => $user['account-type'], + 'prvkey' => $user['prvkey'], + 'pubkey' => $user['pubkey'], + 'xmpp' => $profile['xmpp'], + 'matrix' => $profile['matrix'], + 'network' => Protocol::DFRN, + 'url' => DI::baseUrl() . '/profile/' . $user['nickname'], + 'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3), + 'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'], + 'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'], + 'poll' => DI::baseUrl() . '/dfrn_poll/'. $user['nickname'], + 'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'], + 'poco' => DI::baseUrl() . '/poco/' . $user['nickname'], + ]; // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine. - $fields['url'] = DI::baseUrl() . '/profile/' . $user['nickname']; $fields['nurl'] = Strings::normaliseLink($fields['url']); $fields['uri-id'] = ItemURI::getIdByURI($fields['url']); - $fields['addr'] = $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3); - $fields['request'] = DI::baseUrl() . '/dfrn_request/' . $user['nickname']; - $fields['notify'] = DI::baseUrl() . '/dfrn_notify/' . $user['nickname']; - $fields['poll'] = DI::baseUrl() . '/dfrn_poll/'. $user['nickname']; - $fields['confirm'] = DI::baseUrl() . '/dfrn_confirm/' . $user['nickname']; - $fields['poco'] = DI::baseUrl() . '/poco/' . $user['nickname']; $avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]); if (DBA::isResult($avatar)) { diff --git a/src/Model/User.php b/src/Model/User.php index a05d8a2770..1e002aa3f8 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -212,32 +212,33 @@ class User throw new Exception(DI::l10n()->t('SERIOUS ERROR: Generation of security keys failed.')); } - $system = []; - $system['uid'] = 0; - $system['created'] = DateTimeFormat::utcNow(); - $system['self'] = true; - $system['network'] = Protocol::ACTIVITYPUB; - $system['name'] = 'System Account'; - $system['addr'] = $system_actor_name . '@' . DI::baseUrl()->getHostname(); - $system['nick'] = $system_actor_name; - $system['url'] = DI::baseUrl() . '/friendica'; + $system = [ + 'uid' => 0, + 'created' => DateTimeFormat::utcNow(), + 'self' => true, + 'network' => Protocol::ACTIVITYPUB, + 'name' => 'System Account', + 'addr' => $system_actor_name . '@' . DI::baseUrl()->getHostname(), + 'nick' => $system_actor_name, + 'url' => DI::baseUrl() . '/friendica', + 'pubkey' => $keys['pubkey'], + 'prvkey' => $keys['prvkey'], + 'blocked' => 0, + 'pending' => 0, + 'contact-type' => Contact::TYPE_RELAY, // In AP this is translated to 'Application' + 'name-date' => DateTimeFormat::utcNow(), + 'uri-date' => DateTimeFormat::utcNow(), + 'avatar-date' => DateTimeFormat::utcNow(), + 'closeness' => 0, + 'baseurl' => DI::baseUrl(), + ]; $system['avatar'] = $system['photo'] = Contact::getDefaultAvatar($system, Proxy::SIZE_SMALL); - $system['thumb'] = Contact::getDefaultAvatar($system, Proxy::SIZE_THUMB); - $system['micro'] = Contact::getDefaultAvatar($system, Proxy::SIZE_MICRO); + $system['thumb'] = Contact::getDefaultAvatar($system, Proxy::SIZE_THUMB); + $system['micro'] = Contact::getDefaultAvatar($system, Proxy::SIZE_MICRO); + $system['nurl'] = Strings::normaliseLink($system['url']); + $system['gsid'] = GServer::getID($system['baseurl']); - $system['nurl'] = Strings::normaliseLink($system['url']); - $system['pubkey'] = $keys['pubkey']; - $system['prvkey'] = $keys['prvkey']; - $system['blocked'] = 0; - $system['pending'] = 0; - $system['contact-type'] = Contact::TYPE_RELAY; // In AP this is translated to 'Application' - $system['name-date'] = DateTimeFormat::utcNow(); - $system['uri-date'] = DateTimeFormat::utcNow(); - $system['avatar-date'] = DateTimeFormat::utcNow(); - $system['closeness'] = 0; - $system['baseurl'] = DI::baseUrl(); - $system['gsid'] = GServer::getID($system['baseurl']); Contact::insert($system); }