Renamed Diagnostic to Debug and deleted ItemSource (already defined)
authorPhilipp Holzer <admin+github@philipp.info>
Sun, 19 May 2019 01:02:58 +0000 (03:02 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Sun, 19 May 2019 02:24:56 +0000 (04:24 +0200)
14 files changed:
src/App/Router.php
src/Module/Debug/Babel.php [new file with mode: 0644]
src/Module/Debug/Feed.php [new file with mode: 0644]
src/Module/Debug/ItemBody.php [new file with mode: 0644]
src/Module/Debug/Localtime.php [new file with mode: 0644]
src/Module/Debug/Probe.php [new file with mode: 0644]
src/Module/Debug/WebFinger.php [new file with mode: 0644]
src/Module/Diagnostic/Babel.php [deleted file]
src/Module/Diagnostic/Feed.php [deleted file]
src/Module/Diagnostic/ItemBody.php [deleted file]
src/Module/Diagnostic/ItemSource.php [deleted file]
src/Module/Diagnostic/Localtime.php [deleted file]
src/Module/Diagnostic/Probe.php [deleted file]
src/Module/Diagnostic/WebFinger.php [deleted file]

index ddb3dbd..ecc4eed 100644 (file)
@@ -92,7 +92,7 @@ class Router
                $this->routeCollector->addRoute(['GET'],         '/allfriends/{id:\d+}', Module\AllFriends::class);
                $this->routeCollector->addRoute(['GET'],         '/apps',                Module\Apps::class);
                $this->routeCollector->addRoute(['GET'],         '/attach/{item:\d+}',   Module\Attach::class);
-               $this->routeCollector->addRoute(['GET'],         '/babel',               Module\Diagnostic\Babel::class);
+               $this->routeCollector->addRoute(['GET'],         '/babel',               Module\Debug\Babel::class);
                $this->routeCollector->addRoute(['GET'],         '/bookmarklet',         Module\Bookmarklet::class);
                $this->routeCollector->addGroup('/contact', function (RouteCollector $collector) {
                        $collector->addRoute(['GET'], '[/]',                                 Module\Contact::class);
@@ -121,7 +121,7 @@ class Router
                        $collector->addRoute(['GET'], '/{nickname}/replies',                 Module\Feed::class);
                        $collector->addRoute(['GET'], '/{nickname}/activity',                Module\Feed::class);
                });
-               $this->routeCollector->addRoute(['GET'],         '/feedtest',            Module\Feedtest::class);
+               $this->routeCollector->addRoute(['GET'],         '/feedtest',            Module\Debug\Feed::class);
                $this->routeCollector->addGroup('/fetch', function (RouteCollector $collector) {
                        $collector->addRoute(['GET'], '/{guid}/post',                        Module\Diaspora\Fetch::class);
                        $collector->addRoute(['GET'], '/{guid}/status_message',              Module\Diaspora\Fetch::class);
@@ -153,9 +153,8 @@ class Router
                        $collector->addRoute(['GET', 'POST'], '[/]',                         Module\Install::class);
                        $collector->addRoute(['GET'],         '/testrewrite',                Module\Install::class);
                });
-               $this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Diagnostic\ItemSource::class);
                $this->routeCollector->addRoute(['GET'],         '/like/{item:\d+}',     Module\Like::class);
-               $this->routeCollector->addRoute(['GET', 'POST'], '/localtime',           Module\Diagnostic\Localtime::class);
+               $this->routeCollector->addRoute(['GET', 'POST'], '/localtime',           Module\Debug\Localtime::class);
                $this->routeCollector->addRoute(['GET', 'POST'], '/login',               Module\Login::class);
                $this->routeCollector->addRoute(['GET', 'POST'], '/logout',              Module\Logout::class);
                $this->routeCollector->addRoute(['GET'],         '/magic',               Module\Magic::class);
@@ -185,7 +184,7 @@ class Router
                        $collector->addRoute(['GET'], '/{type}/{customize}/{name}',          Module\Photo::class);
                });
                $this->routeCollector->addRoute(['GET'],         '/pretheme',            Module\ThemeDetails::class);
