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, '&'));
50 if ($form_display->process(false) && !$form_display->hasErrors()) {
52 $old_settings = PMA_load_userprefs();
53 $result = PMA_save_userprefs(ConfigFile
::getInstance()->getConfigArray());
54 if ($result === true) {
55 $hash = ltrim(filter_input(INPUT_POST
, 'tab_hash'), '#');
56 PMA_userprefs_redirect($forms, $old_settings, 'prefs_forms.php', array(
57 'form' => $form_param), $hash);
65 $GLOBALS['js_include'][] = 'config.js';
66 require './libraries/header.inc.php';
67 require './libraries/user_preferences.inc.php';
68 if ($form_display->hasErrors()) {
71 <div
class="warning config-form">
72 <b
><?php
echo __('Submitted form contains errors') ?
></b
>
73 <?php
$form_display->displayErrors(); ?
>
77 $form_display->display(true, true);
82 require './libraries/footer.inc.php';