]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Acctlink.php
Issue 11566: More detailled notification configuration
[friendica.git] / src / Module / Acctlink.php
index b14bbf8d705f5eda25bd8113a1580d104bccb5c4..3fa679ebc3ff629fa9ee2788dcb6f70825afbd20 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,24 +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 function content(): string
+       protected function rawContent(array $request = [])
        {
                $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');
                }
 
-               return '';
+               System::externalRedirect($contact['url']);
        }
 }