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