X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=df3bee1423c242a0ac6a9cd4e7ec0b23c4298b9e;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=a3577da320b541952438d2ec4c152b18df019f3b;hpb=f2c31ef1c0e92208b58d22791fc72d0ad3e3d6ae;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index a3577da320..df3bee1423 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -1,27 +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(array $parameters = []) + protected function rawContent(array $request = []) { $addr = trim($_GET['addr'] ?? ''); + if (!$addr) { + throw new NotFoundException('Parameter "addr" is missing or empty'); + } - if ($addr) { - $url = Probe::uri($addr)['url'] ?? ''; - - if ($url) { - System::externalRedirect($url); - exit(); - } + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); } + + System::externalRedirect($contact['url']); } }