2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Formset processing library
6 * @package phpMyAdmin-setup
10 * Processes forms registered in $form_display, handles error correction
12 * @param FormDisplay $form_display
14 function process_formset(FormDisplay
$form_display) {
15 if (filter_input(INPUT_GET
, 'mode') == 'revert') {
16 // revert erroneous fields to their default values
17 $form_display->fixErrors();
19 header('HTTP/1.1 303 See Other');
20 header('Location: index.php');
23 if (!$form_display->process(false)) {
24 // handle form view and failed POST
25 $form_display->display(true, true);
27 // check for form errors
28 if ($form_display->hasErrors()) {
29 // form has errors, show warning
30 $separator = PMA_get_arg_separator('html');
31 $page = filter_input(INPUT_GET
, 'page');
32 $formset = filter_input(INPUT_GET
, 'formset');
33 $formset = $formset ?
"{$separator}formset=$formset" : '';
34 $id = filter_input(INPUT_GET
, 'id', FILTER_VALIDATE_INT
);
35 if ($id === null && $page == 'servers') {
36 // we've just added a new server, get it's id
37 $id = ConfigFile
::getInstance()->getServerCount();
39 $id = $id ?
"{$separator}id=$id" : '';
42 <h4
><?php
echo __('Warning') ?
></h4
>
43 <?php
echo __('Submitted form contains errors') ?
><br
/>
44 <a href
="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php
echo __('Try to revert erroneous fields to their default values') ?
></a
>
46 <?php
$form_display->displayErrors() ?
>
47 <a
class="btn" href
="index.php"><?php
echo __('Ignore errors') ?
></a
>
49 <a
class="btn" href
="?page=<?php echo $page . $formset . $id . $separator ?>mode=edit"><?php
echo __('Show form') ?
></a
>
53 header('HTTP/1.1 303 See Other');
54 header('Location: index.php');