xref: /webtrees/app/Http/Routes/WebRoutes.php (revision b4144a6daa0ef63a3c936d7bce4cdd925efc2a2c)
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\Middleware\AuthVisitor;
31use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
32use Fisharebest\Webtrees\Http\RequestHandlers\AccountEdit;
33use Fisharebest\Webtrees\Http\RequestHandlers\AccountUpdate;
34use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
35use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastAction;
36use Fisharebest\Webtrees\Http\RequestHandlers\BroadcastPage;
37use Fisharebest\Webtrees\Http\RequestHandlers\CleanDataFolder;
38use Fisharebest\Webtrees\Http\RequestHandlers\ContactAction;
39use Fisharebest\Webtrees\Http\RequestHandlers\ContactPage;
40use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
41use Fisharebest\Webtrees\Http\RequestHandlers\CopyFact;
42use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectAction;
43use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectModal;
44use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteAction;
45use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteModal;
46use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryAction;
47use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryModal;
48use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceAction;
49use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceModal;
50use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterAction;
51use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterModal;
52use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreeAction;
53use Fisharebest\Webtrees\Http\RequestHandlers\CreateTreePage;
54use Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact;
55use Fisharebest\Webtrees\Http\RequestHandlers\DeletePath;
56use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
57use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction;
58use Fisharebest\Webtrees\Http\RequestHandlers\DeleteUser;
59use Fisharebest\Webtrees\Http\RequestHandlers\EditFact;
60use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactAction;
61use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage;
62use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordAction;
63use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
64use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomClient;
65use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomPage;
66use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomServer;
67use Fisharebest\Webtrees\Http\RequestHandlers\FamilyPage;
68use Fisharebest\Webtrees\Http\RequestHandlers\GedcomRecordPage;
69use Fisharebest\Webtrees\Http\RequestHandlers\HelpText;
70use Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
71use Fisharebest\Webtrees\Http\RequestHandlers\IndividualPage;
72use Fisharebest\Webtrees\Http\RequestHandlers\LoginAction;
73use Fisharebest\Webtrees\Http\RequestHandlers\LoginPage;
74use Fisharebest\Webtrees\Http\RequestHandlers\Logout;
75use Fisharebest\Webtrees\Http\RequestHandlers\Masquerade;
76use Fisharebest\Webtrees\Http\RequestHandlers\MediaPage;
77use Fisharebest\Webtrees\Http\RequestHandlers\MessageAction;
78use Fisharebest\Webtrees\Http\RequestHandlers\MessagePage;
79use Fisharebest\Webtrees\Http\RequestHandlers\MessageSelect;
80use Fisharebest\Webtrees\Http\RequestHandlers\ModuleAction;
81use Fisharebest\Webtrees\Http\RequestHandlers\NotePage;
82use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestAction;
83use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestPage;
84use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetAction;
85use Fisharebest\Webtrees\Http\RequestHandlers\PasswordResetPage;
86use Fisharebest\Webtrees\Http\RequestHandlers\PasteFact;
87use Fisharebest\Webtrees\Http\RequestHandlers\PendingChanges;
88use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptChange;
89use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
90use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptTree;
91use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogAction;
92use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogData;
93use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDelete;
94use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogDownload;
95use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogPage;
96use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectChange;
97use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
98use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectTree;
99use Fisharebest\Webtrees\Http\RequestHandlers\PhpInformation;
100use Fisharebest\Webtrees\Http\RequestHandlers\Ping;
101use Fisharebest\Webtrees\Http\RequestHandlers\PrivacyPolicy;
102use Fisharebest\Webtrees\Http\RequestHandlers\RedirectFamilyPhp;
103use Fisharebest\Webtrees\Http\RequestHandlers\RedirectGedRecordPhp;
104use Fisharebest\Webtrees\Http\RequestHandlers\RedirectIndividualPhp;
105use Fisharebest\Webtrees\Http\RequestHandlers\RedirectMediaViewerPhp;
106use Fisharebest\Webtrees\Http\RequestHandlers\RedirectNotePhp;
107use Fisharebest\Webtrees\Http\RequestHandlers\RedirectRepoPhp;
108use Fisharebest\Webtrees\Http\RequestHandlers\RedirectSourcePhp;
109use Fisharebest\Webtrees\Http\RequestHandlers\RegisterAction;
110use Fisharebest\Webtrees\Http\RequestHandlers\RegisterPage;
111use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenAction;
112use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenPage;
113use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaAction;
114use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
115use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesAction;
116use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
117use Fisharebest\Webtrees\Http\RequestHandlers\ReorderSpousesAction;
118use Fisharebest\Webtrees\Http\RequestHandlers\ReorderSpousesPage;
119use Fisharebest\Webtrees\Http\RequestHandlers\ReportGenerate;
120use Fisharebest\Webtrees\Http\RequestHandlers\ReportListAction;
121use Fisharebest\Webtrees\Http\RequestHandlers\ReportListPage;
122use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupAction;
123use Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupPage;
124use Fisharebest\Webtrees\Http\RequestHandlers\RepositoryPage;
125use Fisharebest\Webtrees\Http\RequestHandlers\RobotsTxt;
126use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
127use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedPage;
128use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction;
129use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralPage;
130use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticAction;
131use Fisharebest\Webtrees\Http\RequestHandlers\SearchPhoneticPage;
132use Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
133use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplaceAction;
134use Fisharebest\Webtrees\Http\RequestHandlers\SearchReplacePage;
135use Fisharebest\Webtrees\Http\RequestHandlers\Select2Family;
136use Fisharebest\Webtrees\Http\RequestHandlers\Select2Individual;
137use Fisharebest\Webtrees\Http\RequestHandlers\Select2MediaObject;
138use Fisharebest\Webtrees\Http\RequestHandlers\Select2Note;
139use Fisharebest\Webtrees\Http\RequestHandlers\Select2Repository;
140use Fisharebest\Webtrees\Http\RequestHandlers\Select2Source;
141use Fisharebest\Webtrees\Http\RequestHandlers\Select2Submitter;
142use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree;
143use Fisharebest\Webtrees\Http\RequestHandlers\SelectLanguage;
144use Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
145use Fisharebest\Webtrees\Http\RequestHandlers\SelectTheme;
146use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsAction;
147use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
148use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
149use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
150use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
151use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesAction;
152use Fisharebest\Webtrees\Http\RequestHandlers\EmailPreferencesPage;
153use Fisharebest\Webtrees\Http\RequestHandlers\SourcePage;
154use Fisharebest\Webtrees\Http\RequestHandlers\VerifyEmail;
155
156/**
157 * Routing table for web requests
158 */
159class WebRoutes
160{
161    public function load(Map $router): void
162    {
163        // Admin routes.
164        $router->attach('', '/admin', static function (Map $router) {
165            $router->extras([
166                'middleware' => [AuthAdministrator::class],
167            ]);
168
169            $router->get(ControlPanel::class, '', ControlPanel::class);
170            $router->get(BroadcastPage::class, '/broadcast', BroadcastPage::class);
171            $router->post(BroadcastAction::class, '/broadcast', BroadcastAction::class);
172            $router->get(CleanDataFolder::class, '/clean', CleanDataFolder::class);
173            $router->post(DeletePath::class, '/delete-path', DeletePath::class);
174            $router->get(EmailPreferencesPage::class, '/email', EmailPreferencesPage::class);
175            $router->post(EmailPreferencesAction::class, '/email', EmailPreferencesAction::class);
176            $router->get(PhpInformation::class, '/information', PhpInformation::class);
177            $router->get(SiteLogsPage::class, '/logs', SiteLogsPage::class);
178            $router->post(SiteLogsAction::class, '/logs', SiteLogsAction::class);
179            $router->get(SiteLogsData::class, '/logs-data', SiteLogsData::class);
180            $router->post(SiteLogsDelete::class, '/logs-delete', SiteLogsDelete::class);
181            $router->get(SiteLogsDownload::class, '/logs-download', SiteLogsDownload::class);
182            $router->post(Masquerade::class, '/masquerade/{user_id}', Masquerade::class);
183            $router->get(CreateTreePage::class, '/trees/create', CreateTreePage::class);
184            $router->post(CreateTreeAction::class, '/trees/create', CreateTreeAction::class);
185            $router->post(SelectDefaultTree::class, '/trees/default/{tree}', SelectDefaultTree::class);
186            $router->post(DeleteTreeAction::class, '/trees/delete/{tree}', DeleteTreeAction::class);
187            $router->get('admin-fix-level-0-media', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0Media');
188            $router->post('admin-fix-level-0-media-action', '/fix-level-0-media', 'Admin\FixLevel0MediaController::fixLevel0MediaAction');
189            $router->get('admin-fix-level-0-media-data', '/fix-level-0-media-data', 'Admin\FixLevel0MediaController::fixLevel0MediaData');
190            $router->get('admin-webtrees1-thumbs', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1Thumbnails');
191            $router->post('admin-webtrees1-thumbs-action', '/webtrees1-thumbs', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsAction');
192            $router->get('admin-webtrees1-thumbs-data', '/webtrees1-thumbs-data', 'Admin\ImportThumbnailsController::webtrees1ThumbnailsData');
193            $router->get('modules', '/modules', 'Admin\ModuleController::list');
194            $router->post('modules-update', '/modules', 'Admin\ModuleController::update');
195            $router->get('analytics', '/analytics', 'Admin\ModuleController::listAnalytics');
196            $router->post('analytics-update', '/analytics', 'Admin\ModuleController::updateAnalytics');
197            $router->get('blocks', '/blocks', 'Admin\ModuleController::listBlocks');
198            $router->post('blocks-update', '/blocks', 'Admin\ModuleController::updateBlocks');
199            $router->get('charts', '/charts', 'Admin\ModuleController::listCharts');
200            $router->post('charts-update', '/charts', 'Admin\ModuleController::updateCharts');
201            $router->get('lists', '/lists', 'Admin\ModuleController::listLists');
202            $router->post('lists-update', '/lists', 'Admin\ModuleController::updateLists');
203            $router->get('footers', '/footers', 'Admin\ModuleController::listFooters');
204            $router->post('footers-update', '/footers', 'Admin\ModuleController::updateFooters');
205            $router->get('history', '/history', 'Admin\ModuleController::listHistory');
206            $router->post('history-update', '/history', 'Admin\ModuleController::updateHistory');
207            $router->get('menus', '/menus', 'Admin\ModuleController::listMenus');
208            $router->post('menus-update', '/menus', 'Admin\ModuleController::updateMenus');
209            $router->get('languages', '/languages', 'Admin\ModuleController::listLanguages');
210            $router->post('languages-update', '/languages', 'Admin\ModuleController::updateLanguages');
211            $router->get('reports', '/reports', 'Admin\ModuleController::listReports');
212            $router->post('reports-update', '/reports', 'Admin\ModuleController::updateReports');
213            $router->get('sidebars', '/sidebars', 'Admin\ModuleController::listSidebars');
214            $router->post('sidebars-update', '/sidebars', 'Admin\ModuleController::updateSidebars');
215            $router->get('themes', '/themes', 'Admin\ModuleController::listThemes');
216            $router->post('themes-update', '/themes', 'Admin\ModuleController::updateThemes');
217            $router->get('tabs', '/tabs', 'Admin\ModuleController::listTabs');
218            $router->post('tabs-update', '/tabs', 'Admin\ModuleController::updateTabs');
219            $router->post('delete-module-settings', '/delete-module-settings', 'Admin\ModuleController::deleteModuleSettings');
220            $router->get('map-data', '/map-data', 'Admin\LocationController::mapData');
221            $router->get('map-data-edit', '/map-data-edit', 'Admin\LocationController::mapDataEdit');
222            $router->post('map-data-update', '/map-data-edit', 'Admin\LocationController::mapDataSave');
223            $router->post('map-data-delete', '/map-data-delete', 'Admin\LocationController::mapDataDelete');
224            $router->get('locations-export', '/locations-export', 'Admin\LocationController::exportLocations');
225            $router->get('locations-import', '/locations-import', 'Admin\LocationController::importLocations');
226            $router->post('locations-import-action', '/locations-import', 'Admin\LocationController::importLocationsAction');
227            $router->post('locations-import-from-tree', '/locations-import-from-tree', 'Admin\LocationController::importLocationsFromTree');
228            $router->get('map-provider', '/map-provider', 'Admin\MapProviderController::mapProviderEdit');
229            $router->post('map-provider-action', '/map-provider', 'Admin\MapProviderController::mapProviderSave');
230            $router->get('admin-media', '/admin-media', 'Admin\MediaController::index');
231            $router->get('admin-media-data', '/admin-media-data', 'Admin\MediaController::data');
232            $router->post('admin-media-delete', '/admin-media-delete', 'Admin\MediaController::delete');
233            $router->get('admin-media-upload', '/admin-media-upload', 'Admin\MediaController::upload');
234            $router->post('admin-media-upload-action', '/admin-media-upload', 'Admin\MediaController::uploadAction');
235            $router->get('upgrade', '/upgrade', 'Admin\UpgradeController::wizard');
236            $router->post('upgrade-action', '/upgrade', 'Admin\UpgradeController::step');
237            $router->get('admin-users', '/admin-users', 'Admin\UsersController::index');
238            $router->get('admin-users-data', '/admin-users-data', 'Admin\UsersController::data');
239            $router->get('admin-users-create', '/admin-users-create', 'Admin\UsersController::create');
240            $router->post('admin-users-create-action', '/admin-users-create', 'Admin\UsersController::save');
241            $router->get('admin-users-edit', '/admin-users-edit', 'Admin\UsersController::edit');
242            $router->post('admin-users-update', '/admin-users-edit', 'Admin\UsersController::update');
243            $router->get('admin-users-cleanup', '/admin-users-cleanup', 'Admin\UsersController::cleanup');
244            $router->post('admin-users-cleanup-action', '/admin-users-cleanup', 'Admin\UsersController::cleanupAction');
245            $router->get('admin-site-preferences', '/admin-site-preferences', 'AdminSiteController::preferencesForm');
246            $router->post('admin-site-preferences-update', '/admin-site-preferences', 'AdminSiteController::preferencesSave');
247            $router->get('admin-site-registration', '/admin-site-registration', 'AdminSiteController::registrationForm');
248            $router->post('admin-site-registration-update', '/admin-site-registration', 'AdminSiteController::registrationSave');
249            $router->get('tree-page-default-edit', '/trees/default-blocks', 'HomePageController::treePageDefaultEdit');
250            $router->post('tree-page-default-update', '/trees/default-blocks', 'HomePageController::treePageDefaultUpdate');
251            $router->get('admin-trees-merge', '/trees/merge', 'AdminTreesController::merge');
252            $router->post('admin-trees-merge-action', '/trees/merge', 'AdminTreesController::mergeAction');
253            $router->post('admin-trees-sync', '/trees/sync', 'AdminTreesController::synchronize');
254            $router->get('unused-media-thumbnail', '/unused-media-thumbnail', 'MediaFileController::unusedMediaThumbnail');
255            $router->post('delete-user', '/users/delete/{user_id}', DeleteUser::class);
256            $router->get('user-page-default-edit', '/user-page-default-edit', 'HomePageController::userPageDefaultEdit');
257            $router->post('user-page-default-update', '/user-page-default-update', 'HomePageController::userPageDefaultUpdate');
258        });
259
260        // Manager routes (without a tree).
261        $router->attach('', '/admin', static function (Map $router) {
262            $router->extras([
263                'middleware' => [AuthManager::class],
264            ]);
265
266            $router->get('manage-trees', '/trees/manage{/tree}', 'AdminTreesController::index');
267        });
268
269        // Manager routes.
270        $router->attach('', '/tree/{tree}', static function (Map $router) {
271            $router->extras([
272                'middleware' => [AuthManager::class],
273            ]);
274
275            $router->get(PendingChangesLogPage::class, '/changes-log', PendingChangesLogPage::class);
276            $router->post(PendingChangesLogAction::class, '/changes-log', PendingChangesLogAction::class);
277            $router->get(PendingChangesLogData::class, '/changes-data', PendingChangesLogData::class);
278            $router->post(PendingChangesLogDelete::class, '/changes-delete', PendingChangesLogDelete::class);
279            $router->get(PendingChangesLogDownload::class, '/changes-download', PendingChangesLogDownload::class);
280            $router->get('admin-trees-check', '/check', 'AdminTreesController::check');
281            $router->get('admin-trees-duplicates', '/duplicates', 'AdminTreesController::duplicates');
282            $router->get(ExportGedcomPage::class, '/export', ExportGedcomPage::class);
283            $router->post(ExportGedcomClient::class, '/export-client', ExportGedcomClient::class);
284            $router->post(ExportGedcomServer::class, '/export-server', ExportGedcomServer::class);
285            $router->get('admin-trees-import', '/import', 'AdminTreesController::importForm');
286            $router->post('admin-trees-import-action', '/import', 'AdminTreesController::importAction');
287            $router->get('admin-trees-places', '/places', 'AdminTreesController::places');
288            $router->post('admin-trees-places-action', '/places', 'AdminTreesController::placesAction');
289            $router->get('admin-trees-preferences', '/preferences', 'AdminTreesController::preferences');
290            $router->post('admin-trees-preferences-update', '/preferences', 'AdminTreesController::preferencesUpdate');
291            $router->get('admin-trees-renumber', '/renumber', 'AdminTreesController::renumber');
292            $router->post('admin-trees-renumber-action', '/renumber', 'AdminTreesController::renumberAction');
293            $router->get('admin-trees-unconnected', '/aunconnected', 'AdminTreesController::unconnected');
294            $router->get('tree-page-edit', '/tree-page-edit', 'HomePageController::treePageEdit');
295            $router->post('import', '/load', 'GedcomFileController::import');
296            $router->post('tree-page-update', '/tree-page-update', 'HomePageController::treePageUpdate');
297            $router->get('merge-records', '/merge-records', 'AdminController::mergeRecords');
298            $router->post('merge-records-update', '/merge-records', 'AdminController::mergeRecordsAction');
299            $router->get('tree-page-block-edit', '/tree-page-block-edit', 'HomePageController::treePageBlockEdit');
300            $router->post('tree-page-block-update', '/tree-page-block-edit', 'HomePageController::treePageBlockUpdate');
301            $router->get('tree-preferences', '/preferences', 'AdminController::treePreferencesEdit');
302            $router->post('tree-preferences-update', '/preferences', 'AdminController::treePreferencesUpdate');
303            $router->get('tree-privacy', '/privacy', 'AdminController::treePrivacyEdit');
304            $router->post('tree-privacy-update', '/privacy', 'AdminController::treePrivacyUpdate');
305        });
306
307        // Moderator routes.
308        $router->attach('', '/tree/{tree}', static function (Map $router) {
309            $router->extras([
310                'middleware' => [AuthModerator::class],
311            ]);
312            $router->post(PendingChangesAcceptTree::class, '/accept', PendingChangesAcceptTree::class);
313            $router->post(PendingChangesAcceptRecord::class, '/accept/{xref}', PendingChangesAcceptRecord::class);
314            $router->post(PendingChangesAcceptChange::class, '/accept/{xref}/{change}', PendingChangesAcceptChange::class);
315            $router->get(PendingChanges::class, '/pending', PendingChanges::class);
316            $router->post(PendingChangesRejectTree::class, '/reject', PendingChangesRejectTree::class);
317            $router->post(PendingChangesRejectRecord::class, '/reject/{xref}', PendingChangesRejectRecord::class);
318            $router->post(PendingChangesRejectChange::class, '/reject/{xref}/{change}', PendingChangesRejectChange::class);
319        });
320
321        // Editor routes.
322        $router->attach('', '/tree/{tree}', static function (Map $router) {
323            $router->extras([
324                'middleware' => [AuthEditor::class],
325            ]);
326
327            $router->get('add-child-to-family', '/add-child-to-family', 'EditFamilyController::addChild');
328            $router->post('add-child-to-family-action', '/add-child-to-family', 'EditFamilyController::addChildAction');
329            $router->get(AddNewFact::class, '/add-fact/{xref}/{fact}', AddNewFact::class);
330            $router->post(SelectNewFact::class, '/add-fact/{xref}', SelectNewFact::class);
331            $router->get('add-media-file', '/add-media-file', 'EditMediaController::addMediaFile');
332            $router->post('add-media-file-update', '/add-media-file', 'EditMediaController::addMediaFileAction');
333            $router->get('add-name', '/add-name', 'EditIndividualController::addName');
334            $router->post('add-name-action', '/add-name-update/{xref}', 'EditIndividualController::addNameAction');
335            $router->get('add-spouse-to-family', '/add-spouse-to-family', 'EditFamilyController::addSpouse');
336            $router->post('add-spouse-to-family-action', '/add-spouse-to-family', 'EditFamilyController::addSpouseAction');
337            $router->get('change-family-members', '/change-family-members', 'EditFamilyController::changeFamilyMembers');
338            $router->post('change-family-members-action', '/change-family-members', 'EditFamilyController::changeFamilyMembersAction');
339            $router->get(CreateMediaObjectModal::class, '/create-media-object', CreateMediaObjectModal::class);
340            $router->post(CreateMediaObjectAction::class, '/create-media-object', CreateMediaObjectAction::class);
341            $router->post('create-media-from-file', '/create-media-from-file', 'EditMediaController::createMediaObjectFromFileAction');
342            $router->post(CopyFact::class, '/copy/{xref}/{fact_id}', CopyFact::class);
343            $router->get(CreateNoteModal::class, '/create-note-object', CreateNoteModal::class);
344            $router->post(CreateNoteAction::class, '/create-note-object', CreateNoteAction::class);
345            $router->get(CreateRepositoryModal::class, '/create-repository', CreateRepositoryModal::class);
346            $router->post(CreateRepositoryAction::class, '/create-repository', CreateRepositoryAction::class);
347            $router->get(CreateSourceModal::class, '/create-source', CreateSourceModal::class);
348            $router->post(CreateSourceAction::class, '/create-source', CreateSourceAction::class);
349            $router->get(CreateSubmitterModal::class, '/create-submitter', CreateSubmitterModal::class);
350            $router->post(CreateSubmitterAction::class, '/create-submitter', CreateSubmitterAction::class);
351            $router->post(DeleteRecord::class, '/delete/{xref}', DeleteRecord::class);
352            $router->post(DeleteFact::class, '/delete/{xref}/{fact_id}', DeleteFact::class);
353            $router->get(EditFact::class, '/edit-fact', EditFact::class);
354            $router->get('edit-media-file', '/edit-media-file', 'EditMediaController::editMediaFile');
355            $router->post('edit-media-file-update', '/edit-media-file', 'EditMediaController::editMediaFileAction');
356            $router->get('edit-note-object', '/edit-note-object', 'EditNoteController::editNoteObject');
357            $router->post('edit-note-object-action', '/edit-note-object', 'EditNoteController::updateNoteObject');
358            $router->get(EditRawFactPage::class, '/edit-raw/{xref}/{fact_id}', EditRawFactPage::class);
359            $router->post(EditRawFactAction::class, '/edit-raw/{xref}/{fact_id}', EditRawFactAction::class);
360            $router->get(EditRawRecordPage::class, '/edit-raw/{xref}', EditRawRecordPage::class);
361            $router->post(EditRawRecordAction::class, '/edit-raw/{xref}', EditRawRecordAction::class);
362            $router->get('link-media-to-individual', '/link-media-to-individual', 'EditMediaController::linkMediaToIndividual');
363            $router->get('link-media-to-family', '/link-media-to-family', 'EditMediaController::linkMediaToFamily');
364            $router->get('link-media-to-source', '/link-media-to-source', 'EditMediaController::linkMediaToSource');
365            $router->post('link-media-to-record', '/link-media-to-record', 'EditMediaController::linkMediaToRecordAction');
366            $router->post(PasteFact::class, '/paste-fact/{xref}', PasteFact::class);
367            $router->get(ReorderChildrenPage::class, '/reorder-children/{xref}', ReorderChildrenPage::class);
368            $router->post(ReorderChildrenAction::class, '/reorder-children/{xref}', ReorderChildrenAction::class);
369            $router->get(ReorderMediaPage::class, '/reorder-media/{xref}', ReorderMediaPage::class);
370            $router->post(ReorderMediaAction::class, '/reorder-media/{xref}', ReorderMediaAction::class);
371            $router->get(ReorderNamesPage::class, '/reorder-names/{xref}', ReorderNamesPage::class);
372            $router->post(ReorderNamesAction::class, '/reorder-names/{xref}', ReorderNamesAction::class);
373            $router->get(ReorderSpousesPage::class, '/reorder-spouses/{xref}', ReorderSpousesPage::class);
374            $router->post(ReorderSpousesAction::class, '/reorder-spouses/{xref}', ReorderSpousesAction::class);
375            $router->get(SearchReplacePage::class, '/search-replace', SearchReplacePage::class);
376            $router->post(SearchReplaceAction::class, '/search-replace', SearchReplaceAction::class);
377            $router->get('add-child-to-individual', '/add-child-to-individual', 'EditIndividualController::addChild');
378            $router->post('add-child-to-individual-action', '/add-child-to-individual', 'EditIndividualController::addChildAction');
379            $router->get('add-parent-to-individual', '/add-parent-to-individual', 'EditIndividualController::addParent');
380            $router->post('add-parent-to-individual-action', '/add-parent-to-individual', 'EditIndividualController::addParentAction');
381            $router->get('add-spouse-to-individual', '/add-spouse-to-individual', 'EditIndividualController::addSpouse');
382            $router->post('add-spouse-to-individual-action', '/add-spouse-to-individual', 'EditIndividualController::addSpouseAction');
383            $router->get('add-unlinked-individual', '/add-unlinked-individual', 'EditIndividualController::addUnlinked');
384            $router->post('add-unlinked-individual-action', '/add-unlinked-individual', 'EditIndividualController::addUnlinkedAction');
385            $router->get('link-child-to-family', '/link-child-to-family', 'EditIndividualController::linkChildToFamily');
386            $router->post('link-child-to-family-action', '/link-child-to-family', 'EditIndividualController::linkChildToFamilyAction');
387            $router->get('link-spouse-to-individual', '/link-spouse-to-individual', 'EditIndividualController::linkSpouseToIndividual');
388            $router->post('link-spouse-to-individual-action', '/link-spouse-to-individual', 'EditIndividualController::linkSpouseToIndividualAction');
389            $router->get('edit-name', '/edit-name/{xref}/{fact_id}', 'EditIndividualController::editName');
390            $router->post('edit-name-action', '/edit-name-update/{xref}/{fact_id}', 'EditIndividualController::editNameAction');
391            $router->post('update-fact', '/update-fact/{xref}{/fact_id}', 'EditGedcomRecordController::updateFact');
392        });
393
394        // Member routes.
395        $router->attach('', '/tree/{tree}', static function (Map $router) {
396            $router->extras([
397                'middleware' => [AuthMember::class],
398            ]);
399
400            $router->get('user-page', '/my-page', 'HomePageController::userPage');
401            $router->get('user-page-block', '/my-page-block', 'HomePageController::userPageBlock');
402            $router->get('user-page-edit', '/my-page-edit', 'HomePageController::userPageEdit');
403            $router->post('user-page-update', '/my-page-edit', 'HomePageController::userPageUpdate');
404            $router->get('user-page-block-edit', '/my-page-block-edit', 'HomePageController::userPageBlockEdit');
405            $router->post('user-page-block-update', '/my-page-block-edit', 'HomePageController::userPageBlockUpdate');
406        });
407
408        // User routes.
409        $router->attach('', '', static function (Map $router) {
410            $router->extras([
411                'middleware' => [AuthLoggedIn::class],
412            ]);
413
414            $router->get(AccountEdit::class, '/my-account{/tree}', AccountEdit::class);
415            $router->post(AccountUpdate::class, '/my-account{/tree}', AccountUpdate::class);
416            $router->post(AccountDelete::class, '/my-account-delete', AccountDelete::class);
417        });
418
419        // Visitor routes.
420        $router->attach('', '', static function (Map $router) {
421            $router->extras([
422                'middleware' => [AuthVisitor::class],
423            ]);
424
425            $router->get(PasswordRequestPage::class, '/password-request', PasswordRequestPage::class);
426            $router->post(PasswordRequestAction::class, '/password-request', PasswordRequestAction::class);
427            $router->get(RegisterPage::class, '/register', RegisterPage::class);
428            $router->post(RegisterAction::class, '/register', RegisterAction::class);
429        });
430
431        // Public routes.
432        $router->attach('', '/tree/{tree}', static function (Map $router) {
433            $router->get('tree-page', '', 'HomePageController::treePage');
434            $router->get('autocomplete-folder', '/autocomplete-folder', 'AutocompleteController::folder');
435            $router->get('autocomplete-page', '/autocomplete-page', 'AutocompleteController::page');
436            $router->get('autocomplete-place', '/autocomplete-place', 'AutocompleteController::place');
437            $router->get('calendar', '/calendar/{view}', 'CalendarController::page');
438            $router->get('calendar-events', '/calendar-events/{view}', 'CalendarController::calendar');
439            $router->get(ContactPage::class, '/contact', ContactPage::class);
440            $router->post(ContactAction::class, '/contact', ContactAction::class);
441            $router->get(FamilyPage::class, '/family/{xref}{/slug}', FamilyPage::class);
442            $router->get(IndividualPage::class, '/individual/{xref}{/slug}', IndividualPage::class);
443            $router->get('media-thumbnail', '/media-thumbnail', 'MediaFileController::mediaThumbnail');
444            $router->get('media-download', '/media-download', 'MediaFileController::mediaDownload');
445            $router->get(MediaPage::class, '/media/{xref}{/slug}', MediaPage::class);
446            $router->post(MessageSelect::class, '/message-select', MessageSelect::class);
447            $router->get(MessagePage::class, '/message-compose', MessagePage::class);
448            $router->post(MessageAction::class, '/message-send', MessageAction::class);
449            $router->get(NotePage::class, '/note/{xref}{/slug}', NotePage::class);
450            $router->get(GedcomRecordPage::class, '/record/{xref}{/slug}', GedcomRecordPage::class);
451            $router->get(RepositoryPage::class, '/repository/{xref}{/slug}', RepositoryPage::class);
452            $router->get(ReportListPage::class, '/report', ReportListPage::class);
453            $router->post(ReportListAction::class, '/report', ReportListAction::class);
454            $router->get(ReportSetupPage::class, '/report/{report}', ReportSetupPage::class);
455            $router->post(ReportSetupAction::class, '/report/{report}', ReportSetupAction::class);
456            $router->get(ReportGenerate::class, '/report-run/{report}', ReportGenerate::class);
457            $router->get(SearchAdvancedPage::class, '/search-advanced', SearchAdvancedPage::class);
458            $router->post(SearchAdvancedAction::class, '/search-advanced', SearchAdvancedAction::class);
459            $router->get(SearchGeneralPage::class, '/search-general', SearchGeneralPage::class);
460            $router->post(SearchGeneralAction::class, '/search-general', SearchGeneralAction::class);
461            $router->get(SearchPhoneticPage::class, '/search-phonetic', SearchPhoneticPage::class);
462            $router->post(SearchPhoneticAction::class, '/search-phonetic', SearchPhoneticAction::class);
463            $router->post(SearchQuickAction::class, '/search-quick', SearchQuickAction::class);
464            $router->post(Select2Family::class, '/select2-family', Select2Family::class);
465            $router->post(Select2Individual::class, '/select2-individual', Select2Individual::class);
466            $router->post(Select2MediaObject::class, '/select2-media', Select2MediaObject::class);
467            $router->post(Select2Note::class, '/select2-note', Select2Note::class);
468            $router->post(Select2Source::class, '/select2-source', Select2Source::class);
469            $router->post(Select2Submitter::class, '/select2-submitter', Select2Submitter::class);
470            $router->post(Select2Repository::class, '/select2-repository', Select2Repository::class);
471            $router->get(SourcePage::class, '/source/{xref}{/slug}', SourcePage::class);
472            $router->get('tree-page-block', '/tree-page-block', 'HomePageController::treePageBlock');
473            $router->get('example', '/…');
474        });
475
476        $router->get('module', '/module/{module}/{action}{/tree}', ModuleAction::class)
477            ->allows(RequestMethodInterface::METHOD_POST);
478
479        $router->get(HelpText::class, '/help/{topic}', HelpText::class);
480        $router->post(SelectLanguage::class, '/language/{language}', SelectLanguage::class);
481        $router->get(LoginPage::class, '/login{/tree}', LoginPage::class);
482        $router->post(LoginAction::class, '/login{/tree}', LoginAction::class);
483        $router->post(Logout::class, '/logout', Logout::class);
484        $router->get(PasswordResetPage::class, '/password-reset', PasswordResetPage::class);
485        $router->post(PasswordResetAction::class, '/password-reset', PasswordResetAction::class);
486        $router->get(Ping::class, '/ping', Ping::class);
487        $router->get(RobotsTxt::class, '/robots.txt', RobotsTxt::class);
488        $router->post(SelectTheme::class, '/theme/{theme}', SelectTheme::class);
489        $router->get(VerifyEmail::class, '/verify', VerifyEmail::class);
490        $router->get(PrivacyPolicy::class, '/privacy-policy', PrivacyPolicy::class);
491        $router->get(HomePage::class, '/', HomePage::class);
492
493        // Legacy URLs from older software.
494        $router->get(RedirectFamilyPhp::class, '/family.php', RedirectFamilyPhp::class);
495        $router->get(RedirectGedRecordPhp::class, '/gedrecord.php', RedirectGedRecordPhp::class);
496        $router->get(RedirectIndividualPhp::class, '/individual.php', RedirectIndividualPhp::class);
497        $router->get(RedirectMediaViewerPhp::class, '/mediaviewer.php', RedirectMediaViewerPhp::class);
498        $router->get(RedirectNotePhp::class, '/note.php', RedirectNotePhp::class);
499        $router->get(RedirectRepoPhp::class, '/repository.php', RedirectRepoPhp::class);
500        $router->get(RedirectSourcePhp::class, '/source.php', RedirectSourcePhp::class);
501    }
502}
503