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