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