1<?php 2 3declare(strict_types=1); 4 5namespace PhpMyAdmin\Controllers\Setup; 6 7use PhpMyAdmin\Config\Forms\BaseForm; 8use PhpMyAdmin\Config\Forms\Setup\SetupFormList; 9use PhpMyAdmin\Core; 10use PhpMyAdmin\Setup\FormProcessing; 11use function ob_get_clean; 12use function ob_start; 13use function is_string; 14 15class FormController extends AbstractController 16{ 17 /** 18 * @param array $params Request parameters 19 * 20 * @return string HTML 21 */ 22 public function index(array $params): string 23 { 24 $pages = $this->getPages(); 25 26 $formset = isset($params['formset']) && is_string($params['formset']) ? $params['formset'] : ''; 27 28 $formClass = SetupFormList::get($formset); 29 if ($formClass === null) { 30 Core::fatalError(__('Incorrect form specified!')); 31 } 32 33 ob_start(); 34 /** @var BaseForm $form */ 35 $form = new $formClass($this->config); 36 FormProcessing::process($form); 37 $page = ob_get_clean(); 38 39 return $this->template->render('setup/form/index', [ 40 'formset' => $formset, 41 'pages' => $pages, 42 'name' => $form::getName(), 43 'page' => $page, 44 ]); 45 } 46} 47