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