Lock page when changes are done in the SQL editor
[phpmyadmin.git] / libraries / user_preferences.inc.php
blobef4687db412f1c6a6f849be4d3501e55bbc17acb
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Common header for user preferences pages
6 * @package PhpMyAdmin
7 */
8 use PMA\libraries\Message;
9 use PMA\libraries\Sanitize;
11 if (!defined('PHPMYADMIN')) {
12 exit;
14 // build user preferences menu
16 $form_param = isset($_GET['form']) ? $_GET['form'] : null;
17 if (! isset($forms[$form_param])) {
18 $forms_keys = array_keys($forms);
19 $form_param = array_shift($forms_keys);
21 $tabs_icons = array(
22 'Features' => 'b_tblops.png',
23 'Sql_queries' => 'b_sql.png',
24 'Navi_panel' => 'b_select.png',
25 'Main_panel' => 'b_props.png',
26 'Import' => 'b_import.png',
27 'Export' => 'b_export.png');
29 $content = PMA\libraries\Util::getHtmlTab(
30 array(
31 'link' => 'prefs_manage.php',
32 'text' => __('Manage your settings')
34 ) . "\n";
35 $script_name = basename($GLOBALS['PMA_PHP_SELF']);
36 foreach (array_keys($forms) as $formset) {
37 $tab = array(
38 'link' => 'prefs_forms.php',
39 'text' => PMA_lang('Form_' . $formset),
40 'icon' => $tabs_icons[$formset],
41 'active' => ($script_name == 'prefs_forms.php' && $formset == $form_param));
42 $content .= PMA\libraries\Util::getHtmlTab($tab, array('form' => $formset))
43 . "\n";
45 echo PMA\libraries\Template::get('list/unordered')->render(
46 array(
47 'id' => 'topmenu2',
48 'class' => 'user_prefs_tabs',
49 'content' => $content,
52 echo '<div class="clearfloat"></div>';
55 // show "configuration saved" message and reload navigation panel if needed
56 if (!empty($_GET['saved'])) {
57 Message::rawSuccess(__('Configuration has been saved.'))->display();
60 /* debug code
61 $arr = $cf->getConfigArray();
62 $arr2 = array();
63 foreach ($arr as $k => $v) {
64 $arr2[] = "<b>$k</b> " . var_export($v, true);
66 $arr2 = implode(', ', $arr2);
67 $arr2 .= '<br />Blacklist: ' . (empty($cfg['UserprefsDisallow'])
68 ? '<i>empty</i>'
69 : implode(', ', $cfg['UserprefsDisallow']));
70 $msg = Message::notice('Settings: ' . $arr2);
71 $msg->display();
72 //*/
74 // warn about using session storage for settings
75 $cfgRelation = PMA_getRelationsParam();
76 if (! $cfgRelation['userconfigwork']) {
77 $msg = __(
78 'Your preferences will be saved for current session only. Storing them '
79 . 'permanently requires %sphpMyAdmin configuration storage%s.'
81 $msg = Sanitize::sanitize(
82 sprintf($msg, '[doc@linked-tables]', '[/doc]')
84 Message::notice($msg)->display();