2020-03-21 18:53:25 +00:00
|
|
|
<?php
|
|
|
|
|
2021-10-10 09:26:18 +01:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
2020-05-11 19:15:08 +01:00
|
|
|
// {{{ License
|
2020-07-23 15:08:31 +01:00
|
|
|
|
2020-05-11 19:15:08 +01:00
|
|
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
|
|
|
//
|
|
|
|
// GNU social is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// GNU social is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
2020-07-23 15:08:31 +01:00
|
|
|
|
2020-05-11 19:15:08 +01:00
|
|
|
// }}}
|
2020-03-21 20:18:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define social's main routes
|
|
|
|
*
|
|
|
|
* @package GNUsocial
|
|
|
|
* @category Router
|
|
|
|
*
|
2021-02-19 23:29:43 +00:00
|
|
|
* @author Hugo Sales <hugo@hsal.es>
|
2021-09-16 17:04:05 +01:00
|
|
|
* @author Eliseu Amaro <mail@eliseuama.ro>
|
|
|
|
* @author Diogo Cordeiro <mail@diogo.site>
|
2021-02-19 23:29:43 +00:00
|
|
|
* @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org
|
2020-03-21 20:18:05 +00:00
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2020-03-21 18:53:25 +00:00
|
|
|
namespace App\Routes;
|
|
|
|
|
2020-06-04 21:37:17 +01:00
|
|
|
use App\Controller as C;
|
2020-06-21 19:37:20 +01:00
|
|
|
use App\Core\Router\RouteLoader;
|
2020-08-28 07:19:12 +01:00
|
|
|
use App\Util\Nickname;
|
2020-07-23 18:55:06 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;
|
2020-03-21 18:53:25 +00:00
|
|
|
|
|
|
|
abstract class Main
|
|
|
|
{
|
2021-10-10 09:26:18 +01:00
|
|
|
public const LOAD_ORDER = 10;
|
2021-09-15 15:13:30 +01:00
|
|
|
|
2020-03-21 18:53:25 +00:00
|
|
|
public static function load(RouteLoader $r): void
|
|
|
|
{
|
2021-10-10 17:41:30 +01:00
|
|
|
$r->connect('security_login', '/main/login', [C\Security::class, 'login']);
|
|
|
|
$r->connect('security_logout', '/main/logout', [C\Security::class, 'logout']);
|
|
|
|
$r->connect('security_register', '/main/register', [C\Security::class, 'register']);
|
|
|
|
$r->connect('security_check_email', '/main/check-email', [C\ResetPassword::class, 'checkEmail']);
|
|
|
|
$r->connect('security_recover_password', '/main/recover-password', [C\ResetPassword::class, 'requestPasswordReset']);
|
|
|
|
$r->connect('security_recover_password_token', '/main/recover-password/{token?}', [C\ResetPassword::class, 'reset']);
|
2020-06-20 22:54:28 +01:00
|
|
|
|
2020-08-09 14:25:48 +01:00
|
|
|
$r->connect('root', '/', RedirectController::class, ['defaults' => ['route' => 'main_all']]);
|
2020-09-04 00:09:29 +01:00
|
|
|
$r->connect('main_public', '/main/public', [C\Network::class, 'public']);
|
|
|
|
$r->connect('main_all', '/main/all', [C\Network::class, 'network']);
|
2021-09-16 17:04:05 +01:00
|
|
|
$r->connect('home_all', '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/all', [C\Network::class, 'home']);
|
|
|
|
$r->connect('replies', '/@{nickname<' . Nickname::DISPLAY_FMT . '>}/replies', [C\Network::class, 'replies']);
|
2020-07-23 18:55:06 +01:00
|
|
|
|
|
|
|
$r->connect('panel', '/panel', [C\AdminPanel::class, 'site']);
|
|
|
|
$r->connect('panel_site', '/panel/site', [C\AdminPanel::class, 'site']);
|
|
|
|
|
2020-06-21 19:37:20 +01:00
|
|
|
// FAQ static pages
|
|
|
|
foreach (['faq', 'contact', 'tags', 'groups', 'openid'] as $s) {
|
2020-08-15 22:14:49 +01:00
|
|
|
$r->connect('doc_' . $s, '/doc/' . $s, C\TemplateController::class, ['template' => 'doc/faq/' . $s . '.html.twig']);
|
2020-07-24 23:47:32 +01:00
|
|
|
}
|
|
|
|
|
2020-07-25 00:34:52 +01:00
|
|
|
foreach (['privacy', 'tos', 'version', 'source'] as $s) {
|
2020-08-15 22:14:49 +01:00
|
|
|
$r->connect('doc_' . $s, '/doc/' . $s, C\TemplateController::class, ['template' => 'doc/' . $s . '.html.twig']);
|
2020-06-21 19:37:20 +01:00
|
|
|
}
|
|
|
|
|
2021-11-15 17:00:58 +00:00
|
|
|
$r->connect('settings', '/settings', [C\UserPanel::class, 'allSettings']);
|
|
|
|
$r->connect('settings_sort_languages', '/settings/sort_languages', [C\UserPanel::class, 'sortLanguages']);
|
2020-03-21 18:53:25 +00:00
|
|
|
}
|
|
|
|
}
|