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)
16 if (filter_input(INPUT_GET
, 'mode') == 'revert') {
17 // revert erroneous fields to their default values
18 $form_display->fixErrors();
20 header('HTTP/1.1 303 See Other');
21 header('Location: index.php');
24 if (!$form_display->process(false)) {
25 // handle form view and failed POST
26 $form_display->display(true, true);
28 // check for form errors
29 if ($form_display->hasErrors()) {
30 // form has errors, show warning
31 $separator = PMA_get_arg_separator('html');
32 $page = filter_input(INPUT_GET
, 'page');
33 $formset = filter_input(INPUT_GET
, 'formset');
34 $formset = $formset ?
"{$separator}formset=$formset" : '';
35 $id = filter_input(INPUT_GET
, 'id', FILTER_VALIDATE_INT
);
36 if ($id === null && $page == 'servers') {
37 // we've just added a new server, get it's id
38 $id = ConfigFile
::getInstance()->getServerCount();
40 $id = $id ?
"{$separator}id=$id" : '';
43 <h4
><?php
echo __('Warning') ?
></h4
>
44 <?php
echo __('Submitted form contains errors') ?
><br
/>
45 <a href
="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php
echo __('Try to revert erroneous fields to their default values') ?
></a
>
47 <?php
$form_display->displayErrors() ?
>
48 <a
class="btn" href
="index.php"><?php
echo __('Ignore errors') ?
></a
>
50 <a
class="btn" href
="?page=<?php echo $page . $formset . $id . $separator ?>mode=edit"><?php
echo __('Show form') ?
></a
>
54 header('HTTP/1.1 303 See Other');
55 header('Location: index.php');