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