]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Acctlink.php
Merge remote-tracking branch 'upstream/develop' into api4
[friendica.git] / src / Module / Acctlink.php
index f8184c82f1bc558f59590eb7c4ae9eeaa9a87b97..81b2c2391c263ed1f5b01dd9aa99cb27c3888725 100644 (file)
@@ -24,22 +24,25 @@ namespace Friendica\Module;
 use Friendica\BaseModule;
 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()
+       public function rawContent()
        {
                $addr = trim($_GET['addr'] ?? '');
+               if (!$addr) {
+                       throw new NotFoundException('Parameter "addr" is missing or empty');
+               }
 
-               if ($addr) {
-                       $url = Contact::getByURL($addr)['url'] ?? '';
-                       if ($url) {
-                               System::externalRedirect($url['url']);
-                               exit();
-                       }
+               $contact = Contact::getByURL($addr, null, ['url']) ?? '';
+               if (!$contact) {
+                       throw new NotFoundException('Contact not found');
                }
+
+               System::externalRedirect($contact['url']);
        }
 }