2019-05-01 17:17:52 +00:00
|
|
|
<?php
|
2020-02-09 14:45:36 +00:00
|
|
|
/**
|
2023-01-01 14:36:24 +00:00
|
|
|
* @copyright Copyright (C) 2010-2023, 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/>.
|
|
|
|
*
|
|
|
|
*/
|
2019-05-01 17:17:52 +00:00
|
|
|
|
2019-05-19 01:02:58 +00:00
|
|
|
namespace Friendica\Module\Debug;
|
2019-05-01 17:17:52 +00:00
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
|
|
|
use Friendica\Core\Renderer;
|
2020-01-18 21:07:07 +00:00
|
|
|
use Friendica\DI;
|
2019-05-01 17:17:52 +00:00
|
|
|
use Friendica\Network\Probe;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Web based module to perform webfinger probing
|
|
|
|
*/
|
|
|
|
class WebFinger extends BaseModule
|
|
|
|
{
|
2021-11-20 14:38:03 +00:00
|
|
|
protected function content(array $request = []): string
|
2019-05-01 17:17:52 +00:00
|
|
|
{
|
2022-10-20 20:59:12 +00:00
|
|
|
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.'));
|
2019-05-01 17:17:52 +00:00
|
|
|
}
|
|
|
|
|
2019-10-15 13:20:32 +00:00
|
|
|
$addr = $_GET['addr'] ?? '';
|
2019-05-19 01:02:58 +00:00
|
|
|
$res = '';
|
2019-05-01 17:17:52 +00:00
|
|
|
|
|
|
|
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,
|
2019-05-01 17:17:52 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|