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