* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function isFollowerByURL(string $url, uid $uid): bool
+ public static function isFollowerByURL(string $url, int $uid): bool
{
$cid = self::getIdForURL($url, $uid);
}
$file_suffix = 'jpg';
+ $url = DI::baseUrl() . '/profile/' . $user['nickname'];
+
+ $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' => $url,
+ // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
+ 'nurl' => Strings::normaliseLink($url),
+ 'uri-id' => ItemURI::getIdByURI($url),
+ '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'],
+ ];
- $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];
-
- // 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)) {
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function getIdForURL(string $url, int $uid = 0, $update = null, array $default = []): int
+ public static function getIdForURL(string $url = null, int $uid = 0, $update = null, array $default = []): int
{
$contact_id = 0;
- if ($url == '') {
+ if (empty($url)) {
Logger::notice('Empty url, quitting', ['url' => $url, 'user' => $uid, 'default' => $default]);
return 0;
}