X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FActivityPub%2FReceiver.php;h=33c027933ccac88601b838b07bc22b1df60b2415;hb=88870d18be53fc38d70e842cdc35c7a1bc703b75;hp=e8c9ac8f7ba3cdc6bfd3190b53b7d30dc3429a1c;hpb=5c9ce790bfb0da7dcfe7a8332613b63f6eb7fac9;p=friendica.git diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index e8c9ac8f7b..33c027933c 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -80,13 +80,13 @@ class Receiver /** * Checks incoming message from the inbox * - * @param $body - * @param $header + * @param string $body Body string + * @param array $header Header lines * @param integer $uid User ID + * @return void * @throws \Exception - * @todo Find type for $body/$header */ - public static function processInbox($body, $header, int $uid) + public static function processInbox(string $body, array $header, int $uid) { $activity = json_decode($body, true); if (empty($activity)) { @@ -96,9 +96,9 @@ class Receiver $ldactivity = JsonLD::compact($activity); - $actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id'); - + $actor = JsonLD::fetchElement($ldactivity, 'as:actor', '@id') ?? ''; $apcontact = APContact::getByURL($actor); + if (empty($apcontact)) { Logger::notice('Unable to retrieve AP contact for actor - message is discarded', ['actor' => $actor]); return; @@ -880,7 +880,7 @@ class Receiver */ private static function getReceivers(array $activity, string $actor, array $tags = [], bool $fetch_unlisted = false): array { - $reply = $receivers = []; + $reply = $receivers = $profile = []; // When it is an answer, we inherite the receivers from the parent $replyto = JsonLD::fetchElement($activity, 'as:inReplyTo', '@id'); @@ -1087,6 +1087,7 @@ class Receiver * @param integer $cid Contact ID * @param integer $uid User ID * @param string $url Profile URL + * @return void * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -1113,6 +1114,7 @@ class Receiver * * @param $receivers * @param $actor + * @return void * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */