2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * User preferences page
8 use PhpMyAdmin\Config\ConfigFile
;
9 use PhpMyAdmin\Config\FormDisplay
;
11 use PhpMyAdmin\Response
;
15 * Gets some core libraries and displays a top message if required
17 require_once 'libraries/common.inc.php';
18 require_once 'libraries/user_preferences.lib.php';
19 require_once 'libraries/config/config_functions.lib.php';
20 require_once 'libraries/config/messages.inc.php';
21 require 'libraries/config/user_preferences.forms.php';
23 $cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings
);
24 PMA_userprefsPageInit($cf);
26 // handle form processing
28 $form_param = isset($_GET['form']) ?
$_GET['form'] : null;
29 if (! isset($forms[$form_param])) {
30 $forms_keys = array_keys($forms);
31 $form_param = array_shift($forms_keys);
34 $form_display = new FormDisplay($cf);
35 foreach ($forms[$form_param] as $form_name => $form) {
36 // skip Developer form if no setting is available
37 if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
40 $form_display->registerForm($form_name, $form, 1);
43 if (isset($_POST['revert'])) {
44 // revert erroneous fields to their default values
45 $form_display->fixErrors();
47 $url_params = array('form' => $form_param);
48 Core
::sendHeaderLocation(
50 . Url
::getCommonRaw($url_params)
56 if ($form_display->process(false) && !$form_display->hasErrors()) {
58 $result = PMA_saveUserprefs($cf->getConfigArray());
59 if ($result === true) {
61 $GLOBALS['PMA_Config']->loadUserPreferences();
62 $tabHash = isset($_POST['tab_hash']) ?
$_POST['tab_hash'] : null;
63 $hash = ltrim($tabHash, '#');
64 PMA_userprefsRedirect(
66 array('form' => $form_param),
76 $response = Response
::getInstance();
77 $header = $response->getHeader();
78 $scripts = $header->getScripts();
79 $scripts->addFile('config.js');
81 require 'libraries/user_preferences.inc.php';
85 if ($form_display->hasErrors()) {
88 <div
class="error config-form">
90 <?php
echo __('Cannot save settings, submitted form contains errors!') ?
>
92 <?php
echo $form_display->displayErrors(); ?
>
96 echo $form_display->getDisplay(true, true);
98 if ($response->isAjax()) {
99 $response->addJSON('_disableNaviSettings', true);
101 define('PMA_DISABLE_NAVI_SETTINGS', true);