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