X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=3fa679ebc3ff629fa9ee2788dcb6f70825afbd20;hb=e7384288766f342da98b7d0ada082db516501ac6;hp=f14905277a876eaeadd3e0f755f8038bf8c5d66c;hpb=db0b848ae30983b394847a5597c3f7c7332cfe7c;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index f14905277a..3fa679ebc3 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($_REQUEST, 'addr', false); - - if ($addr) { - $url = defaults(Probe::uri($addr), 'url', false); + $addr = trim($_GET['addr'] ?? ''); + if (!$addr) { + throw new NotFoundException('Parameter "addr" is missing or empty'); + } - if ($url) { - goaway($url); - exit(); - } + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); } + + System::externalRedirect($contact['url']); } }