]> git.mxchange.org Git - friendica.git/blob - src/Module/Outbox.php
Merge pull request #8019 from nupplaphil/task/replace_getClass
[friendica.git] / src / Module / Outbox.php
1 <?php
2 /**
3  * @file src/Module/Outbox.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 Outbox
15  */
16 class Outbox 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                 $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                 /// @todo Add Authentication to enable fetching of non public content
35                 // $requester = HTTPSignature::getSigner('', $_SERVER);
36
37                 $outbox = ActivityPub\Transmitter::getOutbox($owner, $page);
38
39                 header('Content-Type: application/activity+json');
40                 echo json_encode($outbox);
41                 exit();
42         }
43 }