friendica/src/Module/Debug/WebFinger.php

58 lines
1.7 KiB
PHP
Raw Normal View History

<?php
2020-02-09 14:45:36 +00:00
/**
2022-01-02 07:27:47 +00:00
* @copyright Copyright (C) 2010-2022, the Friendica project
2020-02-09 14:45:36 +00:00
*
* @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\Renderer;
2020-01-18 21:07:07 +00:00
use Friendica\DI;
use Friendica\Network\Probe;
/**
* Web based module to perform webfinger probing
*/
class WebFinger extends BaseModule
{
protected function content(array $request = []): string
{
if (!DI::userSession()->getLocalUserId()) {
2021-10-31 04:54:24 +00:00
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
}
$addr = $_GET['addr'] ?? '';
$res = '';
if (!empty($addr)) {
$res = Probe::lrdd($addr);
$res = print_r($res, true);
}
$tpl = Renderer::getMarkupTemplate('webfinger.tpl');
return Renderer::replaceMacros($tpl, [
2021-03-08 21:17:27 +00:00
'$title' => DI::l10n()->t('Webfinger Diagnostic'),
'$submit' => DI::l10n()->t('Submit'),
'$lookup' => DI::l10n()->t('Lookup address:'),
'$addr' => $addr,
'$res' => $res,
]);
}
}