$form_display->fixErrors(); // redirect $url_params = array('form' => $form_param); PMA_sendHeaderLocation('./prefs_forms.php' . URL::getCommonRaw($url_params)); exit; } $error = null; if ($form_display->process(false) && !$form_display->hasErrors()) { // save settings $result = PMA_saveUserprefs($cf->getConfigArray()); if ($result === true) { // reload config $GLOBALS['PMA_Config']->loadUserPreferences(); $tabHash = isset($_POST['tab_hash']) ? $_POST['tab_hash'] : null; $hash = ltrim($tabHash, '#'); PMA_userprefsRedirect('prefs_forms.php', array('form' => $form_param), $hash); exit; } else { $error = $result; } } // display forms $response = Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('config.js'); require 'libraries/user_preferences.inc.php'; if ($error) { $error->display(); } if ($form_display->hasErrors()) {
exit; } else { $error = $result; } } } else { if (isset($_POST['submit_clear'])) { $result = PMA_saveUserprefs(array()); if ($result === true) { $params = array(); if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') { $GLOBALS['PMA_Config']->removeCookie('pma_fontsize'); } $GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection'); $GLOBALS['PMA_Config']->removeCookie('pma_lang'); PMA_userprefsRedirect('prefs_manage.php', $params); exit; } else { $error = $result; } exit; } } } } $response = Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('config.js'); require 'libraries/user_preferences.inc.php'; if ($error) {
/** * Test for PMA_userprefsRedirect * * @return void */ public function testUserprefsRedirect() { if (!defined('PMA_TEST_HEADERS')) { $this->markTestSkipped('Cannot redefine constant/function - missing runkit extension'); } $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); $GLOBALS['cfg']['ServerDefault'] = 1; $GLOBALS['lang'] = ''; $redefine = null; if (!defined('PMA_IS_IIS')) { define('PMA_IS_IIS', false); } else { $redefine = PMA_IS_IIS; runkit_constant_redefine('PMA_IS_IIS', false); } PMA_userprefsRedirect('file.html', array('a' => 'b'), 'h ash'); $this->assertContains('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash', $GLOBALS['header'][0]); if ($redefine !== null) { runkit_constant_redefine('PMA_IS_IIS', $redefine); } else { runkit_constant_remove('PMA_IS_IIS'); } }