]> git.mxchange.org Git - friendica.git/blob - src/Module/WebFinger.php
code standards :-)
[friendica.git] / src / Module / WebFinger.php
1 <?php
2
3 namespace Friendica\Module;
4
5 use Friendica\BaseModule;
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\Core\System;
9 use Friendica\Network\Probe;
10
11 /**
12  * Web based module to perform webfinger probing
13  */
14 class WebFinger extends BaseModule
15 {
16         public static function init()
17         {
18                 if (!local_user()) {
19                         System::httpExit(
20                                 403,
21                                 [
22                                         'title'       => L10n::t('Public access denied.'),
23                                         'description' => L10n::t('Only logged in users are permitted to perform a probing.'),
24                                 ],
25                         );
26                         exit();
27                 }
28         }
29
30         public static function content()
31         {
32                 $app = self::getApp();
33
34                 $addr = defaults($_GET, 'addr', '');
35                 $res = '';
36
37                 if (!empty($addr)) {
38                         $res = Probe::lrdd($addr);
39                         $res = print_r($res, true);
40                 }
41
42                 $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
43                 return Renderer::replaceMacros($tpl, [
44                         '$addr' => $addr,
45                         '$res'  => $res,
46                 ]);
47         }
48 }