From 3c021db5f047b70bd18c84361bf402afc6528d62 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Tue, 31 Jul 2018 23:02:32 +0100 Subject: [PATCH] patches for getBestSupportedMimeType --- ActivityPubPlugin.php | 6 +++++- actions/inbox/Follow.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ActivityPubPlugin.php b/ActivityPubPlugin.php index b40a569..094fe56 100755 --- a/ActivityPubPlugin.php +++ b/ActivityPubPlugin.php @@ -905,8 +905,12 @@ class ActivityPubReturn */ public static function getBestSupportedMimeType($mimeTypes = null) { + if (!isset($_SERVER['HTTP_ACCEPT'])) { + return null; + } + // Values will be stored in this array - $AcceptTypes = array(); + $AcceptTypes = []; // Accept header is case insensitive, and whitespace isn’t important $accept = strtolower(str_replace(' ', '', $_SERVER['HTTP_ACCEPT'])); diff --git a/actions/inbox/Follow.php b/actions/inbox/Follow.php index 12ab597..944541b 100755 --- a/actions/inbox/Follow.php +++ b/actions/inbox/Follow.php @@ -46,9 +46,9 @@ try { try { if (!Subscription::exists($actor_profile, $object_profile)) { Subscription::start($actor_profile, $object_profile); - common_debug('ActivityPubPlugin: Accepted Follow request from '.$data->actor.' to '.$data->object); $postman = new Activitypub_postman($actor_profile); $postman->send(json_encode(Activitypub_accept::accept_to_array(Activitypub_follow::follow_to_array($data->actor, $data->object))), $object_profile->getInbox()); + common_debug('ActivityPubPlugin: Accepted Follow request from '.$data->actor.' to '.$data->object); ActivityPubReturn::answer('', 202); } else { common_debug('ActivityPubPlugin: Received a repeated Follow request from '.$data->actor.' to '.$data->object);