-               $this->routeCollector->addRoute(['GET'],         '/probe',               Module\Diagnostic\Probe::class);
+               $this->routeCollector->addRoute(['GET'],         '/probe',               Module\Debug\Probe::class);
                $this->routeCollector->addGroup('/profile', function (RouteCollector $collector) {
                        $collector->addRoute(['GET'], '/{nickname}',                         Module\Profile::class);
                        $collector->addRoute(['GET'], '/{profile:\d+}/view',                 Module\Profile::class);
@@ -214,8 +213,8 @@ class Router
                $this->routeCollector->addRoute(['GET'],         '/toggle_mobile',       Module\ToggleMobile::class);
                $this->routeCollector->addRoute(['GET'],         '/tos',                 Module\Tos::class);
                $this->routeCollector->addRoute(['GET'],         '/view/theme/{theme}/style.pcss',  Module\Theme::class);
-               $this->routeCollector->addRoute(['GET'],         '/viewsrc/{item:\d+}',  Module\Diagnostic\ItemBody::class);
-               $this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\Diagnostic\WebFinger::class);
+               $this->routeCollector->addRoute(['GET'],         '/viewsrc/{item:\d+}',  Module\Debug\ItemBody::class);
+               $this->routeCollector->addRoute(['GET'],         '/webfinger',           Module\Debug\WebFinger::class);
                $this->routeCollector->addRoute(['GET'],         '/xrd',                 Module\Xrd::class);
        }
 
diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php
new file mode 100644 (file)
index 0000000..899c803
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Content\Text;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model\Item;
+
+/**
+ * Translates input text into different formats (HTML, BBCode, Markdown)
+ */
+class Babel extends BaseModule
+{
+       public static function content()
+       {
+               function visible_whitespace($s)
+               {
+                       $s = str_replace(' ', '&nbsp;', $s);
+
+                       return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
+               }
+
+               $results = [];
+               if (!empty($_REQUEST['text'])) {
+                       switch (defaults($_REQUEST, 'type', 'bbcode')) {
+                               case 'bbcode':
+                                       $bbcode = trim($_REQUEST['text']);
+                                       $results[] = [
+                                               'title'   => L10n::t('Source input'),
+                                               'content' => visible_whitespace($bbcode)
+                                       ];
+
+                                       $plain = Text\BBCode::toPlaintext($bbcode, false);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::toPlaintext'),
+                                               'content' => visible_whitespace($plain)
+                                       ];
+
+                                       $html = Text\BBCode::convert($bbcode);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::convert (raw HTML)'),
+                                               'content' => visible_whitespace(htmlspecialchars($html))
+                                       ];
+
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::convert'),
+                                               'content' => $html
+                                       ];
+
+                                       $bbcode2 = Text\HTML::toBBCode($html);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::convert => HTML::toBBCode'),
+                                               'content' => visible_whitespace($bbcode2)
+                                       ];
+
+                                       $markdown = Text\BBCode::toMarkdown($bbcode);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::toMarkdown'),
+                                               'content' => visible_whitespace($markdown)
+                                       ];
+
+                                       $html2 = Text\Markdown::convert($markdown);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::toMarkdown => Markdown::convert'),
+                                               'content' => $html2
+                                       ];
+
+                                       $bbcode3 = Text\Markdown::toBBCode($markdown);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
+                                               'content' => visible_whitespace($bbcode3)
+                                       ];
+
+                                       $bbcode4 = Text\HTML::toBBCode($html2);
+                                       $results[] = [
+                                               'title'   => L10n::t('BBCode::toMarkdown =>  Markdown::convert => HTML::toBBCode'),
+                                               'content' => visible_whitespace($bbcode4)
+                                       ];
+
+                                       $item = [
+                                               'body' => $bbcode,
+                                               'tag'  => '',
+                                       ];
+
+                                       Item::setHashtags($item);
+                                       $results[] = [
+                                               'title'   => L10n::t('Item Body'),
+                                               'content' => visible_whitespace($item['body'])
+                                       ];
+                                       $results[] = [
+                                               'title'   => L10n::t('Item Tags'),
+                                               'content' => $item['tag']
+                                       ];
+                                       break;
+                               case 'markdown':
+                                       $markdown = trim($_REQUEST['text']);
+                                       $results[] = [
+                                               'title'   => L10n::t('Source input (Diaspora format)'),
+                                               'content' => '<pre>' . $markdown . '</pre>'
+                                       ];
+
+                                       $html = Text\Markdown::convert($markdown);
+                                       $results[] = [
+                                               'title'   => L10n::t('Markdown::convert (raw HTML)'),
+                                               'content' => visible_whitespace(htmlspecialchars($html))
+                                       ];
+
+                                       $results[] = [
+                                               'title'   => L10n::t('Markdown::convert'),
+                                               'content' => $html
+                                       ];
+
+                                       $bbcode = Text\Markdown::toBBCode($markdown);
+                                       $results[] = [
+                                               'title'   => L10n::t('Markdown::toBBCode'),
+                                               'content' => '<pre>' . $bbcode . '</pre>'
+                                       ];
+                                       break;
+                               case 'html' :
+                                       $html = trim($_REQUEST['text']);
+                                       $results[] = [
+                                               'title'   => L10n::t('Raw HTML input'),
+                                               'content' => htmlspecialchars($html)
+                                       ];
+
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML Input'),
+                                               'content' => $html
+                                       ];
+
+                                       $bbcode = Text\HTML::toBBCode($html);
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML::toBBCode'),
+                                               'content' => visible_whitespace($bbcode)
+                                       ];
+
+                                       $html2 = Text\BBCode::convert($bbcode);
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML::toBBCode => BBCode::convert'),
+                                               'content' => $html2
+                                       ];
+
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
+                                               'content' => htmlspecialchars($html2)
+                                       ];
+
+                                       $markdown = Text\HTML::toMarkdown($html);
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML::toMarkdown'),
+                                               'content' => visible_whitespace($markdown)
+                                       ];
+
+                                       $text = Text\HTML::toPlaintext($html);
+                                       $results[] = [
+                                               'title'   => L10n::t('HTML::toPlaintext'),
+                                               'content' => '<pre>' . $text . '</pre>'
+                                       ];
+                       }
+               }
+
+               $tpl = Renderer::getMarkupTemplate('babel.tpl');
+               $o = Renderer::replaceMacros($tpl, [
+                       '$text'          => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
+                       '$type_bbcode'   => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
+                       '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
+                       '$type_html'     => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
+                       '$results'       => $results
+               ]);
+
+               return $o;
+       }
+}
diff --git a/src/Module/Debug/Feed.php b/src/Module/Debug/Feed.php
new file mode 100644 (file)
index 0000000..a11df59
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model;
+use Friendica\Protocol;
+use Friendica\Util\Network;
+
+/**
+ * Tests a given feed of a contact
+ */
+class Feed extends BaseModule
+{
+       public static function init()
+       {
+               if (!local_user()) {
+                       info(L10n::t('You must be logged in to use this module'));
+                       self::getApp()->internalRedirect();
+               }
+       }
+
+       public static function content()
+       {
+               $result = [];
+               if (!empty($_REQUEST['url'])) {
+                       $url = $_REQUEST['url'];
+
+                       $importer = Model\User::getById(local_user());
+
+                       $contact_id = Model\Contact::getIdForURL($url, local_user(), true);
+                       $contact = Model\Contact::getById($contact_id);
+
+                       $xml = Network::fetchUrl($contact['poll']);
+
+                       $dummy = null;
+                       $import_result = Protocol\Feed::import($xml, $importer, $contact, $dummy, true);
+
+                       $result = [
+                               'input' => $xml,
+                               'output' => var_export($import_result, true),
+                       ];
+               }
+
+               $tpl = Renderer::getMarkupTemplate('feedtest.tpl');
+               return Renderer::replaceMacros($tpl, [
+                       '$url'    => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
+                       '$result' => $result
+               ]);
+       }
+}
diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php
new file mode 100644 (file)
index 0000000..fead255
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Model\Item;
+use Friendica\Network\HTTPException;
+
+/**
+ * Print the body of an Item
+ */
+class ItemBody extends BaseModule
+{
+       public static function content()
+       {
+               if (!local_user()) {
+                       throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
+               }
+
+               $app = self::getApp();
+
+               // @TODO: Replace with parameter from router
+               $itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
+
+               if (!$itemId) {
+                       throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+               }
+
+               $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
+
+               if (!empty($item)) {
+                       if ($app->isAjax()) {
+                               echo str_replace("\n", '<br />', $item['body']);
+                               exit();
+                       } else {
+                               return str_replace("\n", '<br />', $item['body']);
+                       }
+               } else {
+                       throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
+               }
+       }
+}
diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php
new file mode 100644 (file)
index 0000000..36eaa17
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\Installer;
+use Friendica\Core\L10n;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Temporal;
+
+class Localtime extends BaseModule
+{
+       public static function post()
+       {
+               $time = defaults($_REQUEST, 'time', 'now');
+
+               $bd_format = L10n::t('l F d, Y \@ g:i A');
+
+               if (!empty($_POST['timezone'])) {
+                       self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
+               }
+       }
+
+       public static function content()
+       {
+               $app = self::getApp();
+
+               $time = defaults($_REQUEST, 'time', 'now');
+
+               $output  = '<h3>' . L10n::t('Time Conversion') . '</h3>';
+               $output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
+               $output .= '<p>' . L10n::t('UTC time: %s', $time) . '</p>';
+
+               if (!empty($_REQUEST['timezone'])) {
+                       $output .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
+               }
+
+               if (!empty($app->data['mod-localtime'])) {
+                       $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
+               }
+
+               $output .= '<form action ="' . $app->getBaseURL() . '/localtime?f=&time=' . $time . '" method="post" >';
+               $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
+               $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
+               $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
+
+               return $output;
+       }
+}
diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php
new file mode 100644 (file)
index 0000000..f29f3b3
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Network\HTTPException;
+use Friendica\Network\Probe as NetworkProbe;
+
+/**
+ * Fetch information (protocol endpoints and user information) about a given uri
+ */
+class Probe extends BaseModule
+{
+       public static function content()
+       {
+               if (!local_user()) {
+                       $e           = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
+                       $e->httpdesc = L10n::t('Public access denied.');
+                       throw $e;
+               }
+
+               $addr = defaults($_GET, 'addr', '');
+               $res  = '';
+
+               if (!empty($addr)) {
+                       $res = NetworkProbe::uri($addr, '', 0, false);
+                       $res = print_r($res, true);
+               }
+
+               $tpl = Renderer::getMarkupTemplate('probe.tpl');
+               return Renderer::replaceMacros($tpl, [
+                       '$addr' => ['addr',
+                               L10n::t('Lookup address'),
+                               $addr,
+                               '',
+                               'required'
+                       ],
+                       '$res'  => $res,
+               ]);
+       }
+}
diff --git a/src/Module/Debug/WebFinger.php b/src/Module/Debug/WebFinger.php
new file mode 100644 (file)
index 0000000..2b0b9c5
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+namespace Friendica\Module\Debug;
+
+use Friendica\BaseModule;
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Network\Probe;
+
+/**
+ * Web based module to perform webfinger probing
+ */
+class WebFinger extends BaseModule
+{
+       public static function content()
+       {
+               if (!local_user()) {
+                       $e           = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));
+                       $e->httpdesc = L10n::t('Public access denied.');
+                       throw $e;
+               }
+
+               $addr = defaults($_GET, 'addr', '');
+               $res  = '';
+
+               if (!empty($addr)) {
+                       $res = Probe::lrdd($addr);
+                       $res = print_r($res, true);
+               }
+
+               $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
+               return Renderer::replaceMacros($tpl, [
+                       '$addr' => $addr,
+                       '$res'  => $res,
+               ]);
+       }
+}
diff --git a/src/Module/Diagnostic/Babel.php b/src/Module/Diagnostic/Babel.php
deleted file mode 100644 (file)
index 797584a..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Content\Text;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model\Item;
-
-/**
- * Translates input text into different formats (HTML, BBCode, Markdown)
- */
-class Babel extends BaseModule
-{
-       public static function content()
-       {
-               function visible_whitespace($s)
-               {
-                       $s = str_replace(' ', '&nbsp;', $s);
-
-                       return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
-               }
-
-               $results = [];
-               if (!empty($_REQUEST['text'])) {
-                       switch (defaults($_REQUEST, 'type', 'bbcode')) {
-                               case 'bbcode':
-                                       $bbcode = trim($_REQUEST['text']);
-                                       $results[] = [
-                                               'title'   => L10n::t('Source input'),
-                                               'content' => visible_whitespace($bbcode)
-                                       ];
-
-                                       $plain = Text\BBCode::toPlaintext($bbcode, false);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::toPlaintext'),
-                                               'content' => visible_whitespace($plain)
-                                       ];
-
-                                       $html = Text\BBCode::convert($bbcode);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::convert (raw HTML)'),
-                                               'content' => visible_whitespace(htmlspecialchars($html))
-                                       ];
-
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::convert'),
-                                               'content' => $html
-                                       ];
-
-                                       $bbcode2 = Text\HTML::toBBCode($html);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::convert => HTML::toBBCode'),
-                                               'content' => visible_whitespace($bbcode2)
-                                       ];
-
-                                       $markdown = Text\BBCode::toMarkdown($bbcode);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::toMarkdown'),
-                                               'content' => visible_whitespace($markdown)
-                                       ];
-
-                                       $html2 = Text\Markdown::convert($markdown);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::toMarkdown => Markdown::convert'),
-                                               'content' => $html2
-                                       ];
-
-                                       $bbcode3 = Text\Markdown::toBBCode($markdown);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
-                                               'content' => visible_whitespace($bbcode3)
-                                       ];
-
-                                       $bbcode4 = Text\HTML::toBBCode($html2);
-                                       $results[] = [
-                                               'title'   => L10n::t('BBCode::toMarkdown =>  Markdown::convert => HTML::toBBCode'),
-                                               'content' => visible_whitespace($bbcode4)
-                                       ];
-
-                                       $item = [
-                                               'body' => $bbcode,
-                                               'tag'  => '',
-                                       ];
-
-                                       Item::setHashtags($item);
-                                       $results[] = [
-                                               'title'   => L10n::t('Item Body'),
-                                               'content' => visible_whitespace($item['body'])
-                                       ];
-                                       $results[] = [
-                                               'title'   => L10n::t('Item Tags'),
-                                               'content' => $item['tag']
-                                       ];
-                                       break;
-                               case 'markdown':
-                                       $markdown = trim($_REQUEST['text']);
-                                       $results[] = [
-                                               'title'   => L10n::t('Source input (Diaspora format)'),
-                                               'content' => '<pre>' . $markdown . '</pre>'
-                                       ];
-
-                                       $html = Text\Markdown::convert($markdown);
-                                       $results[] = [
-                                               'title'   => L10n::t('Markdown::convert (raw HTML)'),
-                                               'content' => visible_whitespace(htmlspecialchars($html))
-                                       ];
-
-                                       $results[] = [
-                                               'title'   => L10n::t('Markdown::convert'),
-                                               'content' => $html
-                                       ];
-
-                                       $bbcode = Text\Markdown::toBBCode($markdown);
-                                       $results[] = [
-                                               'title'   => L10n::t('Markdown::toBBCode'),
-                                               'content' => '<pre>' . $bbcode . '</pre>'
-                                       ];
-                                       break;
-                               case 'html' :
-                                       $html = trim($_REQUEST['text']);
-                                       $results[] = [
-                                               'title'   => L10n::t('Raw HTML input'),
-                                               'content' => htmlspecialchars($html)
-                                       ];
-
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML Input'),
-                                               'content' => $html
-                                       ];
-
-                                       $bbcode = Text\HTML::toBBCode($html);
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML::toBBCode'),
-                                               'content' => visible_whitespace($bbcode)
-                                       ];
-
-                                       $html2 = Text\BBCode::convert($bbcode);
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML::toBBCode => BBCode::convert'),
-                                               'content' => $html2
-                                       ];
-
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
-                                               'content' => htmlspecialchars($html2)
-                                       ];
-
-                                       $markdown = Text\HTML::toMarkdown($html);
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML::toMarkdown'),
-                                               'content' => visible_whitespace($markdown)
-                                       ];
-
-                                       $text = Text\HTML::toPlaintext($html);
-                                       $results[] = [
-                                               'title'   => L10n::t('HTML::toPlaintext'),
-                                               'content' => '<pre>' . $text . '</pre>'
-                                       ];
-                       }
-               }
-
-               $tpl = Renderer::getMarkupTemplate('babel.tpl');
-               $o = Renderer::replaceMacros($tpl, [
-                       '$text'          => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
-                       '$type_bbcode'   => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
-                       '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
-                       '$type_html'     => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
-                       '$results'       => $results
-               ]);
-
-               return $o;
-       }
-}
diff --git a/src/Module/Diagnostic/Feed.php b/src/Module/Diagnostic/Feed.php
deleted file mode 100644 (file)
index c54431f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model;
-use Friendica\Protocol;
-use Friendica\Util\Network;
-
-/**
- * Tests a given feed of a contact
- */
-class Feed extends BaseModule
-{
-       public static function init()
-       {
-               if (!local_user()) {
-                       info(L10n::t('You must be logged in to use this module'));
-                       self::getApp()->internalRedirect();
-               }
-       }
-
-       public static function content()
-       {
-               $result = [];
-               if (!empty($_REQUEST['url'])) {
-                       $url = $_REQUEST['url'];
-
-                       $importer = Model\User::getById(local_user());
-
-                       $contact_id = Model\Contact::getIdForURL($url, local_user(), true);
-                       $contact = Model\Contact::getById($contact_id);
-
-                       $xml = Network::fetchUrl($contact['poll']);
-
-                       $dummy = null;
-                       $import_result = Protocol\Feed::import($xml, $importer, $contact, $dummy, true);
-
-                       $result = [
-                               'input' => $xml,
-                               'output' => var_export($import_result, true),
-                       ];
-               }
-
-               $tpl = Renderer::getMarkupTemplate('feedtest.tpl');
-               return Renderer::replaceMacros($tpl, [
-                       '$url'    => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
-                       '$result' => $result
-               ]);
-       }
-}
diff --git a/src/Module/Diagnostic/ItemBody.php b/src/Module/Diagnostic/ItemBody.php
deleted file mode 100644 (file)
index e4e45b7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Model\Item;
-use Friendica\Network\HTTPException;
-
-/**
- * Print the body of an Item
- */
-class ItemBody extends BaseModule
-{
-       public static function content()
-       {
-               if (!local_user()) {
-                       throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
-               }
-
-               $app = self::getApp();
-
-               // @TODO: Replace with parameter from router
-               $itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
-
-               if (!$itemId) {
-                       throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
-               }
-
-               $item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $itemId]);
-
-               if (!empty($item)) {
-                       if ($app->isAjax()) {
-                               echo str_replace("\n", '<br />', $item['body']);
-                               exit();
-                       } else {
-                               return str_replace("\n", '<br />', $item['body']);
-                       }
-               } else {
-                       throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
-               }
-       }
-}
diff --git a/src/Module/Diagnostic/ItemSource.php b/src/Module/Diagnostic/ItemSource.php
deleted file mode 100644 (file)
index bd580cf..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Model;
-
-/**
- * @author Hypolite Petovan <mrpetovan@gmail.com>
- */
-class ItemSource extends \Friendica\BaseModule
-{
-       public static function content()
-       {
-               if (!is_site_admin()) {
-                       return;
-               }
-
-               $a = self::getApp();
-
-               // @TODO: Replace with parameter from router
-               if (!empty($a->argv[1])) {
-                       $guid = $a->argv[1];
-               }
-
-               $guid = defaults($_REQUEST['guid'], $guid);
-
-               $source = '';
-               $item_uri = '';
-               $item_id = '';
-               $terms = [];
-               if (!empty($guid)) {
-                       $item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
-
-                       $conversation = Model\Conversation::getByItemUri($item['uri']);
-
-                       $item_id = $item['id'];
-                       $item_uri = $item['uri'];
-                       $source = $conversation['source'];
-                       $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
-               }
-
-               $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
-               $o = Renderer::replaceMacros($tpl, [
-                       '$guid'          => ['guid', L10n::t('Item Guid'), $guid, ''],
-                       '$source'        => $source,
-                       '$item_uri'      => $item_uri,
-                       '$item_id'       => $item_id,
-                       '$terms'         => $terms,
-               ]);
-
-               return $o;
-       }
-}
diff --git a/src/Module/Diagnostic/Localtime.php b/src/Module/Diagnostic/Localtime.php
deleted file mode 100644 (file)
index a3870ca..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Core\Installer;
-use Friendica\Core\L10n;
-use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Temporal;
-
-class Localtime extends BaseModule
-{
-       public static function post()
-       {
-               $time = defaults($_REQUEST, 'time', 'now');
-
-               $bd_format = L10n::t('l F d, Y \@ g:i A');
-
-               if (!empty($_POST['timezone'])) {
-                       self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
-               }
-       }
-
-       public static function content()
-       {
-               $app = self::getApp();
-
-               $time = defaults($_REQUEST, 'time', 'now');
-
-               $output  = '<h3>' . L10n::t('Time Conversion') . '</h3>';
-               $output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
-               $output .= '<p>' . L10n::t('UTC time: %s', $time) . '</p>';
-
-               if (!empty($_REQUEST['timezone'])) {
-                       $output .= '<p>' . L10n::t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
-               }
-
-               if (!empty($app->data['mod-localtime'])) {
-                       $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
-               }
-
-               $output .= '<form action ="' . $app->getBaseURL() . '/localtime?f=&time=' . $time . '" method="post" >';
-               $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
-               $output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
-               $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
-
-               return $output;
-       }
-}
diff --git a/src/Module/Diagnostic/Probe.php b/src/Module/Diagnostic/Probe.php
deleted file mode 100644 (file)
index 516c494..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Network\HTTPException;
-use Friendica\Network\Probe as NetworkProbe;
-
-/**
- * Fetch information (protocol endpoints and user information) about a given uri
- */
-class Probe extends BaseModule
-{
-       public static function content()
-       {
-               if (!local_user()) {
-                       $e           = new HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing."));
-                       $e->httpdesc = L10n::t("Public access denied.");
-                       throw $e;
-               }
-
-               $addr = defaults($_GET, 'addr', '');
-               $res  = '';
-
-               if (!empty($addr)) {
-                       $res = NetworkProbe::uri($addr, '', 0, false);
-                       $res = print_r($res, true);
-               }
-
-               $tpl = Renderer::getMarkupTemplate('probe.tpl');
-               return Renderer::replaceMacros($tpl, [
-                       '$addr' => ['addr',
-                                   L10n::t('Lookup address'),
-                                   $addr,
-                                   '',
-                                   'required'
-                       ],
-                       '$res'  => $res,
-               ]);
-       }
-}
diff --git a/src/Module/Diagnostic/WebFinger.php b/src/Module/Diagnostic/WebFinger.php
deleted file mode 100644 (file)
index 5d6e05a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-namespace Friendica\Module\Diagnostic;
-
-use Friendica\BaseModule;
-use Friendica\Core\L10n;
-use Friendica\Core\Renderer;
-use Friendica\Network\Probe;
-
-/**
- * Web based module to perform webfinger probing
- */
-class WebFinger extends BaseModule
-{
-       public static function content()
-       {
-               if (!local_user()) {
-                       $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t("Only logged in users are permitted to perform a probing."));
-                       $e->httpdesc = L10n::t("Public access denied.");
-                       throw $e;
-               }
-
-               $addr = defaults($_GET, 'addr', '');
-               $res = '';
-
-               if (!empty($addr)) {
-                       $res = Probe::lrdd($addr);
-                       $res = print_r($res, true);
-               }
-
-               $tpl = Renderer::getMarkupTemplate('webfinger.tpl');
-               return Renderer::replaceMacros($tpl, [
-                       '$addr' => $addr,
-                       '$res'  => $res,
-               ]);
-       }
-}