2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * User preferences page
8 use PhpMyAdmin\Config\ConfigFile
;
9 use PhpMyAdmin\Config\Forms\User\UserFormList
;
11 use PhpMyAdmin\Response
;
13 use PhpMyAdmin\UserPreferences
;
16 * Gets some core libraries and displays a top message if required
18 require_once 'libraries/common.inc.php';
20 $userPreferences = new UserPreferences();
22 $cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings
);
23 $userPreferences->pageInit($cf);
25 // handle form processing
27 $form_param = isset($_GET['form']) ?
$_GET['form'] : null;
28 $form_class = UserFormList
::get($form_param);
29 if (is_null($form_class)) {
30 Core
::fatalError(__('Incorrect form specified!'));
33 $form_display = new $form_class($cf, 1);
35 if (isset($_POST['revert'])) {
36 // revert erroneous fields to their default values
37 $form_display->fixErrors();
39 $url_params = array('form' => $form_param);
40 Core
::sendHeaderLocation(
42 . Url
::getCommonRaw($url_params)
48 if ($form_display->process(false) && !$form_display->hasErrors()) {
50 $result = $userPreferences->save($cf->getConfigArray());
51 if ($result === true) {
53 $GLOBALS['PMA_Config']->loadUserPreferences();
54 $tabHash = isset($_POST['tab_hash']) ?
$_POST['tab_hash'] : null;
55 $hash = ltrim($tabHash, '#');
56 $userPreferences->redirect(
58 array('form' => $form_param),
68 $response = Response
::getInstance();
69 $header = $response->getHeader();
70 $scripts = $header->getScripts();
71 $scripts->addFile('config.js');
73 require 'libraries/user_preferences.inc.php';
77 if ($form_display->hasErrors()) {
80 <div
class="error config-form">
82 <?php
echo __('Cannot save settings, submitted form contains errors!') ?
>
84 <?php
echo $form_display->displayErrors(); ?
>
88 echo $form_display->getDisplay(true, true, true, 'prefs_forms.php?form=' . $form_param, array(
89 'server' => $GLOBALS['server']
92 if ($response->isAjax()) {
93 $response->addJSON('_disableNaviSettings', true);
95 define('PMA_DISABLE_NAVI_SETTINGS', true);