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 PMA_userprefs_pageinit();
23 // handle form processing
25 $form_param = filter_input(INPUT_GET
, 'form');
26 if (! isset($forms[$form_param])) {
27 $forms_keys = array_keys($forms);
28 $form_param = array_shift($forms_keys);
31 $form_display = new FormDisplay();
32 foreach ($forms[$form_param] as $form_name => $form) {
33 // skip Developer form if no setting is available
34 if ($form_name == 'Developer' && !$GLOBALS['cfg']['UserprefsDeveloperTab']) {
37 $form_display->registerForm($form_name, $form, 1);
40 if (isset($_POST['revert'])) {
41 // revert erroneous fields to their default values
42 $form_display->fixErrors();
44 $url_params = array('form' => $form_param);
45 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
46 . PMA_generate_common_url($url_params, '&'));
51 if ($form_display->process(false) && !$form_display->hasErrors()) {
53 $old_settings = PMA_load_userprefs();
54 $result = PMA_save_userprefs(ConfigFile
::getInstance()->getConfigArray());
55 if ($result === true) {
57 $GLOBALS['PMA_Config']->loadUserPreferences();
58 $hash = ltrim(filter_input(INPUT_POST
, 'tab_hash'), '#');
59 PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array(
60 'form' => $form_param), $hash);
68 $GLOBALS['js_include'][] = 'config.js';
69 require './libraries/header.inc.php';
70 require './libraries/user_preferences.inc.php';
74 if ($form_display->hasErrors()) {
77 <div
class="error config-form">
78 <b
><?php
echo __('Cannot save settings, submitted form contains errors') ?
></b
>
79 <?php
$form_display->displayErrors(); ?
>
83 $form_display->display(true, true);
88 require './libraries/footer.inc.php';