X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=edff8b833c568b32932476f2122ef5259a664ce4;hb=96d2cddb54f3ea3ead6e43e5ca1f814ed6327987;hp=692e905914472081306002f19ef6ac74fb258b06;hpb=8821d33f73785884cfce83e7b23d3ef19cc1bc11;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 692e905914..edff8b833c 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() + 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) { - System::externalRedirect($url); - exit(); - } + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); } + + System::externalRedirect($contact['url']); } }