diff --git a/prefs_forms.php b/prefs_forms.php index 9e3a30789..a73e529d3 100644 --- a/prefs_forms.php +++ b/prefs_forms.php @@ -46,10 +46,10 @@ if (!$form_display->process(false)) { if ($form_display->hasErrors()) { // form has errors ?> -
+
displayErrors(); ?> -
+ display(true, true); } else { @@ -66,6 +66,7 @@ if (!$form_display->process(false)) { $form_display->display(true, true); } } +// todo: remove debug $GLOBALS['error_handler']->dispAllErrors(); /** diff --git a/prefs_manage.php b/prefs_manage.php index 4741855a5..5355b7f90 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -89,19 +89,57 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == } $_POST = array_merge($_POST, $config); $all_ok = $form_display->process(true, false); + $all_ok = $all_ok && !$form_display->hasErrors(); $_POST = $_POST_bak; + if (!$all_ok && isset($_POST['fix_errors'])) { + $form_display->fixErrors(); + $all_ok = true; + } if (!$all_ok) { - // todo: ask about saving that what can be saved + // mimic original form and post json in a hidden field + require_once './libraries/header.inc.php'; + require_once './libraries/user_preferences.inc.php'; + $msg = PMA_Message::warning(__('Configuration contains incorrect data for some fields.')); + $msg->display(); + echo '
'; $form_display->displayErrors(); - die('errors'); + echo '
'; + ?> +
+ + + + + + +

+ + +
+ checkTheme($config['ThemeDefault'])) { + $_SESSION['PMA_Theme_Manager']->setActiveTheme($config['ThemeDefault']); + $_SESSION['PMA_Theme_Manager']->setThemeCookie(); + $params['refresh_left_frame'] = true; + } + if (isset($config['fontsize'])) { + $params['set_fontsize'] = $config['fontsize']; + $params['refresh_left_frame'] = true; } // save settings $old_settings = PMA_load_userprefs(); $result = PMA_save_userprefs($cf->getConfigArray()); if ($result === true) { - PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php'); + PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params); exit; } else { $error = $result; @@ -110,9 +148,19 @@ if (isset($_POST['submit_export']) && filter_input(INPUT_POST, 'export_type') == } else if (isset($_POST['submit_clear'])) { $old_settings = PMA_load_userprefs(); $result = PMA_save_userprefs(array()); - ConfigFile::getInstance()->resetConfigData(); if ($result === true) { - PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php'); + $params = array(); + if ($_SESSION['PMA_Theme_Manager']->theme->getId() != 'original') { + $GLOBALS['PMA_Config']->removeCookie($_SESSION['PMA_Theme_Manager']->getThemeCookieName()); + unset($_SESSION['PMA_Theme_Manager']); + unset($_SESSION['PMA_Theme']); + $params['refresh_left_frame'] = true; + } + if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') { + $GLOBALS['PMA_Config']->removeCookie('pma_fontsize'); + $params['refresh_left_frame'] = true; + } + PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params); exit; } else { $error = $result;