xref: /webtrees/app/Http/Routes/WebRoutes.php (revision 6577bfc3111b4789852b83f46e19d92c9b59921c)
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\AuthMember;
29use Fisharebest\Webtrees\Http\Middleware\AuthModerator;
30use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
31use Fisharebest\Webtrees\Http\RequestHandlers\AccountEdit;
32use Fisharebest\Webtrees\Http\RequestHandlers\AccountUpdate;
33use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyAction;
34use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToFamilyPage;
35use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualAction;
36use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualPage;
37use Fisharebest\Webtrees\Http\RequestHandlers\AddName;
38use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
39use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualAction;
40use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage;
41use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyAction;
42use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToFamilyPage;
43use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualAction;
44use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualPage;
45use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedAction;
46use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedPage;
47use Fisharebest\Webtrees\Http\RequestHandlers\AdminMediaFileDownload;
48use Fisharebest\Webtrees\Http\RequestHandlers\AdminMediaFileThumbnail;
49use Fisharebest\Webtrees\Http\RequestHandlers\AppleTouchIconPng;
50use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastAction;
51use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastPage;
52use Fisharebest\Webtrees\Http\RequestHandlers\CalendarAction;
53use Fisharebest\Webtrees\Http\RequestHandlers\CalendarEvents;
54use Fisharebest\Webtrees\Http\RequestHandlers\CalendarPage;
55use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
56use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersPage;
57use Fisharebest\Webtrees\Http\RequestHandlers\CleanDataFolder;
58use Fisharebest\Webtrees\Http\RequestHandlers\ContactAction;
59use Fisharebest\Webtrees\Http\RequestHandlers\ContactPage;
60use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
61use Fisharebest\Webtrees\Http\RequestHandlers\CopyFact;
62use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectAction;
63use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectModal;
64use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteAction;
65use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteModal;
66use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryAction;
67use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryModal;
68use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceAction;
69use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceModal;
70use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterAction;
71use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterModal;
72use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreeAction;
73use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreePage;
74use Fisharebest\Webtrees\Http\RequestHandlers\DataFixChoose;
75use Fisharebest\Webtrees\Http\RequestHandlers\DataFixData;
76use Fisharebest\Webtrees\Http\RequestHandlers\DataFixPage;
77use Fisharebest\Webtrees\Http\RequestHandlers\DataFixPreview;
78use Fisharebest\Webtrees\Http\RequestHandlers\DataFixSelect;
79use Fisharebest\Webtrees\Http\RequestHandlers\DataFixUpdate;
80use Fisharebest\Webtrees\Http\RequestHandlers\DataFixUpdateAll;
81use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact;
82use Fisharebest\Webtrees\Http\RequestHandlers\DeletePath;
83use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
84use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction;
85use Fisharebest\Webtrees\Http\RequestHandlers\DeleteUser;
86use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction;
87use Fisharebest\Webtrees\Http\RequestHandlers\EditFactPage;
88use Fisharebest\Webtrees\Http\RequestHandlers\EditName;
89use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
90use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage;
91use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
92use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
93use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesAction;
94use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesPage;
95use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomClient;
96use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomPage;
97use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomServer;
98use Fisharebest\Webtrees\Http\RequestHandlers\FamilyPage;
99use Fisharebest\Webtrees\Http\RequestHandlers\FaviconIco;
100use Fisharebest\Webtrees\Http\RequestHandlers\GedcomRecordPage;
101use Fisharebest\Webtrees\Http\RequestHandlers\HeaderPage;
102use Fisharebest\Webtrees\Http\RequestHandlers\HelpText;
103use Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
104use Fisharebest\Webtrees\Http\RequestHandlers\IndividualPage;
105use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyAction;
106use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyPage;
107use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualAction;
108use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualPage;
109use Fisharebest\Webtrees\Http\RequestHandlers\LoginAction;
110use Fisharebest\Webtrees\Http\RequestHandlers\LoginPage;
111use Fisharebest\Webtrees\Http\RequestHandlers\Logout;
112use Fisharebest\Webtrees\Http\RequestHandlers\MapDataDelete;
113use Fisharebest\Webtrees\Http\RequestHandlers\MapDataList;
114use Fisharebest\Webtrees\Http\RequestHandlers\Masquerade;
115use Fisharebest\Webtrees\Http\RequestHandlers\MediaFileDownload;
116use Fisharebest\Webtrees\Http\RequestHandlers\MediaFileThumbnail;
117use Fisharebest\Webtrees\Http\RequestHandlers\MediaPage;
118use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsAction;
119use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsPage;
120use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsAction;
121use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsPage;
122use Fisharebest\Webtrees\Http\RequestHandlers\MessageAction;
123use Fisharebest\Webtrees\Http\RequestHandlers\MessagePage;
124use Fisharebest\Webtrees\Http\RequestHandlers\MessageSelect;
125use Fisharebest\Webtrees\Http\RequestHandlers\ModuleAction;
126use Fisharebest\Webtrees\Http\RequestHandlers\NotePage;
127use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestAction;
128use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestPage;
129use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetAction;
130use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetPage;
131use Fisharebest\Webtrees\Http\RequestHandlers\PasteFact;
132use Fisharebest\Webtrees\Http\RequestHandlers\PendingChanges;
133use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptChange;
134use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
135use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptTree;
136use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogAction;
137use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogData;
138use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDelete;
139use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDownload;
140use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogPage;
141use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectChange;
142use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
143use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectTree;
144use Fisharebest\Webtrees\Http\RequestHandlers\PhpInformation;
145use Fisharebest\Webtrees\Http\RequestHandlers\Ping;
146use Fisharebest\Webtrees\Http\RequestHandlers\RegisterAction;
147use Fisharebest\Webtrees\Http\RequestHandlers\RegisterPage;
148use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenAction;
149use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
150use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesAction;
151use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage;
152use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaAction;
153use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
154use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesAction;
155use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
156use Fisharebest\Webtrees\Http\RequestHandlers\ReportGenerate;
157use Fisharebest\Webtrees\Http\RequestHandlers\ReportListAction;
158use Fisharebest\Webtrees\Http\RequestHandlers\ReportListPage;
159use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupAction;
160use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupPage;
161use Fisharebest\Webtrees\Http\RequestHandlers\RepositoryPage;
162use Fisharebest\Webtrees\Http\RequestHandlers\RobotsTxt;
163use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
164use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedPage;
165use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
166use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralPage;
167use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticAction;
168use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticPage;
169use Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
170use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplaceAction;
171use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplacePage;
172use Fisharebest\Webtrees\Http\RequestHandlers\Select2Family;
173use Fisharebest\Webtrees\Http\RequestHandlers\Select2Individual;
174use Fisharebest\Webtrees\Http\RequestHandlers\Select2MediaObject;
175use Fisharebest\Webtrees\Http\RequestHandlers\Select2Note;
176use Fisharebest\Webtrees\Http\RequestHandlers\Select2Place;
177use Fisharebest\Webtrees\Http\RequestHandlers\Select2Repository;
178use Fisharebest\Webtrees\Http\RequestHandlers\Select2Source;
179use Fisharebest\Webtrees\Http\RequestHandlers\Select2Submitter;
180use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree;
181use Fisharebest\Webtrees\Http\RequestHandlers\SelectLanguage;
182use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
183use Fisharebest\Webtrees\Http\RequestHandlers\SelectTheme;
184use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsAction;
185use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
186use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
187use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
188use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
189use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesAction;
190use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesPage;
191use Fisharebest\Webtrees\Http\RequestHandlers\SiteRegistrationAction;
192use Fisharebest\Webtrees\Http\RequestHandlers\SiteRegistrationPage;
193use Fisharebest\Webtrees\Http\RequestHandlers\SourcePage;
194use Fisharebest\Webtrees\Http\RequestHandlers\SubmissionPage;
195use Fisharebest\Webtrees\Http\RequestHandlers\SubmitterPage;
196use Fisharebest\Webtrees\Http\RequestHandlers\TreePage;
197use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlock;
198use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlockEdit;
199use Fisharebest\Webtrees\Http\RequestHandlers\TreePageBlockUpdate;
200use Fisharebest\Webtrees\Http\RequestHandlers\TreePageDefaultEdit;
201use Fisharebest\Webtrees\Http\RequestHandlers\TreePageDefaultUpdate;
202use Fisharebest\Webtrees\Http\RequestHandlers\TreePageEdit;
203use Fisharebest\Webtrees\Http\RequestHandlers\TreePageUpdate;
204use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedAction;
205use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedPage;
206use Fisharebest\Webtrees\Http\RequestHandlers\UserPage;
207use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlock;
208use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlockEdit;
209use Fisharebest\Webtrees\Http\RequestHandlers\UserPageBlockUpdate;
210use Fisharebest\Webtrees\Http\RequestHandlers\UserPageDefaultEdit;
211use Fisharebest\Webtrees\Http\RequestHandlers\UserPageDefaultUpdate;
212use Fisharebest\Webtrees\Http\RequestHandlers\UserPageEdit;
213use Fisharebest\Webtrees\Http\RequestHandlers\UserPageUpdate;
214use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
215use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupPage;
216use Fisharebest\Webtrees\Http\RequestHandlers\VerifyEmail;
217
218/**
219 * Routing table for web requests
220 */
221class WebRoutes
222{
223    public function load(Map $router): void
224    {
225        $router->attach('', '', static function (Map $router) {
226            // Admin routes.
227            $router->attach('', '/admin', static function (Map $router) {
228                $router->extras([
229                    'middleware' => [
230                        AuthAdministrator::class,
231                    ],
232                ]);
233
234                $router->get(ControlPanel::class, '');
235                $router->get(BroadcastPage::class, '/broadcast');
236                $router->post(BroadcastAction::class, '/broadcast');
237                $router->get(CleanDataFolder::class, '/clean');
238                $router->post(DeletePath::class, '/delete-path');
239                $router->get(EmailPreferencesPage::class, '/email');
240                $router->post(EmailPreferencesAction::class, '/email');
241                $router->get(PhpInformation::class, '/information');
242                $router->get(SiteLogsPage::class, '/logs');
243                $router->post(SiteLogsAction::class, '/logs');
244                $router->get(SiteLogsData::class, '/logs-data');
245                $router->post(SiteLogsDelete::class, '/logs-delete');
246                $router->get(SiteLogsDownload::class, '/logs-download');
247                $router->post(Masquerade::class, '/masquerade/{user_id}');
248                $router->get('admin-media', '/media', 'Admin\MediaController::index');
249                $router->post('admin-media-select', '/media', 'Admin\MediaController::select');
250                $router->get('admin-media-data', '/media-data', 'Admin\MediaController::data');
251                $router->get('admin-media-upload', '/media-upload', 'Admin\MediaController::upload');
252                $router->post('admin-media-upload-action', '/media-upload', 'Admin\MediaController::uploadAction');
253                $router->get(AdminMediaFileDownload::class, '/media-file/{path}');
254                $router->get(AdminMediaFileThumbnail::class, '/media-thumbnail/{path}');
255                $router->get(CreateTreePage::class, '/trees/create');
256                $router->post(CreateTreeAction::class, '/trees/create');
257                $router->post(SelectDefaultTree::class, '/trees/default/{tree}');
258                $router->post(DeleteTreeAction::class, '/trees/delete/{tree}');
259                $router->get('admin-fix-level-0-media', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0Media');
260                $router->post('admin-fix-level-0-media-action', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0MediaAction');
261                $router->get('admin-fix-level-0-media-data', '/fix-level-0-media-data', 'Admin\FixLevel0MediaController::fixLevel0MediaData');
262                $router->get('admin-webtrees1-thumbs', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1Thumbnails');
263                $router->post('admin-webtrees1-thumbs-action', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsAction');
264                $router->get('admin-webtrees1-thumbs-data', '/webtrees1-thumbs-data', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsData');
265                $router->get('modules', '/modules', 'Admin\ModuleController::list');
266                $router->post('modules-update', '/modules', 'Admin\ModuleController::update');
267                $router->get('analytics', '/analytics', 'Admin\ModuleController::listAnalytics');
268                $router->post('analytics-update', '/analytics', 'Admin\ModuleController::updateAnalytics');
269                $router->get('blocks', '/blocks', 'Admin\ModuleController::listBlocks');
270                $router->post('blocks-update', '/blocks', 'Admin\ModuleController::updateBlocks');
271                $router->get('charts', '/charts', 'Admin\ModuleController::listCharts');
272                $router->post('charts-update', '/charts', 'Admin\ModuleController::updateCharts');
273                $router->get('data-fixes', '/data-fixes', 'Admin\ModuleController::listDataFixes');
274                $router->post('data-fixes-update', '/data-fixes', 'Admin\ModuleController::updateDataFixes');
275                $router->get('lists', '/lists', 'Admin\ModuleController::listLists');
276                $router->post('lists-update', '/lists', 'Admin\ModuleController::updateLists');
277                $router->get('footers', '/footers', 'Admin\ModuleController::listFooters');
278                $router->post('footers-update', '/footers', 'Admin\ModuleController::updateFooters');
279                $router->get('history', '/history', 'Admin\ModuleController::listHistory');
280                $router->post('history-update', '/history', 'Admin\ModuleController::updateHistory');
281                $router->get('menus', '/menus', 'Admin\ModuleController::listMenus');
282                $router->post('menus-update', '/menus', 'Admin\ModuleController::updateMenus');
283                $router->get('languages', '/languages', 'Admin\ModuleController::listLanguages');
284                $router->post('languages-update', '/languages', 'Admin\ModuleController::updateLanguages');
285                $router->get('reports', '/reports', 'Admin\ModuleController::listReports');
286                $router->post('reports-update', '/reports', 'Admin\ModuleController::updateReports');
287                $router->get('sidebars', '/sidebars', 'Admin\ModuleController::listSidebars');
288                $router->post('sidebars-update', '/sidebars', 'Admin\ModuleController::updateSidebars');
289                $router->get('themes', '/themes', 'Admin\ModuleController::listThemes');
290                $router->post('themes-update', '/themes', 'Admin\ModuleController::updateThemes');
291                $router->get('tabs', '/tabs', 'Admin\ModuleController::listTabs');
292                $router->post('tabs-update', '/tabs', 'Admin\ModuleController::updateTabs');
293                $router->get(UsersCleanupPage::class, '/users-cleanup');
294                $router->post(UsersCleanupAction::class, '/users-cleanup');
295                $router->post('delete-module-settings', '/delete-module-settings', 'Admin\ModuleController::deleteModuleSettings');
296                $router->get(MapDataList::class, '/map-data');
297                $router->get('map-data-edit', '/map-data-edit', 'Admin\LocationController::mapDataEdit');
298                $router->post('map-data-update', '/map-data-edit', 'Admin\LocationController::mapDataSave');
299                $router->post(MapDataDelete::class, '/map-data-delete');
300                $router->get('locations-export', '/locations-export', 'Admin\LocationController::exportLocations');
301                $router->get('locations-import', '/locations-import', 'Admin\LocationController::importLocations');
302                $router->post('locations-import-action', '/locations-import', 'Admin\LocationController::importLocationsAction');
303                $router->get('map-provider', '/map-provider', 'Admin\MapProviderController::mapProviderEdit');
304                $router->post('map-provider-action', '/map-provider', 'Admin\MapProviderController::mapProviderSave');
305                $router->get('upgrade', '/upgrade', 'Admin\UpgradeController::wizard');
306                $router->post('upgrade-confirm', '/upgrade-confirm', 'Admin\UpgradeController::confirm');
307                $router->post('upgrade-action', '/upgrade', 'Admin\UpgradeController::step');
308                $router->get('admin-users', '/admin-users', 'Admin\UsersController::index');
309                $router->get('admin-users-data', '/admin-users-data', 'Admin\UsersController::data');
310                $router->get('admin-users-create', '/admin-users-create', 'Admin\UsersController::create');
311                $router->post('admin-users-create-action', '/admin-users-create', 'Admin\UsersController::save');
312                $router->get('admin-users-edit', '/admin-users-edit', 'Admin\UsersController::edit');
313                $router->post('admin-users-update', '/admin-users-edit', 'Admin\UsersController::update');
314                $router->get(SitePreferencesPage::class, '/site-preferences');
315                $router->post(SitePreferencesAction::class, '/site-preferences');
316                $router->get(SiteRegistrationPage::class, '/site-registration');
317                $router->post(SiteRegistrationAction::class, '/site-registration');
318                $router->get(TreePageDefaultEdit::class, '/trees/default-blocks');
319                $router->post(TreePageDefaultUpdate::class, '/trees/default-blocks');
320                $router->get('admin-trees-merge', '/trees/merge', 'AdminTreesController::merge');
321                $router->post('admin-trees-merge-action', '/trees/merge', 'AdminTreesController::mergeAction');
322                $router->post('admin-trees-sync', '/trees/sync', 'AdminTreesController::synchronize');
323                $router->post('delete-user', '/users/delete/{user_id}', DeleteUser::class);
324                $router->get(UserPageDefaultEdit::class, '/user-page-default-edit');
325                $router->post(UserPageDefaultUpdate::class, '/user-page-default-update');
326            });
327
328            // Manager routes (multiple trees).
329            $router->attach('', '/admin', static function (Map $router) {
330                $router->extras([
331                    'middleware' => [
332                        AuthManager::class,
333                    ],
334                ]);
335
336                $router->get('manage-trees', '/trees/manage/{tree}', 'AdminTreesController::index');
337            });
338
339            // Manager routes.
340            $router->attach('', '/tree/{tree}', static function (Map $router) {
341                $router->extras([
342                    'middleware' => [
343                        AuthManager::class,
344                    ],
345                ]);
346
347                $router->get(PendingChangesLogPage::class, '/changes-log');
348                $router->post(PendingChangesLogAction::class, '/changes-log');
349                $router->get(PendingChangesLogData::class, '/changes-data');
350                $router->post(PendingChangesLogDelete::class, '/changes-delete');
351                $router->get(PendingChangesLogDownload::class, '/changes-download');
352                $router->get('admin-trees-check', '/check', 'AdminTreesController::check');
353                $router->get(DataFixChoose::class, '/data-fix');
354                $router->post(DataFixSelect::class, '/data-fix');
355                $router->get(DataFixPage::class, '/data-fix/{data_fix}');
356                $router->post(DataFixUpdate::class, '/data-fix/{data_fix}/update');
357                $router->post(DataFixUpdateAll::class, '/data-fix/{data_fix}/update-all');
358                $router->get(DataFixData::class, '/data-fix/{data_fix}/data');
359                $router->get(DataFixPreview::class, '/data-fix/{data_fix}/preview');
360                $router->get('admin-trees-duplicates', '/duplicates', 'AdminTreesController::duplicates');
361                $router->get(ExportGedcomPage::class, '/export');
362                $router->post(ExportGedcomClient::class, '/export-client');
363                $router->post(ExportGedcomServer::class, '/export-server');
364                $router->get('admin-trees-import', '/import', 'AdminTreesController::importForm');
365                $router->post('admin-trees-import-action', '/import', 'AdminTreesController::importAction');
366                $router->get(MergeRecordsPage::class, '/merge-step1');
367                $router->post(MergeRecordsAction::class, '/merge-step1');
368                $router->get(MergeFactsPage::class, '/merge-step2');
369                $router->post(MergeFactsAction::class, '/merge-step2');
370                $router->get('admin-trees-preferences', '/preferences', 'AdminTreesController::preferences');
371                $router->post('admin-trees-preferences-update', '/preferences', 'AdminTreesController::preferencesUpdate');
372                $router->get('admin-trees-renumber', '/renumber', 'AdminTreesController::renumber');
373                $router->post('admin-trees-renumber-action', '/renumber', 'AdminTreesController::renumberAction');
374                $router->get(TreePageEdit::class, '/tree-page-edit');
375                $router->post('import', '/load', 'GedcomFileController::import');
376                $router->post(TreePageUpdate::class, '/tree-page-update');
377                $router->get(TreePageBlockEdit::class, '/tree-page-block-edit');
378                $router->post(TreePageBlockUpdate::class, '/tree-page-block-edit');
379                $router->get('tree-preferences', '/preferences', 'AdminController::treePreferencesEdit');
380                $router->post('tree-preferences-update', '/preferences', 'AdminController::treePreferencesUpdate');
381                $router->get('tree-privacy', '/privacy', 'AdminController::treePrivacyEdit');
382                $router->post('tree-privacy-update', '/privacy', 'AdminController::treePrivacyUpdate');
383                $router->get(UnconnectedPage::class, '/unconnected');
384                $router->post(UnconnectedAction::class, '/unconnected');
385            });
386
387            // Moderator routes.
388            $router->attach('', '/tree/{tree}', static function (Map $router) {
389                $router->extras([
390                    'middleware' => [
391                        AuthModerator::class,
392                    ],
393                ]);
394                $router->post(PendingChangesAcceptTree::class, '/accept');
395                $router->post(PendingChangesAcceptRecord::class, '/accept/{xref}');
396                $router->post(PendingChangesAcceptChange::class, '/accept/{xref}/{change}');
397                $router->get(PendingChanges::class, '/pending');
398                $router->post(PendingChangesRejectTree::class, '/reject');
399                $router->post(PendingChangesRejectRecord::class, '/reject/{xref}');
400                $router->post(PendingChangesRejectChange::class, '/reject/{xref}/{change}');
401            });
402
403            // Editor routes.
404            $router->attach('', '/tree/{tree}', static function (Map $router) {
405                $router->extras([
406                    'middleware' => [
407                        AuthEditor::class,
408                    ],
409                ]);
410
411                $router->get(AddChildToFamilyPage::class, '/add-child-to-family');
412                $router->post(AddChildToFamilyAction::class, '/add-child-to-family');
413                $router->get(AddNewFact::class, '/add-fact/{xref}/{fact}');
414                $router->post(SelectNewFact::class, '/add-fact/{xref}');
415                $router->get('add-media-file', '/add-media-file', 'EditMediaController::addMediaFile');
416                $router->post('add-media-file-update', '/add-media-file', 'EditMediaController::addMediaFileAction');
417                $router->get(AddName::class, '/add-name');
418                $router->get(AddSpouseToFamilyPage::class, '/add-spouse-to-family');
419                $router->post(AddSpouseToFamilyAction::class, '/add-spouse-to-family');
420                $router->get(ChangeFamilyMembersPage::class, '/change-family-members');
421                $router->post(ChangeFamilyMembersAction::class, '/change-family-members');
422                $router->get(CreateMediaObjectModal::class, '/create-media-object');
423                $router->post(CreateMediaObjectAction::class, '/create-media-object');
424                $router->post('create-media-from-file', '/create-media-from-file', 'EditMediaController::createMediaObjectFromFileAction');
425                $router->post(CopyFact::class, '/copy/{xref}/{fact_id}');
426                $router->get(CreateNoteModal::class, '/create-note-object');
427                $router->post(CreateNoteAction::class, '/create-note-object');
428                $router->get(CreateRepositoryModal::class, '/create-repository');
429                $router->post(CreateRepositoryAction::class, '/create-repository');
430                $router->get(CreateSourceModal::class, '/create-source');
431                $router->post(CreateSourceAction::class, '/create-source');
432                $router->get(CreateSubmitterModal::class, '/create-submitter');
433                $router->post(CreateSubmitterAction::class, '/create-submitter');
434                $router->post(DeleteRecord::class, '/delete/{xref}');
435                $router->post(DeleteFact::class, '/delete/{xref}/{fact_id}');
436                $router->get(EditFactPage::class, '/edit-fact/{xref}/{fact_id}');
437                $router->post(EditFactAction::class, '/update-fact/{xref}{/fact_id}');
438                $router->get('edit-media-file', '/edit-media-file', 'EditMediaController::editMediaFile');
439                $router->post('edit-media-file-update', '/edit-media-file', 'EditMediaController::editMediaFileAction');
440                $router->get('edit-note-object', '/edit-note-object/{xref}', 'EditNoteController::editNoteObject');
441                $router->post('edit-note-object-action', '/edit-note-object/{xref}', 'EditNoteController::updateNoteObject');
442                $router->get(EditRawFactPage::class, '/edit-raw/{xref}/{fact_id}');
443                $router->post(EditRawFactAction::class, '/edit-raw/{xref}/{fact_id}');
444                $router->get(EditRawRecordPage::class, '/edit-raw/{xref}');
445                $router->post(EditRawRecordAction::class, '/edit-raw/{xref}');
446                $router->get('link-media-to-individual', '/link-media-to-individual', 'EditMediaController::linkMediaToIndividual');
447                $router->get('link-media-to-family', '/link-media-to-family', 'EditMediaController::linkMediaToFamily');
448                $router->get('link-media-to-source', '/link-media-to-source', 'EditMediaController::linkMediaToSource');
449                $router->post('link-media-to-record', '/link-media-to-record/{xref}', 'EditMediaController::linkMediaToRecordAction');
450                $router->post(PasteFact::class, '/paste-fact/{xref}');
451                $router->get(ReorderChildrenPage::class, '/reorder-children/{xref}');
452                $router->post(ReorderChildrenAction::class, '/reorder-children/{xref}');
453                $router->get(ReorderMediaPage::class, '/reorder-media/{xref}');
454                $router->post(ReorderMediaAction::class, '/reorder-media/{xref}');
455                $router->get(ReorderNamesPage::class, '/reorder-names/{xref}');
456                $router->post(ReorderNamesAction::class, '/reorder-names/{xref}');
457                $router->get(ReorderFamiliesPage::class, '/reorder-spouses/{xref}');
458                $router->post(ReorderFamiliesAction::class, '/reorder-spouses/{xref}');
459                $router->get(SearchReplacePage::class, '/search-replace');
460                $router->post(SearchReplaceAction::class, '/search-replace');
461                $router->get(AddChildToIndividualPage::class, '/add-child-to-individual');
462                $router->post(AddChildToIndividualAction::class, '/add-child-to-individual');
463                $router->get(AddParentToIndividualPage::class, '/add-parent-to-individual');
464                $router->post(AddParentToIndividualAction::class, '/add-parent-to-individual');
465                $router->get(AddSpouseToIndividualPage::class, '/add-spouse-to-individual');
466                $router->post(AddSpouseToIndividualAction::class, '/add-spouse-to-individual');
467                $router->get(AddUnlinkedPage::class, '/add-unlinked-individual');
468                $router->post(AddUnlinkedAction::class, '/add-unlinked-individual');
469                $router->get(LinkChildToFamilyPage::class, '/link-child-to-family');
470                $router->post(LinkChildToFamilyAction::class, '/link-child-to-family');
471                $router->get(LinkSpouseToIndividualPage::class, '/link-spouse-to-individual');
472                $router->post(LinkSpouseToIndividualAction::class, '/link-spouse-to-individual');
473                $router->get(EditName::class, '/edit-name/{xref}/{fact_id}');
474            });
475
476            // Member routes.
477            $router->attach('', '/tree/{tree}', static function (Map $router) {
478                $router->extras([
479                    'middleware' => [
480                        AuthMember::class,
481                    ],
482                ]);
483
484                $router->post(MessageSelect::class, '/message-select');
485                $router->get(MessagePage::class, '/message-compose');
486                $router->post(MessageAction::class, '/message-send');
487                $router->get(UserPage::class, '/my-page');
488                $router->get(UserPageBlock::class, '/my-page-block');
489                $router->get(UserPageEdit::class, '/my-page-edit');
490                $router->post(UserPageUpdate::class, '/my-page-edit');
491                $router->get(UserPageBlockEdit::class, '/my-page-block-edit');
492                $router->post(UserPageBlockUpdate::class, '/my-page-block-edit');
493            });
494
495            // User routes.
496            $router->attach('', '', static function (Map $router) {
497                $router->extras([
498                    'middleware' => [
499                        AuthLoggedIn::class,
500                    ],
501                ]);
502
503                $router->get(AccountEdit::class, '/my-account{/tree}');
504                $router->post(AccountUpdate::class, '/my-account{/tree}');
505                $router->post(AccountDelete::class, '/my-account-delete');
506            });
507
508            // Visitor routes - with an optional tree (for sites with no public trees).
509            $router->attach('', '', static function (Map $router) {
510                $router->get(LoginPage::class, '/login{/tree}');
511                $router->post(LoginAction::class, '/login{/tree}');
512                $router->get(PasswordRequestPage::class, '/password-request{/tree}');
513                $router->post(PasswordRequestAction::class, '/password-request{/tree}');
514                $router->get(RegisterPage::class, '/register{/tree}');
515                $router->post(RegisterAction::class, '/register{/tree}');
516                $router->get(PasswordResetPage::class, '/password-reset/{token}{/tree}');
517                $router->post(PasswordResetAction::class, '/password-reset/{token}{/tree}');
518                $router->get(VerifyEmail::class, '/verify/{username}/{token}{/tree}');
519            });
520
521            // Visitor routes with a tree.
522            $router->attach('', '/tree/{tree}', static function (Map $router) {
523                $router->get(TreePage::class, '');
524                $router->get('autocomplete-folder', '/autocomplete-folder', 'AutocompleteController::folder');
525                $router->get('autocomplete-page', '/autocomplete-page', 'AutocompleteController::page');
526                $router->get('autocomplete-place', '/autocomplete-place', 'AutocompleteController::place');
527                $router->get(CalendarPage::class, '/calendar/{view}');
528                $router->post(CalendarAction::class, '/calendar/{view}');
529                $router->get(CalendarEvents::class, '/calendar-events/{view}');
530                $router->get(ContactPage::class, '/contact');
531                $router->post(ContactAction::class, '/contact');
532                $router->get(FamilyPage::class, '/family/{xref}{/slug}');
533                $router->get(HeaderPage::class, '/header/{xref}{/slug}');
534                $router->get(IndividualPage::class, '/individual/{xref}{/slug}');
535                $router->get(MediaFileThumbnail::class, '/media-thumbnail');
536                $router->get(MediaFileDownload::class, '/media-download');
537                $router->get(MediaPage::class, '/media/{xref}{/slug}');
538                $router->get(NotePage::class, '/note/{xref}{/slug}');
539                $router->get(GedcomRecordPage::class, '/record/{xref}{/slug}');
540                $router->get(RepositoryPage::class, '/repository/{xref}{/slug}');
541                $router->get(ReportListPage::class, '/report');
542                $router->post(ReportListAction::class, '/report');
543                $router->get(ReportSetupPage::class, '/report/{report}');
544                $router->post(ReportSetupAction::class, '/report/{report}');
545                $router->get(ReportGenerate::class, '/report-run/{report}');
546                $router->get(SearchAdvancedPage::class, '/search-advanced');
547                $router->post(SearchAdvancedAction::class, '/search-advanced');
548                $router->get(SearchGeneralPage::class, '/search-general');
549                $router->post(SearchGeneralAction::class, '/search-general');
550                $router->get(SearchPhoneticPage::class, '/search-phonetic');
551                $router->post(SearchPhoneticAction::class, '/search-phonetic');
552                $router->post(SearchQuickAction::class, '/search-quick');
553                $router->post(Select2Family::class, '/select2-family');
554                $router->post(Select2Individual::class, '/select2-individual');
555                $router->post(Select2MediaObject::class, '/select2-media');
556                $router->post(Select2Note::class, '/select2-note');
557                $router->post(Select2Place::class, '/select2-place');
558                $router->post(Select2Source::class, '/select2-source');
559                $router->post(Select2Submitter::class, '/select2-submitter');
560                $router->post(Select2Repository::class, '/select2-repository');
561                $router->get(SourcePage::class, '/source/{xref}{/slug}');
562                $router->get(SubmissionPage::class, '/submission/{xref}{/slug}');
563                $router->get(SubmitterPage::class, '/submitter/{xref}{/slug}');
564                $router->get(TreePageBlock::class, '/tree-page-block');
565                $router->get('example', '/…')
566                    ->isRoutable(false);
567            });
568
569            // Match module routes, with and without a tree.
570            $router->get('module-tree', '/module/{module}/{action}/{tree}', ModuleAction::class)
571                ->allows(RequestMethodInterface::METHOD_POST);
572            $router->get('module-no-tree', '/module/{module}/{action}', ModuleAction::class)
573                ->allows(RequestMethodInterface::METHOD_POST);
574            // Generate module routes only. The router cannot distinguish a private tree from no tree.
575            $router->get('module', '/module/{module}/{action}{/tree}')
576                ->isRoutable(false);
577
578            $router->get(HelpText::class, '/help/{topic}');
579            $router->post(SelectLanguage::class, '/language/{language}');
580            $router->post(Logout::class, '/logout');
581            $router->get(Ping::class, '/ping', Ping::class)
582                ->allows(RequestMethodInterface::METHOD_HEAD);
583            $router->get(RobotsTxt::class, '/robots.txt');
584            $router->post(SelectTheme::class, '/theme/{theme}');
585            $router->get(HomePage::class, '/');
586
587            // Some URL rewrite configurations will pass everything not in /public to index.php
588            $router->get(AppleTouchIconPng::class, '/apple-touch-icon.png');
589            $router->get(FaviconIco::class, '/favicon.ico');
590        });
591    }
592}
593