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