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