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';
20 $GLOBALS['js_include'][] = 'config.js';
22 require_once './libraries/header.inc.php';
24 // Any message to display?
25 if (! empty($message)) {
26 PMA_showMessage($message);
31 $form_param = filter_input(INPUT_GET
, 'form');
32 if (!isset($forms[$form_param])) {
33 $form_param = array_shift(array_keys($forms));
35 foreach (array_keys($forms) as $form) {
37 'link' => 'user_preferences.php',
38 'text' => PMA_ifSetOr($GLOBALS['strSetupForm_' . $form], $form), // TODO: remove ifSetOr
39 'active' => $form == $form_param,
40 'url_params' => array('form' => $form)
44 echo PMA_generate_html_tabs($tabs, array());
46 $form_display = new FormDisplay();
47 foreach ($forms[$form_param] as $form_name => $form) {
48 $form_display->registerForm($form_name, $form);
51 if (filter_input(INPUT_GET
, 'mode') == 'revert') {
52 // revert erroneous fields to their default values
53 $form_display->fixErrors();
55 $url_params = array('form' => $form_param);
56 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'user_preferences.php'
57 . PMA_generate_common_url($url_params, '&'));
60 if (!$form_display->process(false)) {
61 // handle form view and failed POST
62 $form_display->display(true, true);
64 // check for form errors
65 if ($form_display->hasErrors()) {
66 // form has errors, show warning
67 $separator = PMA_get_arg_separator('html');
70 <h4
><?php
echo __('Warning') ?
></h4
>
71 <?php
echo PMA_lang('error_form') ?
><br
/>
72 <a href
="?form=<?php echo $form_param ?>&mode=revert"><?php
echo PMA_lang('RevertErroneousFields') ?
></a
>
74 <?php
$form_display->displayErrors() ?
>
75 <a
class="btn" href
="user_preferences.php"><?php
echo PMA_lang('IgnoreErrors') ?
></a
>
77 <a
class="btn" href
="?form=<?php echo $form_param ?>&mode=edit"><?php
echo PMA_lang('ShowForm') ?
></a
>
81 $url_params = array('form' => $form_param);
82 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'user_preferences.php'
83 . PMA_generate_common_url($url_params, '&'));
91 require_once './libraries/footer.inc.php';