<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$numeric_fields = ['gsid', 'hide', 'account-type', 'manually-approve'];
+ if (!empty($data['photo']) && !Network::isValidHttpUrl($data['photo'])) {
+ Logger::info('Invalid URL for photo', ['url' => $data['url'], 'photo' => $data['photo']]);
+ unset($data['photo']);
+ }
+
$newdata = [];
foreach ($fields as $field) {
if (isset($data[$field])) {
$result = self::zot($webfinger, $result, $baseurl);
}
if ((!$result && ($network == '')) || ($network == Protocol::PUMPIO)) {
- $result = self::pumpio($webfinger, $addr);
+ $result = self::pumpio($webfinger, $addr, $baseurl);
}
if (empty($result['network']) && empty($ap_profile['network']) || ($network == Protocol::FEED)) {
$result = self::feed($uri);
*
* @return array Profile data
*/
- private static function pumpioProfileData(string $profile_link): array
+ private static function pumpioProfileData(string $profile_link, string $baseurl): array
{
$curlResult = DI::httpClient()->get($profile_link, HttpClientAccept::HTML);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
foreach ($avatar->attributes as $attribute) {
if ($attribute->name == 'src') {
$data['photo'] = trim($attribute->value);
+ if (!empty($data['photo']) && !parse_url($data['photo'], PHP_URL_SCHEME) && !parse_url($data['photo'], PHP_URL_HOST)) {
+ $data['photo'] = $baseurl . $data['photo'];
+ }
}
}
}
*
* @return array pump.io data
*/
- private static function pumpio(array $webfinger, string $addr): array
+ private static function pumpio(array $webfinger, string $addr, string $baseurl): array
{
$data = [];
// The array is reversed to take into account the order of preference for same-rel links
return [];
}
- $profile_data = self::pumpioProfileData($data['url']);
+ $profile_data = self::pumpioProfileData($data['url'], $baseurl);
if (!$profile_data) {
return [];
$approfile = ActivityPub\Transmitter::getProfile($uid);
$split_name = Diaspora::splitName($owner['name']);
-
+
if (empty($owner['gsid'])) {
$owner['gsid'] = GServer::getID($approfile['generator']['url']);
}
'batch' => $approfile['generator']['url'] . '/receive/public',
'notify' => $owner['notify'],
'poll' => $owner['poll'],
- 'poco' => $owner['poco'],
+ 'poco' => $owner['poco'],
'network' => Protocol::DIASPORA,
'pubkey' => $owner['upubkey'],
]