xref: /webtrees/app/Http/RequestHandlers/SiteLogsAction.php (revision 57bfa969ae5adb60a68faad19182a580933467cd)
1*57bfa969SGreg Roach<?php
2*57bfa969SGreg Roach
3*57bfa969SGreg Roach/**
4*57bfa969SGreg Roach * webtrees: online genealogy
5*57bfa969SGreg Roach * Copyright (C) 2019 webtrees development team
6*57bfa969SGreg Roach * This program is free software: you can redistribute it and/or modify
7*57bfa969SGreg Roach * it under the terms of the GNU General Public License as published by
8*57bfa969SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*57bfa969SGreg Roach * (at your option) any later version.
10*57bfa969SGreg Roach * This program is distributed in the hope that it will be useful,
11*57bfa969SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*57bfa969SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*57bfa969SGreg Roach * GNU General Public License for more details.
14*57bfa969SGreg Roach * You should have received a copy of the GNU General Public License
15*57bfa969SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*57bfa969SGreg Roach */
17*57bfa969SGreg Roach
18*57bfa969SGreg Roachdeclare(strict_types=1);
19*57bfa969SGreg Roach
20*57bfa969SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
21*57bfa969SGreg Roach
22*57bfa969SGreg Roachuse Fisharebest\Webtrees\Services\PendingChangesService;
23*57bfa969SGreg Roachuse Fisharebest\Webtrees\Tree;
24*57bfa969SGreg Roachuse InvalidArgumentException;
25*57bfa969SGreg Roachuse Psr\Http\Message\ResponseInterface;
26*57bfa969SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
27*57bfa969SGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
28*57bfa969SGreg Roach
29*57bfa969SGreg Roachuse function assert;
30*57bfa969SGreg Roachuse function response;
31*57bfa969SGreg Roach
32*57bfa969SGreg Roach/**
33*57bfa969SGreg Roach * Show logs.
34*57bfa969SGreg Roach */
35*57bfa969SGreg Roachclass SiteLogsAction implements RequestHandlerInterface
36*57bfa969SGreg Roach{
37*57bfa969SGreg Roach    /**
38*57bfa969SGreg Roach     * @param ServerRequestInterface $request
39*57bfa969SGreg Roach     *
40*57bfa969SGreg Roach     * @return ResponseInterface
41*57bfa969SGreg Roach     */
42*57bfa969SGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
43*57bfa969SGreg Roach    {
44*57bfa969SGreg Roach        return redirect(route(SiteLogsPage::class, [
45*57bfa969SGreg Roach            'tree'     => $request->getParsedBody()['tree'],
46*57bfa969SGreg Roach            'from'     => $request->getParsedBody()['from'] ?? '',
47*57bfa969SGreg Roach            'to'       => $request->getParsedBody()['to'] ?? '',
48*57bfa969SGreg Roach            'type'     => $request->getParsedBody()['type'] ?? '',
49*57bfa969SGreg Roach            'text'     => $request->getParsedBody()['text'] ?? '',
50*57bfa969SGreg Roach            'ip'       => $request->getParsedBody()['ip'] ?? '',
51*57bfa969SGreg Roach            'username' => $request->getParsedBody()['username'] ?? '',
52*57bfa969SGreg Roach        ]));
53*57bfa969SGreg Roach    }
54*57bfa969SGreg Roach}
55