]> git.mxchange.org Git - friendica.git/commitdiff
Add routes for current BaseModules
authorPhilipp Holzer <admin@philipp.info>
Wed, 1 May 2019 18:16:21 +0000 (20:16 +0200)
committerPhilipp Holzer <admin@philipp.info>
Wed, 1 May 2019 18:16:21 +0000 (20:16 +0200)
src/App/Router.php
src/Module/Attach.php
src/Module/Contact.php
src/Module/Itemsource.php

index 039d3e2cf9fb1e133d7283a6bf9b805a10b0143e..b54d5202b5334be47966898a9a880c2015c8718c 100644 (file)
@@ -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)
index dd4e368058b7c3583424dfed3122aef629f789d1..24e0edc5552ad774d7187573249835acd31474b7 100644 (file)
@@ -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
index 230ad4b57bd008938c0a273846609c734424a4c8..3074bf7d6b7c49475890b9d72113295d41533586 100644 (file)
@@ -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 {
index f92baa987c6d5de819402abf3a3c53c0d6f457a6..d781db3ac5d207b54bdfb4f3a7050e17587acdfa 100644 (file)
@@ -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 <mrpetovan@gmail.com>
@@ -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];
                }