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