]> git.agnieray.net Git - galette.git/blob - galette/includes/routes/public_pages.routes.php
Merge pull request from GHSA-jrqg-mpwv-pxpv
[galette.git] / galette / includes / routes / public_pages.routes.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Public pages routes
7 *
8 * PHP version 5
9 *
10 * Copyright © 2014-2023 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Routes
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2014-2023 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since 0.8.2dev 2014-11-11
35 */
36
37 use Galette\Controllers\Crud;
38 use Slim\Routing\RouteCollectorProxy;
39
40 $app->group('/public', function (RouteCollectorProxy $app) use ($routeparser) {
41 //public members list
42 $app->get(
43 '/{type:list|trombi}[/{option:page|order}/{value:\d+|\w+}]',
44 [Crud\MembersController::class, 'publicList']
45 )->setName('publicList');
46
47 //members list filtering
48 $app->post(
49 '/{type:list|trombi}/filter[/{from}]',
50 [Crud\MembersController::class, 'filterPublicList']
51 )->setName('filterPublicList');
52
53 $app->get(
54 '/members[/{option:page|order}/{value:\d+|\w+}]',
55 function ($request, $response, string $option = null, string $value = null) use ($routeparser) {
56 $args = ['type' => 'list'];
57 if ($option !== null && $value !== null) {
58 $args['option'] = $option;
59 $args['value'] = $value;
60 }
61 return $response
62 ->withStatus(301)
63 ->withHeader('Location', $routeparser->urlFor('publicList', $args));
64 }
65 );
66
67 $app->get(
68 '/trombinoscope',
69 function ($request, $response) use ($routeparser) {
70 $args = ['type' => 'trombi'];
71 return $response
72 ->withStatus(301)
73 ->withHeader('Location', $routeparser->urlFor('publicList', $args));
74 }
75 );
76 })->add(\Galette\Middleware\PublicPages::class);