1
0
Fork 0
- reformatted arrays
This commit is contained in:
Roland Häder 2022-07-29 06:30:29 +02:00
parent f97a80e2cb
commit 676ca36c52
Signed by: roland
GPG key ID: C82EDE5DDFA0BA77
2 changed files with 45 additions and 35 deletions

View file

@ -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)) {

View file

@ -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);
}