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 $cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings
);
21 UserPreferences
::pageInit($cf);
23 // handle form processing
25 $form_param = isset($_GET['form']) ?
$_GET['form'] : null;
26 $form_class = UserFormList
::get($form_param);
27 if (is_null($form_class)) {
28 Core
::fatalError(__('Incorrect form specified!'));
31 $form_display = new $form_class($cf, 1);
33 if (isset($_POST['revert'])) {
34 // revert erroneous fields to their default values
35 $form_display->fixErrors();
37 $url_params = array('form' => $form_param);
38 Core
::sendHeaderLocation(
40 . Url
::getCommonRaw($url_params)
46 if ($form_display->process(false) && !$form_display->hasErrors()) {
48 $result = UserPreferences
::save($cf->getConfigArray());
49 if ($result === true) {
51 $GLOBALS['PMA_Config']->loadUserPreferences();
52 $tabHash = isset($_POST['tab_hash']) ?
$_POST['tab_hash'] : null;
53 $hash = ltrim($tabHash, '#');
54 UserPreferences
::redirect(
56 array('form' => $form_param),
66 $response = Response
::getInstance();
67 $header = $response->getHeader();
68 $scripts = $header->getScripts();
69 $scripts->addFile('config.js');
71 require 'libraries/user_preferences.inc.php';
75 if ($form_display->hasErrors()) {
78 <div
class="error config-form">
80 <?php
echo __('Cannot save settings, submitted form contains errors!') ?
>
82 <?php
echo $form_display->displayErrors(); ?
>
86 echo $form_display->getDisplay(true, true);
88 if ($response->isAjax()) {
89 $response->addJSON('_disableNaviSettings', true);
91 define('PMA_DISABLE_NAVI_SETTINGS', true);