- reformatted arrays
This commit is contained in:
Roland Häder 2022-07-29 06:30:29 +02:00
parent f97a80e2cb
commit 676ca36c52
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77
2 changed files with 45 additions and 35 deletions

View File

@ -704,22 +704,31 @@ class Contact
$file_suffix = 'jpg'; $file_suffix = 'jpg';
$fields = ['name' => $profile['name'], 'nick' => $user['nickname'], $fields = [
'avatar-date' => $self['avatar-date'], 'location' => Profile::formatLocation($profile), 'name' => $profile['name'],
'about' => $profile['about'], 'keywords' => $profile['pub_keywords'], 'nick' => $user['nickname'],
'contact-type' => $user['account-type'], 'prvkey' => $user['prvkey'], 'avatar-date' => $self['avatar-date'],
'pubkey' => $user['pubkey'], 'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'], 'network' => Protocol::DFRN]; '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. // 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['nurl'] = Strings::normaliseLink($fields['url']);
$fields['uri-id'] = ItemURI::getIdByURI($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]); $avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
if (DBA::isResult($avatar)) { if (DBA::isResult($avatar)) {

View File

@ -212,32 +212,33 @@ class User
throw new Exception(DI::l10n()->t('SERIOUS ERROR: Generation of security keys failed.')); throw new Exception(DI::l10n()->t('SERIOUS ERROR: Generation of security keys failed.'));
} }
$system = []; $system = [
$system['uid'] = 0; 'uid' => 0,
$system['created'] = DateTimeFormat::utcNow(); 'created' => DateTimeFormat::utcNow(),
$system['self'] = true; 'self' => true,
$system['network'] = Protocol::ACTIVITYPUB; 'network' => Protocol::ACTIVITYPUB,
$system['name'] = 'System Account'; 'name' => 'System Account',
$system['addr'] = $system_actor_name . '@' . DI::baseUrl()->getHostname(); 'addr' => $system_actor_name . '@' . DI::baseUrl()->getHostname(),
$system['nick'] = $system_actor_name; 'nick' => $system_actor_name,
$system['url'] = DI::baseUrl() . '/friendica'; '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['avatar'] = $system['photo'] = Contact::getDefaultAvatar($system, Proxy::SIZE_SMALL);
$system['thumb'] = Contact::getDefaultAvatar($system, Proxy::SIZE_THUMB); $system['thumb'] = Contact::getDefaultAvatar($system, Proxy::SIZE_THUMB);
$system['micro'] = Contact::getDefaultAvatar($system, Proxy::SIZE_MICRO); $system['micro'] = Contact::getDefaultAvatar($system, Proxy::SIZE_MICRO);
$system['nurl'] = Strings::normaliseLink($system['url']); $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']); $system['gsid'] = GServer::getID($system['baseurl']);
Contact::insert($system); Contact::insert($system);
} }