Browse Source

Add routes for current BaseModules

pull/7065/head
Philipp Holzer 3 years ago
parent
commit
b6b9e57488
No known key found for this signature in database GPG Key ID: 517BE60E2CE5C8A5
  1. 8
      src/App/Router.php
  2. 4
      src/Module/Attach.php
  3. 2
      src/Module/Contact.php
  4. 4
      src/Module/Itemsource.php

8
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)

4
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

2
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 {

4
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 <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…
Cancel
Save