]> git.mxchange.org Git - friendica.git/blobdiff - mod/pubsub.php
Merge pull request #11913 from tobiasd/2022.09-CHANGELOG
[friendica.git] / mod / pubsub.php
index 7d5c70a54cd682251dce2a9d8eff069ef83a22b6..a740b7b81da89c5e03ea6e5d5e03401c0cfbb25d 100644 (file)
@@ -22,6 +22,7 @@
 use Friendica\App;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
+use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
@@ -38,7 +39,7 @@ function hub_return($valid, $body)
        } else {
                throw new \Friendica\Network\HTTPException\NotFoundException();
        }
-       exit();
+       System::exit();
 }
 
 // when receiving an XML feed, always return OK
@@ -53,7 +54,7 @@ function pubsub_init(App $a)
        $nick       = ((DI::args()->getArgc() > 1) ? trim(DI::args()->getArgv()[1])   : '');
        $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2]) : 0 );
 
-       if ($_SERVER['REQUEST_METHOD'] === 'GET') {
+       if (DI::args()->getMethod() === App\Router::GET) {
                $hub_mode      = trim($_GET['hub_mode']         ?? '');
                $hub_topic     = trim($_GET['hub_topic']        ?? '');
                $hub_challenge = trim($_GET['hub_challenge']    ?? '');
@@ -144,7 +145,7 @@ function pubsub_post(App $a)
        }
 
        // We only import feeds from OStatus here
-       if ($contact['network'] != Protocol::OSTATUS) {
+       if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS])) {
                Logger::warning('Unexpected network', ['contact' => $contact]);
                hub_post_return();
        }