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