Translated using Weblate.
[phpmyadmin.git] / libraries / header.inc.php
blob3dd65ff50afb9433dce0113c402e915e02086830
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 require_once './libraries/common.inc.php';
12 require_once './libraries/RecentTable.class.php';
15 /**
16 * Add recently used table and reload the navigation.
18 * @param string $db Database name where the table is located.
19 * @param string $table The table name
21 function PMA_addRecentTable($db, $table)
23 $tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
24 if ($tmp_result === true) {
25 echo '<span class="hide" id="update_recent_tables"></span>';
26 } else {
27 $error = $tmp_result;
28 $error->display();
32 /**
33 * This is not an Ajax request so we need to generate all this output.
35 if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
37 if (empty($GLOBALS['is_header_sent'])) {
39 /**
40 * Gets a core script and starts output buffering work
42 include_once './libraries/ob.lib.php';
43 PMA_outBufferPre();
45 // if database storage for user preferences is transient, offer to load
46 // exported settings from localStorage (detection will be done in JavaScript)
47 $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
48 && ! isset($_SESSION['userprefs_autoload']);
49 if ($userprefs_offer_import) {
50 $GLOBALS['js_include'][] = 'config.js';
53 // For re-usability, moved http-headers and stylesheets
54 // to a seperate file. It can now be included by header.inc.php,
55 // querywindow.php.
57 include_once './libraries/header_http.inc.php';
58 include_once './libraries/header_meta_style.inc.php';
59 include_once './libraries/header_scripts.inc.php';
61 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
62 <?php /* remove vertical scroll bar bug in ie */ ?>
63 <!--[if IE 6]>
64 <style type="text/css">
65 /* <![CDATA[ */
66 html {
67 overflow-y: scroll;
69 /* ]]> */
70 </style>
71 <![endif]-->
72 </head>
74 <body>
75 <?php
77 // Include possible custom headers
78 if (file_exists(CUSTOM_HEADER_FILE)) {
79 include CUSTOM_HEADER_FILE;
83 // message of "Cookies required" displayed for auth_type http or config
84 // note: here, the decoration won't work because without cookies,
85 // our standard CSS is not operational
86 if (empty($_COOKIE)) {
87 PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
90 // offer to load user preferences from localStorage
91 if ($userprefs_offer_import) {
92 include_once './libraries/user_preferences.lib.php';
93 PMA_userprefs_autoload_header();
96 if (!defined('PMA_DISPLAY_HEADING')) {
97 define('PMA_DISPLAY_HEADING', 1);
100 // pass configuration for hint tooltip display
101 // (to be used by PMA_createqTip in js/functions.js)
102 if (! $GLOBALS['cfg']['ShowHint']) {
103 echo '<span id="no_hint" class="hide"></span>';
107 * Display heading if needed. Design can be set in css file.
110 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
111 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
112 ? $GLOBALS['cfg']['Server']['verbose']
113 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
114 ? ''
115 : ':' . $GLOBALS['cfg']['Server']['port']
118 $separator = "<span class='separator item'>&nbsp;ยป</span>\n";
119 $item = '<a href="%1$s?%2$s" class="item">';
121 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
122 $item .= '%4$s: ';
124 $item .= '%3$s</a>' . "\n";
125 echo "<div id='floating_menubar'></div>\n";
126 echo "<div id='serverinfo'>\n";
127 if ($GLOBALS['cfg']['NavigationBarIconic']) {
128 echo PMA_getImage('s_host.png', '', array('class' => 'item')) . "\n";
130 printf($item,
131 $GLOBALS['cfg']['DefaultTabServer'],
132 PMA_generate_common_url(),
133 htmlspecialchars($server_info),
134 __('Server'));
136 if (strlen($GLOBALS['db'])) {
138 echo $separator;
139 if ($GLOBALS['cfg']['NavigationBarIconic']) {
140 echo PMA_getImage('s_db.png', '', array('class' => 'item')) . "\n";
142 printf($item,
143 $GLOBALS['cfg']['DefaultTabDatabase'],
144 PMA_generate_common_url($GLOBALS['db']),
145 htmlspecialchars($GLOBALS['db']),
146 __('Database'));
147 // if the table is being dropped, $_REQUEST['purge'] is set to '1'
148 // so do not display the table name in upper div
149 if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
150 include_once './libraries/tbl_info.inc.php';
152 echo $separator;
153 if ($GLOBALS['cfg']['NavigationBarIconic']) {
154 $icon = isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views.png' : 's_tbl.png';
155 echo PMA_getImage($icon, '', array('class' => 'item')) . "\n";
157 printf($item,
158 $GLOBALS['cfg']['DefaultTabTable'],
159 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
160 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
161 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')));
164 * Displays table comment
166 if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) {
167 if (strstr($show_comment, '; InnoDB free')) {
168 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
170 echo '<span class="table_comment" id="span_table_comment">'
171 .'&quot;' . htmlspecialchars($show_comment)
172 .'&quot;</span>' . "\n";
173 } // end if
175 // add recently used table and reload the navigation
176 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
177 PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
179 } else {
180 // no table selected, display database comment if present
182 * Settings for relations stuff
184 include_once './libraries/relation.lib.php';
185 $cfgRelation = PMA_getRelationsParam();
187 // Get additional information about tables for tooltip is done
188 // in libraries/db_info.inc.php only once
189 if ($cfgRelation['commwork']) {
190 $comment = PMA_getDbComment($GLOBALS['db']);
192 * Displays table comment
194 if (! empty($comment)) {
195 echo '<span class="table_comment"'
196 . ' id="span_table_comment">&quot;'
197 . htmlspecialchars($comment)
198 . '&quot;</span>' . "\n";
199 } // end if
204 echo '<div class="clearfloat"></div>';
205 echo '</div>';
208 * Sets a variable to remember headers have been sent
210 $GLOBALS['is_header_sent'] = true;
211 //end if (!$GLOBALS['is_ajax_request'])
212 } else {
213 if (empty($GLOBALS['is_header_sent'])) {
214 include_once './libraries/header_http.inc.php';
215 $GLOBALS['is_header_sent'] = true;