2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * User preferences page
10 * Gets some core libraries and displays a top message if required
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/user_preferences.lib.php';
14 require_once 'libraries/config/config_functions.lib.php';
15 require_once 'libraries/config/messages.inc.php';
16 require_once 'libraries/config/ConfigFile.class.php';
17 require_once 'libraries/config/Form.class.php';
18 require_once 'libraries/config/FormDisplay.class.php';
19 require 'libraries/config/user_preferences.forms.php';
21 $cf = new ConfigFile($GLOBALS['PMA_Config']->base_settings
);
22 PMA_userprefsPageInit($cf);
24 // handle form processing
26 $form_param = isset($_GET['form']) ?
$_GET['form'] : null;
27 if (! isset($forms[$form_param])) {
28 $forms_keys = array_keys($forms);
29 $form_param = array_shift($forms_keys);
32 $form_display = new FormDisplay($cf);
33 foreach ($forms[$form_param] as $form_name => $form) {
34 // skip Developer form if no setting is available
35 if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
38 $form_display->registerForm($form_name, $form, 1);
41 if (isset($_POST['revert'])) {
42 // revert erroneous fields to their default values
43 $form_display->fixErrors();
45 $url_params = array('form' => $form_param);
46 PMA_sendHeaderLocation(
47 $cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
48 . PMA_URL_getCommon($url_params, 'text')
54 if ($form_display->process(false) && !$form_display->hasErrors()) {
56 $result = PMA_saveUserprefs($cf->getConfigArray());
57 if ($result === true) {
59 $GLOBALS['PMA_Config']->loadUserPreferences();
60 $tabHash = isset($_POST['tab_hash']) ?
$_POST['tab_hash'] : null;
61 $hash = ltrim($tabHash, '#');
62 PMA_userprefsRedirect(
64 array('form' => $form_param),
74 $response = PMA_Response
::getInstance();
75 $header = $response->getHeader();
76 $scripts = $header->getScripts();
77 $scripts->addFile('config.js');
79 require 'libraries/user_preferences.inc.php';
83 if ($form_display->hasErrors()) {
86 <div
class="error config-form">
88 <?php
echo __('Cannot save settings, submitted form contains errors!') ?
>
90 <?php
echo $form_display->displayErrors(); ?
>
94 echo $form_display->getDisplay(true, true);
96 if ($response->isAjax()) {
97 $response->addJSON('_disableNaviSettings', true);
99 define('PMA_DISABLE_NAVI_SETTINGS', true);