Add routes for current BaseModules
This commit is contained in:
parent
a4c2de7a0b
commit
b6b9e57488
4 changed files with 13 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue