summaryrefslogtreecommitdiff
path: root/app/Http/RequestHandlers
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http/RequestHandlers')
-rw-r--r--app/Http/RequestHandlers/RedirectFamilyPhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectGedRecordPhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectIndividualPhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectMediaViewerPhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectNotePhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectRepoPhp.php47
-rw-r--r--app/Http/RequestHandlers/RedirectSourcePhp.php47
7 files changed, 329 insertions, 0 deletions
diff --git a/app/Http/RequestHandlers/RedirectFamilyPhp.php b/app/Http/RequestHandlers/RedirectFamilyPhp.php
new file mode 100644
index 0000000000..7f007d885b
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectFamilyPhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectFamilyPhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['famid'] ?? '';
+ $route = route('family', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectGedRecordPhp.php b/app/Http/RequestHandlers/RedirectGedRecordPhp.php
new file mode 100644
index 0000000000..38773f839c
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectGedRecordPhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectGedRecordPhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['pid'] ?? '';
+ $route = route('record', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectIndividualPhp.php b/app/Http/RequestHandlers/RedirectIndividualPhp.php
new file mode 100644
index 0000000000..8fb1d9d7aa
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectIndividualPhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectIndividualPhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['pid'] ?? '';
+ $route = route('individual', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectMediaViewerPhp.php b/app/Http/RequestHandlers/RedirectMediaViewerPhp.php
new file mode 100644
index 0000000000..3b31afa1bb
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectMediaViewerPhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectMediaViewerPhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['mid'] ?? '';
+ $route = route('media', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectNotePhp.php b/app/Http/RequestHandlers/RedirectNotePhp.php
new file mode 100644
index 0000000000..af3e8aaa7a
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectNotePhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectNotePhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['nid'] ?? '';
+ $route = route('note', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectRepoPhp.php b/app/Http/RequestHandlers/RedirectRepoPhp.php
new file mode 100644
index 0000000000..6f6351ce5f
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectRepoPhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectRepoPhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['rid'] ?? '';
+ $route = route('repository', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}
diff --git a/app/Http/RequestHandlers/RedirectSourcePhp.php b/app/Http/RequestHandlers/RedirectSourcePhp.php
new file mode 100644
index 0000000000..1017bbfea6
--- /dev/null
+++ b/app/Http/RequestHandlers/RedirectSourcePhp.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2019 webtrees development team
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+declare(strict_types=1);
+
+namespace Fisharebest\Webtrees\Http\RequestHandlers;
+
+use Fig\Http\Message\StatusCodeInterface;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+use function redirect;
+use function route;
+
+/**
+ * Redirect URLs created by webtrees 1.x (and PhpGedView).
+ */
+class RedirectSourcePhp implements RequestHandlerInterface
+{
+ /**
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request): ResponseInterface
+ {
+ $ged = $request->getQueryParams()['ged'] ?? '';
+ $xref = $request->getQueryParams()['sid'] ?? '';
+ $route = route('source', ['tree' => $ged, 'xref' => $xref]);
+
+ return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY);
+ }
+}