streams/Code/Module/Finger.php

39 lines
838 B
PHP
Raw Normal View History

2018-05-18 10:09:38 +00:00
<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module;
2018-05-18 10:09:38 +00:00
2019-04-15 05:31:07 +00:00
/*
* Finger diagnostic tool.
* Input a webfinger resource via an input form and
* view the results as an array.
*
*/
2018-05-18 10:09:38 +00:00
2022-02-16 04:08:28 +00:00
use Code\Web\Controller;
use Code\Lib\Webfinger;
use Code\Render\Theme;
2022-02-12 20:43:29 +00:00
2018-05-18 10:09:38 +00:00
2021-12-02 23:02:31 +00:00
class Finger extends Controller
{
public function get()
{
2022-02-12 20:43:29 +00:00
$o = replace_macros(Theme::get_template('finger.tpl'), [
2021-12-02 23:02:31 +00:00
'$page_title' => t('Webfinger Diagnostic'),
'$resource' => ['resource', t('Lookup address or URL'), $_GET['resource'], EMPTY_STR],
'$submit' => t('Submit')
]);
if ($_GET['resource']) {
$resource = trim(escape_tags($_GET['resource']));
$result = Webfinger::exec($resource);
$o .= '<pre>' . str_replace("\n", '<br>', print_array($result)) . '</pre>';
}
return $o;
}
2018-05-18 10:09:38 +00:00
}