]> git.mxchange.org Git - friendica.git/blob - src/Module/Outbox.php
4fc05076310ad2593fb6dff4d469b9c243eb6da1
[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\Model\User;
10 use Friendica\Protocol\ActivityPub;
11
12 /**
13  * ActivityPub Outbox
14  */
15 class Outbox 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                 $owner = User::getOwnerDataByNick($a->argv[1]);
27                 if (empty($owner)) {
28                         throw new \Friendica\Network\HTTPException\NotFoundException();
29                 }
30
31                 $page = $_REQUEST['page'] ?? null;
32
33                 /// @todo Add Authentication to enable fetching of non public content
34                 // $requester = HTTPSignature::getSigner('', $_SERVER);
35
36                 $outbox = ActivityPub\Transmitter::getOutbox($owner, $page);
37
38                 header('Content-Type: application/activity+json');
39                 echo json_encode($outbox);
40                 exit();
41         }
42 }