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