]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Debug/WebFinger.php
Merge pull request #12850 from nupplaphil/feat/phpstorm_editorconfig
[friendica.git] / src / Module / Debug / WebFinger.php
index 2b0b9c53b494c54335627dcbad770b1f0cf11598..6c1ca51e5fac9083993bd5837118f2f209268bc9 100644 (file)
@@ -1,10 +1,29 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2023, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Debug;
 
 use Friendica\BaseModule;
-use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Network\Probe;
 
 /**
@@ -12,15 +31,13 @@ use Friendica\Network\Probe;
  */
 class WebFinger extends BaseModule
 {
-       public static function content()
+       protected function content(array $request = []): string
        {
-               if (!local_user()) {
-                       $e           = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
-                       $e->httpdesc = L10n::t('Public access denied.');
-                       throw $e;
+               if (!DI::userSession()->getLocalUserId()) {
+                       throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
                }
 
-               $addr = defaults($_GET, 'addr', '');
+               $addr = $_GET['addr'] ?? '';
                $res  = '';
 
                if (!empty($addr)) {
@@ -30,8 +47,11 @@ class WebFinger extends BaseModule
 
                $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
                return Renderer::replaceMacros($tpl, [
-                       '$addr' => $addr,
-                       '$res'  => $res,
+                       '$title'  => DI::l10n()->t('Webfinger Diagnostic'),
+                       '$submit' => DI::l10n()->t('Submit'),
+                       '$lookup' => DI::l10n()->t('Lookup address:'),
+                       '$addr'   => $addr,
+                       '$res'    => $res,
                ]);
        }
 }