X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=edff8b833c568b32932476f2122ef5259a664ce4;hb=423e60174ef7ae4948fa44ac725c8bc54234966a;hp=7f956a8250243d604341f68cf1d4546a9324609a;hpb=2ef81108b37a85642e1f3380044a03cb1cd8719a;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 7f956a8250..edff8b833c 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -1,26 +1,48 @@ . + * + */ namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Network\Probe; +use Friendica\Core\System; +use Friendica\Model\Contact; +use Friendica\Network\HTTPException\NotFoundException; /** * Redirects to another URL based on the parameter 'addr' */ class Acctlink extends BaseModule { - public static function content() + protected function rawContent(array $request = []) { - $addr = defaults($_GET, 'addr', false); - - if ($addr) { - $url = defaults(Probe::uri(trim($addr)), 'url', false); + $addr = trim($_GET['addr'] ?? ''); + if (!$addr) { + throw new NotFoundException('Parameter "addr" is missing or empty'); + } - if ($url) { - self::getApp()->redirect($url); - exit(); - } + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); } + + System::externalRedirect($contact['url']); } }