mirror of
https://github.com/friendica/friendica
synced 2025-04-24 04:30:11 +00:00
refactor caused by feedback
This commit is contained in:
parent
48d388d82c
commit
8581fbb40f
7 changed files with 257 additions and 241 deletions
43
src/Module/Xrd.php
Normal file
43
src/Module/Xrd.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Network\Probe;
|
||||
|
||||
class Xrd extends BaseModule
|
||||
{
|
||||
public static function init()
|
||||
{
|
||||
if (local_user()) {
|
||||
System::httpExit(
|
||||
403,
|
||||
[
|
||||
"title" => L10n::t("Public access denied."),
|
||||
"description" => L10n::t("Only logged in users are permitted to perform a probing.")
|
||||
]
|
||||
);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static function content()
|
||||
{
|
||||
$addr = defaults($_GET, 'addr', '');
|
||||
$res = '';
|
||||
|
||||
if (!empty($addr)) {
|
||||
$res = Probe::lrdd($addr);
|
||||
$res = str_replace("\n", '<br />', print_r($res, true));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate("xrd.tpl");
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$addr' => $addr,
|
||||
'$res' => $res,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue