From: Philipp Holzer Date: Wed, 1 May 2019 18:16:21 +0000 (+0200) Subject: Add routes for current BaseModules X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b6b9e57488f77dc048887128adf3dc6d0c8892d4;p=friendica.git Add routes for current BaseModules --- diff --git a/src/App/Router.php b/src/App/Router.php index 039d3e2cf9..b54d5202b5 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -42,6 +42,14 @@ class Router { $this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Itemsource::class); $this->routeCollector->addRoute(['GET'], '/amcd', Module\AccountManagementControlDocument::class); + $this->routeCollector->addRoute(['GET'], '/acctlink', Module\Acctlink::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\Babel::class); + $this->routeCollector->addGroup('/contact', function (RouteCollector $collector) { + $collector->addRoute(['GET'], '[/]', Module\Contact::class); + $collector->addRoute(['GET'], '/{id:\d+}[/posts|conversations]', Module\Contact::class); + }); } public function __construct(RouteCollector $routeCollector = null) diff --git a/src/Module/Attach.php b/src/Module/Attach.php index dd4e368058..24e0edc555 100644 --- a/src/Module/Attach.php +++ b/src/Module/Attach.php @@ -8,8 +8,8 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\L10n; -use Friendica\Core\System; use Friendica\Core\Logger; +use Friendica\Core\System; use Friendica\Model\Attach as MAttach; /** @@ -26,8 +26,8 @@ class Attach extends BaseModule if ($a->argc != 2) { System::httpExit(400); // Bad Request. } - + // @TODO: Replace with parameter from router $item_id = intval($a->argv[1]); // Check for existence diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 230ad4b57b..3074bf7d6b 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -46,6 +46,7 @@ class Contact extends BaseModule $contact_id = null; $contact = null; + // @TODO: Replace with parameter from router if ($a->argc == 2 && intval($a->argv[1]) || $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations']) ) { @@ -64,6 +65,7 @@ class Contact extends BaseModule if (DBA::isResult($contact)) { if ($contact['self']) { + // @TODO: Replace with parameter from router if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) { $a->internalRedirect('profile/' . $contact['nick']); } else { diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php index f92baa987c..d781db3ac5 100644 --- a/src/Module/Itemsource.php +++ b/src/Module/Itemsource.php @@ -2,12 +2,9 @@ namespace Friendica\Module; -use Friendica\Content\Text\HTML; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Model; -use Friendica\Protocol\ActivityPub\Processor; -use Friendica\Protocol\Diaspora; /** * @author Hypolite Petovan @@ -22,6 +19,7 @@ class Itemsource extends \Friendica\BaseModule $a = self::getApp(); + // @TODO: Replace with parameter from router if (!empty($a->argv[1])) { $guid = $a->argv[1]; }