]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/ActivityPub/Following.php
Use the post language for the language detection / config for quality
[friendica.git] / src / Module / ActivityPub / Following.php
index 08574b546f73c50fe3a253791392beea741d698e..1fc5eefd7b3c3066d5485cf156bab28c65488dcf 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,6 +22,7 @@
 namespace Friendica\Module\ActivityPub;
 
 use Friendica\BaseModule;
+use Friendica\Core\System;
 use Friendica\Model\Contact;
 use Friendica\Model\User;
 use Friendica\Protocol\ActivityPub;
@@ -31,23 +32,21 @@ use Friendica\Protocol\ActivityPub;
  */
 class Following extends BaseModule
 {
-       public static function rawContent()
+       protected function rawContent(array $request = [])
        {
-               if (empty(static::$parameters['nickname'])) {
+               if (empty($this->parameters['nickname'])) {
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
-               $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
+               $owner = User::getOwnerDataByNick($this->parameters['nickname']);
                if (empty($owner)) {
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
-               $page = $_REQUEST['page'] ?? null;
+               $page = !empty($request['page']) ? (int)$request['page'] : null;
 
                $following = ActivityPub\Transmitter::getContacts($owner, [Contact::SHARING, Contact::FRIEND], 'following', $page);
 
-               header('Content-Type: application/activity+json');
-               echo json_encode($following);
-               exit();
+               $this->jsonExit($following, 'application/activity+json');
        }
 }