]> git.mxchange.org Git - friendica.git/blob - src/Module/GnuSocial/Notice.php
Merge pull request #7167 from MrPetovan/bug/7150-unescape-xml-entities
[friendica.git] / src / Module / GnuSocial / Notice.php
1 <?php
2
3 namespace Friendica\Module\GnuSocial;
4
5 use Friendica\BaseModule;
6 use Friendica\Core\L10n;
7 use Friendica\Database\DBA;
8 use Friendica\Network\HTTPException;
9
10 /**
11  * GNU Social -> friendica items permanent-url compatibility
12  */
13 class Notice extends BaseModule
14 {
15         public static function content()
16         {
17                 $a = self::getApp();
18
19                 // @TODO: Replace with parameter from router
20                 $id = ($a->argc > 1) ? $a->argv[1] : 0;
21
22                 if (empty($id)) {
23                         throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
24                 }
25
26                 $item = DBA::selectFirst('item', ['guid'], ['id' => $id]);
27
28                 if (empty($item )) {
29                         throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
30                 } else {
31                         $a->internalRedirect('display/' . $item['guid']);
32                 }
33         }
34 }