Move mod/notice to src/Module/Notice

This commit is contained in:
Philipp Holzer 2019-05-18 20:02:21 +02:00
parent 33ec3d8051
commit 9092cb1beb
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
4 changed files with 71 additions and 23 deletions

View file

@ -0,0 +1,34 @@
<?php
namespace Friendica\Module\GnuSocial;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Model\ItemUser;
use Friendica\Network\HTTPException;
/**
* GNU Social -> friendica items permanent-url compatibility
*/
class Notice extends BaseModule
{
public static function rawContent()
{
$a = self::getApp();
// @TODO: Replace with parameter from router
$id = ($a->argc > 1) ? $a->argv[1] : 0;
if (empty($id)) {
throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
}
$user = ItemUser::getUserForItemId($id, ['nickname']);
if (empty($user)) {
throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
} else {
$a->internalRedirect('display/' . $user['nickname'] . '/' . $id);
}
}
}