1<?php 2/* vim: set expandtab sw=4 ts=4 sts=4: */ 3/** 4 * Common header for user preferences pages 5 * 6 * @package PhpMyAdmin 7 */ 8use PhpMyAdmin\Config\Forms\User\UserFormList; 9use PhpMyAdmin\Message; 10use PhpMyAdmin\Relation; 11use PhpMyAdmin\Sanitize; 12use PhpMyAdmin\TwoFactor; 13 14if (!defined('PHPMYADMIN')) { 15 exit; 16} 17// build user preferences menu 18 19$form_param = isset($_GET['form']) ? $_GET['form'] : null; 20$tabs_icons = array( 21 'Features' => 'b_tblops', 22 'Sql' => 'b_sql', 23 'Navi' => 'b_select', 24 'Main' => 'b_props', 25 'Import' => 'b_import', 26 'Export' => 'b_export'); 27 28$content = PhpMyAdmin\Util::getHtmlTab( 29 array( 30 'link' => 'prefs_manage.php', 31 'text' => __('Manage your settings') 32 ) 33) . "\n"; 34/* Second authentication factor */ 35$content .= PhpMyAdmin\Util::getHtmlTab( 36 array( 37 'link' => 'prefs_twofactor.php', 38 'text' => __('Two-factor authentication') 39 ) 40) . "\n"; 41$script_name = basename($GLOBALS['PMA_PHP_SELF']); 42foreach (UserFormList::getAll() as $formset) { 43 $formset_class = UserFormList::get($formset); 44 $tab = array( 45 'link' => 'prefs_forms.php', 46 'text' => $formset_class::getName(), 47 'icon' => $tabs_icons[$formset], 48 'active' => ($script_name == 'prefs_forms.php' && $formset == $form_param)); 49 $content .= PhpMyAdmin\Util::getHtmlTab($tab, array('form' => $formset)) 50 . "\n"; 51} 52echo PhpMyAdmin\Template::get('list/unordered')->render( 53 array( 54 'id' => 'topmenu2', 55 'class' => 'user_prefs_tabs', 56 'content' => $content, 57 ) 58); 59echo '<div class="clearfloat"></div>'; 60 61// show "configuration saved" message and reload navigation panel if needed 62if (!empty($_GET['saved'])) { 63 Message::rawSuccess(__('Configuration has been saved.'))->display(); 64} 65 66// warn about using session storage for settings 67$relation = new Relation(); 68$cfgRelation = $relation->getRelationsParam(); 69if (! $cfgRelation['userconfigwork']) { 70 $msg = __( 71 'Your preferences will be saved for current session only. Storing them ' 72 . 'permanently requires %sphpMyAdmin configuration storage%s.' 73 ); 74 $msg = Sanitize::sanitize( 75 sprintf($msg, '[doc@linked-tables]', '[/doc]') 76 ); 77 Message::notice($msg)->display(); 78} 79