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