} } else { $return_url = 'prefs_manage.php'; } // reload config $GLOBALS['PMA_Config']->loadUserPreferences(); PMA_userprefs_redirect($forms, $old_settings, $return_url, $params); exit; } else { $error = $result; } } } else { if (isset($_POST['submit_clear'])) { $old_settings = PMA_load_userprefs(); $result = PMA_save_userprefs(array()); if ($result === true) { $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['reload_left_frame'] = true; } if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') { $GLOBALS['PMA_Config']->removeCookie('pma_fontsize'); $params['reload_left_frame'] = true; } $GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection'); $GLOBALS['PMA_Config']->removeCookie('pma_lang'); PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params);
} $form_display->registerForm($form_name, $form, 1); } if (isset($_POST['revert'])) { // revert erroneous fields to their default values $form_display->fixErrors(); // redirect $url_params = array('form' => $form_param); PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php' . PMA_generate_common_url($url_params, '&')); exit; } $error = null; if ($form_display->process(false) && !$form_display->hasErrors()) { // save settings $old_settings = PMA_load_userprefs(); $result = PMA_save_userprefs(ConfigFile::getInstance()->getConfigArray()); if ($result === true) { // reload config $GLOBALS['PMA_Config']->loadUserPreferences(); $hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#'); PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array('form' => $form_param), $hash); exit; } else { $error = $result; } } // display forms $GLOBALS['js_include'][] = 'config.js'; require './libraries/header.inc.php'; require './libraries/user_preferences.inc.php'; if ($error) {
/** * Updates one user preferences option (loads and saves to database). * * No validation is done! * * @uses PMA_load_userprefs() * @uses PMA_save_userprefs() * @param string $cfg_name * @param mixed $value * @return void */ function PMA_persist_option($path, $value, $default_value) { $prefs = PMA_load_userprefs(); if ($value === $default_value) { if (isset($prefs['config_data'][$path])) { unset($prefs['config_data'][$path]); } else { return; } } else { $prefs['config_data'][$path] = $value; } PMA_save_userprefs($prefs['config_data']); }