X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=df3bee1423c242a0ac6a9cd4e7ec0b23c4298b9e;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=692e905914472081306002f19ef6ac74fb258b06;hpb=8821d33f73785884cfce83e7b23d3ef19cc1bc11;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 692e905914..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() + 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']); } }