X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FAcctlink.php;h=3fa679ebc3ff629fa9ee2788dcb6f70825afbd20;hb=8c778ca02e4daa3936842f0e9eccc055fec80221;hp=29aa99140c5316948c5035d791b26ebb712dc805;hpb=6606c9cbb2514fcc878ca6512819ef2d78533966;p=friendica.git diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 29aa99140c..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($_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) { - goaway($url); - exit(); - } + $contact = Contact::getByURL($addr, null, ['url']) ?? ''; + if (!$contact) { + throw new NotFoundException('Contact not found'); } + + System::externalRedirect($contact['url']); } }