Better error handling

This commit is contained in:
Crack
2010-06-21 01:05:45 +02:00
parent 9f44d864b6
commit b68ba42f9f

View File

@@ -67,7 +67,7 @@ foreach ($forms[$form_param] as $form_name => $form) {
$form_display->registerForm($form_name, $form); $form_display->registerForm($form_name, $form);
} }
if (filter_input(INPUT_GET, 'mode') == 'revert') { if (isset($_POST['revert'])) {
// revert erroneous fields to their default values // revert erroneous fields to their default values
$form_display->fixErrors(); $form_display->fixErrors();
// redirect // redirect
@@ -82,19 +82,14 @@ if (!$form_display->process(false)) {
} else { } else {
// check for form errors // check for form errors
if ($form_display->hasErrors()) { if ($form_display->hasErrors()) {
// form has errors, show warning // form has errors
$separator = PMA_get_arg_separator('html');
?> ?>
<div class="warning"> <fieldset>
<h4><?php echo __('Warning') ?></h4> <b><?php echo __('Submitted form contains errors') ?></b>
<?php echo __('Submitted form contains errors') ?><br /> <?php $form_display->displayErrors(); ?>
<a href="?form=<?php echo $form_param ?>&amp;mode=revert"><?php echo PMA_lang('RevertErroneousFields') ?></a> </fieldset>
</div>
<?php $form_display->displayErrors() ?>
<a class="btn" href="user_preferences.php"><?php echo PMA_lang('IgnoreErrors') ?></a>
&nbsp;
<a class="btn" href="?form=<?php echo $form_param ?>&amp;mode=edit"><?php echo PMA_lang('ShowForm') ?></a>
<?php <?php
$form_display->display(true, true);
} else { } else {
// save settings // save settings
$result = PMA_save_userprefs(); $result = PMA_save_userprefs();