xref: /webtrees/app/Http/Routes/WebRoutes.php (revision 8ce3bd7317ecf32f7aa634676ce35ec9b0055a39)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2019 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Http\Routes;
21
22use Aura\Router\Map;
23use Fig\Http\Message\RequestMethodInterface;
24use Fisharebest\Webtrees\Http\Middleware\AuthAdministrator;
25use Fisharebest\Webtrees\Http\Middleware\AuthEditor;
26use Fisharebest\Webtrees\Http\Middleware\AuthLoggedIn;
27use Fisharebest\Webtrees\Http\Middleware\AuthManager;
28use Fisharebest\Webtrees\Http\Middleware\AuthModerator;
29use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
30use Fisharebest\Webtrees\Http\RequestHandlers\AccountEdit;
31use Fisharebest\Webtrees\Http\RequestHandlers\AccountUpdate;
32use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyAction;
33use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyPage;
34use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualAction;
35use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualPage;
36use Fisharebest\Webtrees\Http\RequestHandlers\AddName;
37use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
38use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualAction;
39use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage;
40use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyAction;
41use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyPage;
42use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualAction;
43use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualPage;
44use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedAction;
45use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedPage;
46use Fisharebest\Webtrees\Http\RequestHandlers\AdminMediaFileDownload;
47use Fisharebest\Webtrees\Http\RequestHandlers\AdminMediaFileThumbnail;
48use Fisharebest\Webtrees\Http\RequestHandlers\AppleTouchIconPng;
49use Fisharebest\Webtrees\Http\RequestHandlers\AutoCompleteCitation;
50use Fisharebest\Webtrees\Http\RequestHandlers\AutoCompleteFolder;
51use Fisharebest\Webtrees\Http\RequestHandlers\AutoCompletePlace;
52use Fisharebest\Webtrees\Http\RequestHandlers\AutoCompleteSurname;
53use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastAction;
54use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastPage;
55use Fisharebest\Webtrees\Http\RequestHandlers\CalendarAction;
56use Fisharebest\Webtrees\Http\RequestHandlers\CalendarEvents;
57use Fisharebest\Webtrees\Http\RequestHandlers\CalendarPage;
58use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
59use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersPage;
60use Fisharebest\Webtrees\Http\RequestHandlers\CheckTree;
61use Fisharebest\Webtrees\Http\RequestHandlers\CleanDataFolder;
62use Fisharebest\Webtrees\Http\RequestHandlers\ContactAction;
63use Fisharebest\Webtrees\Http\RequestHandlers\ContactPage;
64use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
65use Fisharebest\Webtrees\Http\RequestHandlers\CopyFact;
66use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectAction;
67use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectModal;
68use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteAction;
69use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteModal;
70use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryAction;
71use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryModal;
72use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceAction;
73use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceModal;
74use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterAction;
75use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterModal;
76use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreeAction;
77use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreePage;
78use Fisharebest\Webtrees\Http\RequestHandlers\DataFixChoose;
79use Fisharebest\Webtrees\Http\RequestHandlers\DataFixData;
80use Fisharebest\Webtrees\Http\RequestHandlers\DataFixPage;
81use Fisharebest\Webtrees\Http\RequestHandlers\DataFixPreview;
82use Fisharebest\Webtrees\Http\RequestHandlers\DataFixSelect;
83use Fisharebest\Webtrees\Http\RequestHandlers\DataFixUpdate;
84use Fisharebest\Webtrees\Http\RequestHandlers\DataFixUpdateAll;
85use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact;
86use Fisharebest\Webtrees\Http\RequestHandlers\DeletePath;
87use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
88use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction;
89use Fisharebest\Webtrees\Http\RequestHandlers\DeleteUser;
90use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction;
91use Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage;
92use Fisharebest\Webtrees\Http\RequestHandlers\EditName;
93use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
94use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage;
95use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
96use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
97use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesAction;
98use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesPage;
99use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomClient;
100use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomPage;
101use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomServer;
102use Fisharebest\Webtrees\Http\RequestHandlers\FamilyPage;
103use Fisharebest\Webtrees\Http\RequestHandlers\FaviconIco;
104use Fisharebest\Webtrees\Http\RequestHandlers\FindDuplicateRecords;
105use Fisharebest\Webtrees\Http\RequestHandlers\GedcomLoad;
106use Fisharebest\Webtrees\Http\RequestHandlers\GedcomRecordPage;
107use Fisharebest\Webtrees\Http\RequestHandlers\HeaderPage;
108use Fisharebest\Webtrees\Http\RequestHandlers\HelpText;
109use Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
110use Fisharebest\Webtrees\Http\RequestHandlers\ImportGedcomAction;
111use Fisharebest\Webtrees\Http\RequestHandlers\ImportGedcomPage;
112use Fisharebest\Webtrees\Http\RequestHandlers\IndividualPage;
113use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyAction;
114use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyPage;
115use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualAction;
116use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualPage;
117use Fisharebest\Webtrees\Http\RequestHandlers\LoginAction;
118use Fisharebest\Webtrees\Http\RequestHandlers\LoginPage;
119use Fisharebest\Webtrees\Http\RequestHandlers\Logout;
120use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaAction;
121use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaData;
122use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaPage;
123use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees;
124use Fisharebest\Webtrees\Http\RequestHandlers\MapDataDelete;
125use Fisharebest\Webtrees\Http\RequestHandlers\MapDataList;
126use Fisharebest\Webtrees\Http\RequestHandlers\Masquerade;
127use Fisharebest\Webtrees\Http\RequestHandlers\MediaFileDownload;
128use Fisharebest\Webtrees\Http\RequestHandlers\MediaFileThumbnail;
129use Fisharebest\Webtrees\Http\RequestHandlers\MediaPage;
130use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsAction;
131use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsPage;
132use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsAction;
133use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsPage;
134use Fisharebest\Webtrees\Http\RequestHandlers\MergeTreesAction;
135use Fisharebest\Webtrees\Http\RequestHandlers\MergeTreesPage;
136use Fisharebest\Webtrees\Http\RequestHandlers\MessageAction;
137use Fisharebest\Webtrees\Http\RequestHandlers\MessagePage;
138use Fisharebest\Webtrees\Http\RequestHandlers\MessageSelect;
139use Fisharebest\Webtrees\Http\RequestHandlers\ModuleAction;
140use Fisharebest\Webtrees\Http\RequestHandlers\ModuleDeleteSettings;
141use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllAction;
142use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage;
143use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAnalyticsAction;
144use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAnalyticsPage;
145use Fisharebest\Webtrees\Http\RequestHandlers\ModulesBlocksAction;
146use Fisharebest\Webtrees\Http\RequestHandlers\ModulesBlocksPage;
147use Fisharebest\Webtrees\Http\RequestHandlers\ModulesChartsAction;
148use Fisharebest\Webtrees\Http\RequestHandlers\ModulesChartsPage;
149use Fisharebest\Webtrees\Http\RequestHandlers\ModulesDataFixesAction;
150use Fisharebest\Webtrees\Http\RequestHandlers\ModulesDataFixesPage;
151use Fisharebest\Webtrees\Http\RequestHandlers\ModulesFootersAction;
152use Fisharebest\Webtrees\Http\RequestHandlers\ModulesFootersPage;
153use Fisharebest\Webtrees\Http\RequestHandlers\ModulesHistoricEventsAction;
154use Fisharebest\Webtrees\Http\RequestHandlers\ModulesHistoricEventsPage;
155use Fisharebest\Webtrees\Http\RequestHandlers\ModulesLanguagesAction;
156use Fisharebest\Webtrees\Http\RequestHandlers\ModulesLanguagesPage;
157use Fisharebest\Webtrees\Http\RequestHandlers\ModulesListsAction;
158use Fisharebest\Webtrees\Http\RequestHandlers\ModulesListsPage;
159use Fisharebest\Webtrees\Http\RequestHandlers\ModulesMenusAction;
160use Fisharebest\Webtrees\Http\RequestHandlers\ModulesMenusPage;
161use Fisharebest\Webtrees\Http\RequestHandlers\ModulesReportsAction;
162use Fisharebest\Webtrees\Http\RequestHandlers\ModulesReportsPage;
163use Fisharebest\Webtrees\Http\RequestHandlers\ModulesSidebarsAction;
164use Fisharebest\Webtrees\Http\RequestHandlers\ModulesSidebarsPage;
165use Fisharebest\Webtrees\Http\RequestHandlers\ModulesTabsAction;
166use Fisharebest\Webtrees\Http\RequestHandlers\ModulesTabsPage;
167use Fisharebest\Webtrees\Http\RequestHandlers\ModulesThemesAction;
168use Fisharebest\Webtrees\Http\RequestHandlers\ModulesThemesPage;
169use Fisharebest\Webtrees\Http\RequestHandlers\NotePage;
170use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestAction;
171use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestPage;
172use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetAction;
173use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetPage;
174use Fisharebest\Webtrees\Http\RequestHandlers\PasteFact;
175use Fisharebest\Webtrees\Http\RequestHandlers\PendingChanges;
176use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptChange;
177use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
178use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptTree;
179use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogAction;
180use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogData;
181use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDelete;
182use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDownload;
183use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogPage;
184use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectChange;
185use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
186use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectTree;
187use Fisharebest\Webtrees\Http\RequestHandlers\PhpInformation;
188use Fisharebest\Webtrees\Http\RequestHandlers\Ping;
189use Fisharebest\Webtrees\Http\RequestHandlers\RegisterAction;
190use Fisharebest\Webtrees\Http\RequestHandlers\RegisterPage;
191use Fisharebest\Webtrees\Http\RequestHandlers\RenumberTreeAction;
192use Fisharebest\Webtrees\Http\RequestHandlers\RenumberTreePage;
193use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenAction;
194use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
195use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesAction;
196use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
197use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaAction;
198use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
199use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesAction;
200use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
201use Fisharebest\Webtrees\Http\RequestHandlers\ReportGenerate;
202use Fisharebest\Webtrees\Http\RequestHandlers\ReportListAction;
203use Fisharebest\Webtrees\Http\RequestHandlers\ReportListPage;
204use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupAction;
205use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupPage;
206use Fisharebest\Webtrees\Http\RequestHandlers\RepositoryPage;
207use Fisharebest\Webtrees\Http\RequestHandlers\RobotsTxt;
208use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
209use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedPage;
210use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
211use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralPage;
212use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticAction;
213use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticPage;
214use Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
215use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplaceAction;
216use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplacePage;
217use Fisharebest\Webtrees\Http\RequestHandlers\Select2Family;
218use Fisharebest\Webtrees\Http\RequestHandlers\Select2Individual;
219use Fisharebest\Webtrees\Http\RequestHandlers\Select2MediaObject;
220use Fisharebest\Webtrees\Http\RequestHandlers\Select2Note;
221use Fisharebest\Webtrees\Http\RequestHandlers\Select2Place;
222use Fisharebest\Webtrees\Http\RequestHandlers\Select2Repository;
223use Fisharebest\Webtrees\Http\RequestHandlers\Select2Source;
224use Fisharebest\Webtrees\Http\RequestHandlers\Select2Submitter;
225use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree;
226use Fisharebest\Webtrees\Http\RequestHandlers\SelectLanguage;
227use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
228use Fisharebest\Webtrees\Http\RequestHandlers\SelectTheme;
229use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsAction;
230use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
231use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
232use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
233use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
234use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesAction;
235use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesPage;
236use Fisharebest\Webtrees\Http\RequestHandlers\SiteRegistrationAction;
237use Fisharebest\Webtrees\Http\RequestHandlers\SiteRegistrationPage;
238use Fisharebest\Webtrees\Http\RequestHandlers\SourcePage;
239use Fisharebest\Webtrees\Http\RequestHandlers\SubmissionPage;
240use Fisharebest\Webtrees\Http\RequestHandlers\SubmitterPage;
241use Fisharebest\Webtrees\Http\RequestHandlers\SynchronizeTrees;
242use Fisharebest\Webtrees\Http\RequestHandlers\TreePage;
243use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlock;
244use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlockEdit;
245use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlockUpdate;
246use Fisharebest\Webtrees\Http\RequestHandlers\TreePageDefaultEdit;
247use Fisharebest\Webtrees\Http\RequestHandlers\TreePageDefaultUpdate;
248use Fisharebest\Webtrees\Http\RequestHandlers\TreePageEdit;
249use Fisharebest\Webtrees\Http\RequestHandlers\TreePageUpdate;
250use Fisharebest\Webtrees\Http\RequestHandlers\TreePreferencesAction;
251use Fisharebest\Webtrees\Http\RequestHandlers\TreePreferencesPage;
252use Fisharebest\Webtrees\Http\RequestHandlers\TreePrivacyAction;
253use Fisharebest\Webtrees\Http\RequestHandlers\TreePrivacyPage;
254use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedAction;
255use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedPage;
256use Fisharebest\Webtrees\Http\RequestHandlers\UploadMediaAction;
257use Fisharebest\Webtrees\Http\RequestHandlers\UploadMediaPage;
258use Fisharebest\Webtrees\Http\RequestHandlers\UserPage;
259use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlock;
260use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlockEdit;
261use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlockUpdate;
262use Fisharebest\Webtrees\Http\RequestHandlers\UserPageDefaultEdit;
263use Fisharebest\Webtrees\Http\RequestHandlers\UserPageDefaultUpdate;
264use Fisharebest\Webtrees\Http\RequestHandlers\UserPageEdit;
265use Fisharebest\Webtrees\Http\RequestHandlers\UserPageUpdate;
266use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
267use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupPage;
268use Fisharebest\Webtrees\Http\RequestHandlers\VerifyEmail;
269
270/**
271 * Routing table for web requests
272 */
273class WebRoutes
274{
275    public function load(Map $router): void
276    {
277        $router->attach('', '', static function (Map $router) {
278            // Admin routes.
279            $router->attach('', '/admin', static function (Map $router) {
280                $router->extras([
281                    'middleware' => [
282                        AuthAdministrator::class,
283                    ],
284                ]);
285
286                $router->get(ControlPanel::class, '');
287                $router->get(BroadcastPage::class, '/broadcast');
288                $router->post(BroadcastAction::class, '/broadcast');
289                $router->get(CleanDataFolder::class, '/clean');
290                $router->post(DeletePath::class, '/delete-path');
291                $router->get(EmailPreferencesPage::class, '/email');
292                $router->post(EmailPreferencesAction::class, '/email');
293                $router->get(PhpInformation::class, '/information');
294                $router->get(SiteLogsPage::class, '/logs');
295                $router->post(SiteLogsAction::class, '/logs');
296                $router->get(SiteLogsData::class, '/logs-data');
297                $router->post(SiteLogsDelete::class, '/logs-delete');
298                $router->get(SiteLogsDownload::class, '/logs-download');
299                $router->post(Masquerade::class, '/masquerade/{user_id}');
300                $router->get(ManageMediaPage::class, '/media', ManageMediaPage::class);
301                $router->post(ManageMediaAction::class, '/media', ManageMediaAction::class);
302                $router->get(ManageMediaData::class, '/media-data', ManageMediaData::class);
303                $router->get(UploadMediaPage::class, '/media-upload', UploadMediaPage::class);
304                $router->post(UploadMediaAction::class, '/media-upload', UploadMediaAction::class);
305                $router->get(AdminMediaFileDownload::class, '/media-file');
306                $router->get(AdminMediaFileThumbnail::class, '/media-thumbnail');
307                $router->get(CreateTreePage::class, '/trees/create');
308                $router->post(CreateTreeAction::class, '/trees/create');
309                $router->post(SelectDefaultTree::class, '/trees/default/{tree}');
310                $router->post(DeleteTreeAction::class, '/trees/delete/{tree}');
311                $router->get('admin-fix-level-0-media', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0Media');
312                $router->post('admin-fix-level-0-media-action', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0MediaAction');
313                $router->get('admin-fix-level-0-media-data', '/fix-level-0-media-data', 'Admin\FixLevel0MediaController::fixLevel0MediaData');
314                $router->get('admin-webtrees1-thumbs', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1Thumbnails');
315                $router->post('admin-webtrees1-thumbs-action', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsAction');
316                $router->get('admin-webtrees1-thumbs-data', '/webtrees1-thumbs-data', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsData');
317                $router->get(UsersCleanupPage::class, '/users-cleanup');
318                $router->post(UsersCleanupAction::class, '/users-cleanup');
319                $router->get(MapDataList::class, '/map-data');
320                $router->get('map-data-edit', '/map-data-edit', 'Admin\LocationController::mapDataEdit');
321                $router->post('map-data-update', '/map-data-edit', 'Admin\LocationController::mapDataSave');
322                $router->post(MapDataDelete::class, '/map-data-delete');
323                $router->get('locations-export', '/locations-export', 'Admin\LocationController::exportLocations');
324                $router->get('locations-import', '/locations-import', 'Admin\LocationController::importLocations');
325                $router->post('locations-import-action', '/locations-import', 'Admin\LocationController::importLocationsAction');
326                $router->get('map-provider', '/map-provider', 'Admin\MapProviderController::mapProviderEdit');
327                $router->post('map-provider-action', '/map-provider', 'Admin\MapProviderController::mapProviderSave');
328                $router->post(ModuleDeleteSettings::class, '/module-delete-settings');
329                $router->get(ModulesAllPage::class, '/modules');
330                $router->post(ModulesAllAction::class, '/modules');
331                $router->get(ModulesAnalyticsPage::class, '/analytics');
332                $router->post(ModulesAnalyticsAction::class, '/analytics');
333                $router->get(ModulesBlocksPage::class, '/blocks');
334                $router->post(ModulesBlocksAction::class, '/blocks');
335                $router->get(ModulesChartsPage::class, '/charts');
336                $router->post(ModulesChartsAction::class, '/charts');
337                $router->get(ModulesDataFixesPage::class, '/data-fixes');
338                $router->post(ModulesDataFixesAction::class, '/data-fixes');
339                $router->get(ModulesFootersPage::class, '/footers');
340                $router->post(ModulesFootersAction::class, '/footers');
341                $router->get(ModulesHistoricEventsPage::class, '/historic-events');
342                $router->post(ModulesHistoricEventsAction::class, '/historic-events');
343                $router->get(ModulesListsPage::class, '/lists');
344                $router->post(ModulesListsAction::class, '/lists');
345                $router->get(ModulesMenusPage::class, '/menus');
346                $router->post(ModulesMenusAction::class, '/menus');
347                $router->get(ModulesLanguagesPage::class, '/languages');
348                $router->post(ModulesLanguagesAction::class, '/languages');
349                $router->get(ModulesReportsPage::class, '/reports');
350                $router->post(ModulesReportsAction::class, '/reports');
351                $router->get(ModulesSidebarsPage::class, '/sidebars');
352                $router->post(ModulesSidebarsAction::class, '/sidebars');
353                $router->get(ModulesTabsPage::class, '/tabs');
354                $router->post(ModulesTabsAction::class, '/tabs');
355                $router->get(ModulesThemesPage::class, '/themes');
356                $router->post(ModulesThemesAction::class, '/themes');
357                $router->get('upgrade', '/upgrade', 'Admin\UpgradeController::wizard');
358                $router->post('upgrade-confirm', '/upgrade-confirm', 'Admin\UpgradeController::confirm');
359                $router->post('upgrade-action', '/upgrade', 'Admin\UpgradeController::step');
360                $router->get('admin-users', '/admin-users', 'Admin\UsersController::index');
361                $router->get('admin-users-data', '/admin-users-data', 'Admin\UsersController::data');
362                $router->get('admin-users-create', '/admin-users-create', 'Admin\UsersController::create');
363                $router->post('admin-users-create-action', '/admin-users-create', 'Admin\UsersController::save');
364                $router->get('admin-users-edit', '/admin-users-edit', 'Admin\UsersController::edit');
365                $router->post('admin-users-update', '/admin-users-edit', 'Admin\UsersController::update');
366                $router->get(SitePreferencesPage::class, '/site-preferences');
367                $router->post(SitePreferencesAction::class, '/site-preferences');
368                $router->get(SiteRegistrationPage::class, '/site-registration');
369                $router->post(SiteRegistrationAction::class, '/site-registration');
370                $router->get(TreePageDefaultEdit::class, '/trees/default-blocks');
371                $router->post(TreePageDefaultUpdate::class, '/trees/default-blocks');
372                $router->get(MergeTreesPage::class, '/trees/merge');
373                $router->post(MergeTreesAction::class, '/trees/merge');
374                $router->post(SynchronizeTrees::class, '/trees/sync');
375                $router->post(DeleteUser::class, '/users/delete/{user_id}');
376                $router->get(UserPageDefaultEdit::class, '/user-page-default-edit');
377                $router->post(UserPageDefaultUpdate::class, '/user-page-default-update');
378
379                // @deprecated since 2.0.8 - will be removed in 2.1.0
380                $router->get('modules', '/modules', ModulesAllPage::class);
381            });
382
383            // Manager routes (multiple trees).
384            $router->attach('', '/admin', static function (Map $router) {
385                $router->extras([
386                    'middleware' => [
387                        AuthManager::class,
388                    ],
389                ]);
390
391                $router->get(ManageTrees::class, '/trees/manage/{tree}');
392            });
393
394            // Manager routes.
395            $router->attach('', '/tree/{tree}', static function (Map $router) {
396                $router->extras([
397                    'middleware' => [
398                        AuthManager::class,
399                    ],
400                ]);
401
402                $router->get(PendingChangesLogPage::class, '/changes-log');
403                $router->post(PendingChangesLogAction::class, '/changes-log');
404                $router->get(PendingChangesLogData::class, '/changes-data');
405                $router->post(PendingChangesLogDelete::class, '/changes-delete');
406                $router->get(PendingChangesLogDownload::class, '/changes-download');
407                $router->get(CheckTree::class, '/check');
408                $router->get(DataFixChoose::class, '/data-fix');
409                $router->post(DataFixSelect::class, '/data-fix');
410                $router->get(DataFixPage::class, '/data-fix/{data_fix}');
411                $router->post(DataFixUpdate::class, '/data-fix/{data_fix}/update');
412                $router->post(DataFixUpdateAll::class, '/data-fix/{data_fix}/update-all');
413                $router->get(DataFixData::class, '/data-fix/{data_fix}/data');
414                $router->get(DataFixPreview::class, '/data-fix/{data_fix}/preview');
415                $router->get(FindDuplicateRecords::class, '/duplicates');
416                $router->get(ExportGedcomPage::class, '/export');
417                $router->post(ExportGedcomClient::class, '/export-client');
418                $router->post(ExportGedcomServer::class, '/export-server');
419                $router->get(ImportGedcomPage::class, '/import');
420                $router->post(ImportGedcomAction::class, '/import');
421                $router->get(MergeRecordsPage::class, '/merge-step1');
422                $router->post(MergeRecordsAction::class, '/merge-step1');
423                $router->get(MergeFactsPage::class, '/merge-step2');
424                $router->post(MergeFactsAction::class, '/merge-step2');
425                $router->get(TreePreferencesPage::class, '/preferences');
426                $router->post(TreePreferencesAction::class, '/preferences');
427                $router->get(RenumberTreePage::class, '/renumber');
428                $router->post(RenumberTreeAction::class, '/renumber');
429                $router->get(TreePageEdit::class, '/tree-page-edit');
430                $router->post(GedcomLoad::class, '/load');
431                $router->post(TreePageUpdate::class, '/tree-page-update');
432                $router->get(TreePageBlockEdit::class, '/tree-page-block-edit');
433                $router->post(TreePageBlockUpdate::class, '/tree-page-block-edit');
434                $router->get(TreePrivacyPage::class, '/privacy');
435                $router->post(TreePrivacyAction::class, '/privacy');
436                $router->get(UnconnectedPage::class, '/unconnected');
437                $router->post(UnconnectedAction::class, '/unconnected');
438            });
439
440            // Moderator routes.
441            $router->attach('', '/tree/{tree}', static function (Map $router) {
442                $router->extras([
443                    'middleware' => [
444                        AuthModerator::class,
445                    ],
446                ]);
447                $router->post(PendingChangesAcceptTree::class, '/accept');
448                $router->post(PendingChangesAcceptRecord::class, '/accept/{xref}');
449                $router->post(PendingChangesAcceptChange::class, '/accept/{xref}/{change}');
450                $router->get(PendingChanges::class, '/pending');
451                $router->post(PendingChangesRejectTree::class, '/reject');
452                $router->post(PendingChangesRejectRecord::class, '/reject/{xref}');
453                $router->post(PendingChangesRejectChange::class, '/reject/{xref}/{change}');
454            });
455
456            // Editor routes.
457            $router->attach('', '/tree/{tree}', static function (Map $router) {
458                $router->extras([
459                    'middleware' => [
460                        AuthEditor::class,
461                    ],
462                ]);
463
464                $router->get(AutoCompleteCitation::class, '/autocomplete/citation/{query}');
465                $router->get(AutoCompleteFolder::class, '/autocomplete/folder/{query}');
466                $router->get(AutoCompletePlace::class, '/autocomplete/place/{query}');
467                $router->get(AutoCompleteSurname::class, '/autocomplete/surname/{query}');
468                $router->get(AddChildToFamilyPage::class, '/add-child-to-family');
469                $router->post(AddChildToFamilyAction::class, '/add-child-to-family');
470                $router->get(AddNewFact::class, '/add-fact/{xref}/{fact}');
471                $router->post(SelectNewFact::class, '/add-fact/{xref}');
472                $router->get('add-media-file', '/add-media-file', 'EditMediaController::addMediaFile');
473                $router->post('add-media-file-update', '/add-media-file', 'EditMediaController::addMediaFileAction');
474                $router->get(AddName::class, '/add-name');
475                $router->get(AddSpouseToFamilyPage::class, '/add-spouse-to-family');
476                $router->post(AddSpouseToFamilyAction::class, '/add-spouse-to-family');
477                $router->get(ChangeFamilyMembersPage::class, '/change-family-members');
478                $router->post(ChangeFamilyMembersAction::class, '/change-family-members');
479                $router->get(CreateMediaObjectModal::class, '/create-media-object');
480                $router->post(CreateMediaObjectAction::class, '/create-media-object');
481                $router->post('create-media-from-file', '/create-media-from-file', 'EditMediaController::createMediaObjectFromFileAction');
482                $router->post(CopyFact::class, '/copy/{xref}/{fact_id}');
483                $router->get(CreateNoteModal::class, '/create-note-object');
484                $router->post(CreateNoteAction::class, '/create-note-object');
485                $router->get(CreateRepositoryModal::class, '/create-repository');
486                $router->post(CreateRepositoryAction::class, '/create-repository');
487                $router->get(CreateSourceModal::class, '/create-source');
488                $router->post(CreateSourceAction::class, '/create-source');
489                $router->get(CreateSubmitterModal::class, '/create-submitter');
490                $router->post(CreateSubmitterAction::class, '/create-submitter');
491                $router->post(DeleteRecord::class, '/delete/{xref}');
492                $router->post(DeleteFact::class, '/delete/{xref}/{fact_id}');
493                $router->get(EditFactPage::class, '/edit-fact/{xref}/{fact_id}');
494                $router->post(EditFactAction::class, '/update-fact/{xref}{/fact_id}');
495                $router->get('edit-media-file', '/edit-media-file', 'EditMediaController::editMediaFile');
496                $router->post('edit-media-file-update', '/edit-media-file', 'EditMediaController::editMediaFileAction');
497                $router->get('edit-note-object', '/edit-note-object/{xref}', 'EditNoteController::editNoteObject');
498                $router->post('edit-note-object-action', '/edit-note-object/{xref}', 'EditNoteController::updateNoteObject');
499                $router->get(EditRawFactPage::class, '/edit-raw/{xref}/{fact_id}');
500                $router->post(EditRawFactAction::class, '/edit-raw/{xref}/{fact_id}');
501                $router->get(EditRawRecordPage::class, '/edit-raw/{xref}');
502                $router->post(EditRawRecordAction::class, '/edit-raw/{xref}');
503                $router->get('link-media-to-individual', '/link-media-to-individual', 'EditMediaController::linkMediaToIndividual');
504                $router->get('link-media-to-family', '/link-media-to-family', 'EditMediaController::linkMediaToFamily');
505                $router->get('link-media-to-source', '/link-media-to-source', 'EditMediaController::linkMediaToSource');
506                $router->post('link-media-to-record', '/link-media-to-record/{xref}', 'EditMediaController::linkMediaToRecordAction');
507                $router->post(PasteFact::class, '/paste-fact/{xref}');
508                $router->get(ReorderChildrenPage::class, '/reorder-children/{xref}');
509                $router->post(ReorderChildrenAction::class, '/reorder-children/{xref}');
510                $router->get(ReorderMediaPage::class, '/reorder-media/{xref}');
511                $router->post(ReorderMediaAction::class, '/reorder-media/{xref}');
512                $router->get(ReorderNamesPage::class, '/reorder-names/{xref}');
513                $router->post(ReorderNamesAction::class, '/reorder-names/{xref}');
514                $router->get(ReorderFamiliesPage::class, '/reorder-spouses/{xref}');
515                $router->post(ReorderFamiliesAction::class, '/reorder-spouses/{xref}');
516                $router->get(SearchReplacePage::class, '/search-replace');
517                $router->post(SearchReplaceAction::class, '/search-replace');
518                $router->get(AddChildToIndividualPage::class, '/add-child-to-individual');
519                $router->post(AddChildToIndividualAction::class, '/add-child-to-individual');
520                $router->get(AddParentToIndividualPage::class, '/add-parent-to-individual');
521                $router->post(AddParentToIndividualAction::class, '/add-parent-to-individual');
522                $router->get(AddSpouseToIndividualPage::class, '/add-spouse-to-individual');
523                $router->post(AddSpouseToIndividualAction::class, '/add-spouse-to-individual');
524                $router->get(AddUnlinkedPage::class, '/add-unlinked-individual');
525                $router->post(AddUnlinkedAction::class, '/add-unlinked-individual');
526                $router->get(LinkChildToFamilyPage::class, '/link-child-to-family');
527                $router->post(LinkChildToFamilyAction::class, '/link-child-to-family');
528                $router->get(LinkSpouseToIndividualPage::class, '/link-spouse-to-individual');
529                $router->post(LinkSpouseToIndividualAction::class, '/link-spouse-to-individual');
530                $router->get(EditName::class, '/edit-name/{xref}/{fact_id}');
531            });
532
533            // User routes with a tree.
534            $router->attach('', '/tree/{tree}', static function (Map $router) {
535                $router->extras([
536                    'middleware' => [
537                        AuthLoggedIn::class,
538                    ],
539                ]);
540
541                $router->post(MessageSelect::class, '/message-select');
542                $router->get(MessagePage::class, '/message-compose');
543                $router->post(MessageAction::class, '/message-send');
544                $router->get(UserPage::class, '/my-page');
545                $router->get(UserPageBlock::class, '/my-page-block');
546                $router->get(UserPageEdit::class, '/my-page-edit');
547                $router->post(UserPageUpdate::class, '/my-page-edit');
548                $router->get(UserPageBlockEdit::class, '/my-page-block-edit');
549                $router->post(UserPageBlockUpdate::class, '/my-page-block-edit');
550            });
551
552            // User routes without a tree.
553            $router->attach('', '', static function (Map $router) {
554                $router->extras([
555                    'middleware' => [
556                        AuthLoggedIn::class,
557                    ],
558                ]);
559
560                $router->get(AccountEdit::class, '/my-account{/tree}');
561                $router->post(AccountUpdate::class, '/my-account{/tree}');
562                $router->post(AccountDelete::class, '/my-account-delete');
563            });
564
565            // Visitor routes - with an optional tree (for sites with no public trees).
566            $router->attach('', '', static function (Map $router) {
567                $router->get(LoginPage::class, '/login{/tree}');
568                $router->post(LoginAction::class, '/login{/tree}');
569                $router->get(PasswordRequestPage::class, '/password-request{/tree}');
570                $router->post(PasswordRequestAction::class, '/password-request{/tree}');
571                $router->get(RegisterPage::class, '/register{/tree}');
572                $router->post(RegisterAction::class, '/register{/tree}');
573                $router->get(PasswordResetPage::class, '/password-reset/{token}{/tree}');
574                $router->post(PasswordResetAction::class, '/password-reset/{token}{/tree}');
575                $router->get(VerifyEmail::class, '/verify/{username}/{token}{/tree}');
576            });
577
578            // Visitor routes with a tree.
579            $router->attach('', '/tree/{tree}', static function (Map $router) {
580                $router->get(TreePage::class, '');
581                $router->get(CalendarPage::class, '/calendar/{view}');
582                $router->post(CalendarAction::class, '/calendar/{view}');
583                $router->get(CalendarEvents::class, '/calendar-events/{view}');
584                $router->get(ContactPage::class, '/contact');
585                $router->post(ContactAction::class, '/contact');
586                $router->get(FamilyPage::class, '/family/{xref}{/slug}');
587                $router->get(HeaderPage::class, '/header/{xref}{/slug}');
588                $router->get(IndividualPage::class, '/individual/{xref}{/slug}');
589                $router->get(MediaFileThumbnail::class, '/media-thumbnail');
590                $router->get(MediaFileDownload::class, '/media-download');
591                $router->get(MediaPage::class, '/media/{xref}{/slug}');
592                $router->get(NotePage::class, '/note/{xref}{/slug}');
593                $router->get(GedcomRecordPage::class, '/record/{xref}{/slug}');
594                $router->get(RepositoryPage::class, '/repository/{xref}{/slug}');
595                $router->get(ReportListPage::class, '/report');
596                $router->post(ReportListAction::class, '/report');
597                $router->get(ReportSetupPage::class, '/report/{report}');
598                $router->post(ReportSetupAction::class, '/report/{report}');
599                $router->get(ReportGenerate::class, '/report-run/{report}');
600                $router->get(SearchAdvancedPage::class, '/search-advanced');
601                $router->post(SearchAdvancedAction::class, '/search-advanced');
602                $router->get(SearchGeneralPage::class, '/search-general');
603                $router->post(SearchGeneralAction::class, '/search-general');
604                $router->get(SearchPhoneticPage::class, '/search-phonetic');
605                $router->post(SearchPhoneticAction::class, '/search-phonetic');
606                $router->post(SearchQuickAction::class, '/search-quick');
607                $router->post(Select2Family::class, '/select2-family');
608                $router->post(Select2Individual::class, '/select2-individual');
609                $router->post(Select2MediaObject::class, '/select2-media');
610                $router->post(Select2Note::class, '/select2-note');
611                $router->post(Select2Place::class, '/select2-place');
612                $router->post(Select2Source::class, '/select2-source');
613                $router->post(Select2Submitter::class, '/select2-submitter');
614                $router->post(Select2Repository::class, '/select2-repository');
615                $router->get(SourcePage::class, '/source/{xref}{/slug}');
616                $router->get(SubmissionPage::class, '/submission/{xref}{/slug}');
617                $router->get(SubmitterPage::class, '/submitter/{xref}{/slug}');
618                $router->get(TreePageBlock::class, '/tree-page-block');
619                $router->get('example', '/…')
620                    ->isRoutable(false);
621            });
622
623            // Match module routes, with and without a tree.
624            $router->get('module-tree', '/module/{module}/{action}/{tree}', ModuleAction::class)
625                ->allows(RequestMethodInterface::METHOD_POST);
626            $router->get('module-no-tree', '/module/{module}/{action}', ModuleAction::class)
627                ->allows(RequestMethodInterface::METHOD_POST);
628            // Generate module routes only. The router cannot distinguish a private tree from no tree.
629            $router->get('module', '/module/{module}/{action}{/tree}')
630                ->isRoutable(false);
631
632            $router->get(HelpText::class, '/help/{topic}');
633            $router->post(SelectLanguage::class, '/language/{language}');
634            $router->post(Logout::class, '/logout');
635            $router->get(Ping::class, '/ping', Ping::class)
636                ->allows(RequestMethodInterface::METHOD_HEAD);
637            $router->get(RobotsTxt::class, '/robots.txt');
638            $router->post(SelectTheme::class, '/theme/{theme}');
639            $router->get(HomePage::class, '/');
640
641            // Some URL rewrite configurations will pass everything not in /public to index.php
642            $router->get(AppleTouchIconPng::class, '/apple-touch-icon.png');
643            $router->get(FaviconIco::class, '/favicon.ico');
644        });
645    }
646}
647