155134edcSGreg Roach<?php 255134edcSGreg Roach 355134edcSGreg Roach/** 455134edcSGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 655134edcSGreg Roach * This program is free software: you can redistribute it and/or modify 755134edcSGreg Roach * it under the terms of the GNU General Public License as published by 855134edcSGreg Roach * the Free Software Foundation, either version 3 of the License, or 955134edcSGreg Roach * (at your option) any later version. 1055134edcSGreg Roach * This program is distributed in the hope that it will be useful, 1155134edcSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1255134edcSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1355134edcSGreg Roach * GNU General Public License for more details. 1455134edcSGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 1655134edcSGreg Roach */ 1755134edcSGreg Roach 1855134edcSGreg Roachdeclare(strict_types=1); 1955134edcSGreg Roach 2055134edcSGreg Roachnamespace Fisharebest\Webtrees\Module; 2155134edcSGreg Roach 2255134edcSGreg Roachuse Aura\Router\RouterContainer; 2355134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectAncestryPhp; 2455134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectBranchesPhp; 2555134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectCalendarPhp; 2655134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectCompactPhp; 2755134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectDescendencyPhp; 2855134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectFamilyBookPhp; 2955134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectFamilyPhp; 3055134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectFamListPhp; 3155134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectFanChartPhp; 3255134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectGedRecordPhp; 3355134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectHourGlassPhp; 3455134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectIndiListPhp; 3555134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectIndividualPhp; 3655134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectLifeSpanPhp; 3755134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectMediaListPhp; 3855134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectMediaViewerPhp; 3955134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectModulePhp; 4072c53c93SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectNoteListPhp; 4155134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectNotePhp; 4255134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectPedigreePhp; 4355134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectPlaceListPhp; 4455134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectRelationshipPhp; 4555134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectRepoListPhp; 4655134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectReportEnginePhp; 4755134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectRepositoryPhp; 4855134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectSourceListPhp; 4955134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectSourcePhp; 5055134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectStatisticsPhp; 5155134edcSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\RedirectTimeLinePhp; 5255134edcSGreg Roachuse Fisharebest\Webtrees\I18N; 53*d35568b4SGreg Roachuse Fisharebest\Webtrees\Registry; 5455134edcSGreg Roach 5555134edcSGreg Roach/** 5655134edcSGreg Roach * Class RedirectLegacyUrlsModule - rewrite URLs from phpGedView and webtrees 1.x 5755134edcSGreg Roach */ 5855134edcSGreg Roachclass RedirectLegacyUrlsModule extends AbstractModule 5955134edcSGreg Roach{ 6055134edcSGreg Roach /** 6155134edcSGreg Roach * Initialization. 6255134edcSGreg Roach * 6355134edcSGreg Roach * @return void 6455134edcSGreg Roach */ 6555134edcSGreg Roach public function boot(): void 6655134edcSGreg Roach { 67*d35568b4SGreg Roach $router_container = Registry::container()->get(RouterContainer::class); 6855134edcSGreg Roach $router = $router_container->getMap(); 6955134edcSGreg Roach 7055134edcSGreg Roach // Legacy URLs from older software. 7155134edcSGreg Roach $router->get(RedirectAncestryPhp::class, '/ancestry.php', RedirectAncestryPhp::class); 7255134edcSGreg Roach $router->get(RedirectBranchesPhp::class, '/branches.php', RedirectBranchesPhp::class); 7355134edcSGreg Roach $router->get(RedirectCalendarPhp::class, '/calendar.php', RedirectCalendarPhp::class); 7455134edcSGreg Roach $router->get(RedirectCompactPhp::class, '/compact.php', RedirectCompactPhp::class); 7555134edcSGreg Roach $router->get(RedirectDescendencyPhp::class, '/compact.php', RedirectDescendencyPhp::class); 7655134edcSGreg Roach $router->get(RedirectFamilyPhp::class, '/family.php', RedirectFamilyPhp::class); 7755134edcSGreg Roach $router->get(RedirectFamListPhp::class, '/famlist.php', RedirectFamListPhp::class); 7855134edcSGreg Roach $router->get(RedirectFamilyBookPhp::class, '/familybook.php', RedirectFamilyBookPhp::class); 7955134edcSGreg Roach $router->get(RedirectFanChartPhp::class, '/fanchart.php', RedirectFanChartPhp::class); 8055134edcSGreg Roach $router->get(RedirectGedRecordPhp::class, '/gedrecord.php', RedirectGedRecordPhp::class); 8155134edcSGreg Roach $router->get(RedirectHourGlassPhp::class, '/hourglass.php', RedirectHourGlassPhp::class); 8255134edcSGreg Roach $router->get(RedirectIndiListPhp::class, '/indilist.php', RedirectIndiListPhp::class); 8355134edcSGreg Roach $router->get(RedirectIndividualPhp::class, '/individual.php', RedirectIndividualPhp::class); 8455134edcSGreg Roach $router->get(RedirectLifeSpanPhp::class, '/lifespan.php', RedirectLifeSpanPhp::class); 8555134edcSGreg Roach $router->get(RedirectMediaListPhp::class, '/medialist.php', RedirectMediaListPhp::class); 8655134edcSGreg Roach $router->get(RedirectMediaViewerPhp::class, '/mediaviewer.php', RedirectMediaViewerPhp::class); 8755134edcSGreg Roach $router->get(RedirectModulePhp::class, '/module.php', RedirectModulePhp::class); 8855134edcSGreg Roach $router->get(RedirectNotePhp::class, '/note.php', RedirectNotePhp::class); 8972c53c93SGreg Roach $router->get(RedirectNoteListPhp::class, '/notelist.php', RedirectNoteListPhp::class); 9055134edcSGreg Roach $router->get(RedirectPedigreePhp::class, '/pedigree.php', RedirectPedigreePhp::class); 9155134edcSGreg Roach $router->get(RedirectPlaceListPhp::class, '/placelist.php', RedirectPlaceListPhp::class); 9255134edcSGreg Roach $router->get(RedirectRelationshipPhp::class, '/relationship.php', RedirectRelationshipPhp::class); 9355134edcSGreg Roach $router->get(RedirectRepositoryPhp::class, '/repository.php', RedirectRepositoryPhp::class); 9455134edcSGreg Roach $router->get(RedirectRepoListPhp::class, '/repolist.php', RedirectRepoListPhp::class); 9555134edcSGreg Roach $router->get(RedirectReportEnginePhp::class, '/reportengine.php', RedirectReportEnginePhp::class); 9655134edcSGreg Roach $router->get(RedirectSourceListPhp::class, '/sourcelist.php', RedirectSourceListPhp::class); 9755134edcSGreg Roach $router->get(RedirectSourcePhp::class, '/source.php', RedirectSourcePhp::class); 9855134edcSGreg Roach $router->get(RedirectStatisticsPhp::class, '/statistics.php', RedirectStatisticsPhp::class); 9955134edcSGreg Roach $router->get(RedirectTimeLinePhp::class, '/timeline.php', RedirectTimeLinePhp::class); 10055134edcSGreg Roach } 10155134edcSGreg Roach 10255134edcSGreg Roach public function description(): string 10355134edcSGreg Roach { 10455134edcSGreg Roach /* I18N: Description of the “Legacy URLs” module */ 10555134edcSGreg Roach return I18N::translate('Redirect old URLs from webtrees version 1.'); 10655134edcSGreg Roach } 10755134edcSGreg Roach 10892a78a2fSGreg Roach /** 10992a78a2fSGreg Roach * How should this module be identified in the control panel, etc.? 11092a78a2fSGreg Roach * 11192a78a2fSGreg Roach * @return string 11292a78a2fSGreg Roach */ 11355134edcSGreg Roach public function title(): string 11455134edcSGreg Roach { 11555134edcSGreg Roach /* I18N: Name of a module - historic/obsolete URLs. */ 11655134edcSGreg Roach return I18N::translate('Legacy URLs'); 11755134edcSGreg Roach } 11855134edcSGreg Roach} 119