]> git.mxchange.org Git - friendica.git/blob - src/Module/Followers.php
5bd3fe0ce2ef238b165fa52999c491400ecf4bc8
[friendica.git] / src / Module / Followers.php
1 <?php
2 /**
3  * @file src/Module/Followers.php
4  */
5 namespace Friendica\Module;
6
7 use Friendica\BaseModule;
8 use Friendica\Core\System;
9 use Friendica\Model\User;
10 use Friendica\Protocol\ActivityPub;
11
12 /**
13  * ActivityPub Followers
14  */
15 class Followers extends BaseModule
16 {
17         public static function rawContent()
18         {
19                 $a = self::getApp();
20
21                 // @TODO: Replace with parameter from router
22                 if (empty($a->argv[1])) {
23                         throw new \Friendica\Network\HTTPException\NotFoundException();
24                 }
25
26                 // @TODO: Replace with parameter from router
27                 $owner = User::getOwnerDataByNick($a->argv[1]);
28                 if (empty($owner)) {
29                         throw new \Friendica\Network\HTTPException\NotFoundException();
30                 }
31
32                 $page = $_REQUEST['page'] ?? null;
33
34                 $followers = ActivityPub\Transmitter::getFollowers($owner, $page);
35
36                 header('Content-Type: application/activity+json');
37                 echo json_encode($followers);
38                 exit();
39         }
40 }