Bug: Live query chart always zero
[phpmyadmin/tyronm.git] / libraries / header.inc.php
blobeb17e4cc98656a518f8ee0d1b46bc9f04aa582ca
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 require_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 require_once './libraries/header_http.inc.php';
58 require_once './libraries/header_meta_style.inc.php';
59 require_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 require 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 require_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 $item = '<a href="%1$s?%2$s" class="item">';
119 if ($GLOBALS['cfg']['NavigationBarIconic']) {
120 $separator = ' <span class="separator"><img class="icon ic_item_' . $GLOBALS['text_dir'] . '" src="themes/dot.gif" alt="-" /></span>' . "\n";
121 $item .= ' <img class="icon %5$s" src="themes/dot.gif" alt="" /> ' . "\n";
122 } else {
123 $separator = ' <span class="separator"> - </span>' . "\n";
126 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
127 $item .= '%4$s: ';
129 $item .= '%3$s</a>' . "\n";
131 echo '<div id="serverinfo">' . "\n";
132 printf($item,
133 $GLOBALS['cfg']['DefaultTabServer'],
134 PMA_generate_common_url(),
135 htmlspecialchars($server_info),
136 __('Server'),
137 'ic_s_host');
139 if (strlen($GLOBALS['db'])) {
141 echo $separator;
142 printf($item,
143 $GLOBALS['cfg']['DefaultTabDatabase'],
144 PMA_generate_common_url($GLOBALS['db']),
145 htmlspecialchars($GLOBALS['db']),
146 __('Database'),
147 'ic_s_db');
148 // if the table is being dropped, $_REQUEST['purge'] is set to '1'
149 // so do not display the table name in upper div
150 if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
151 require_once './libraries/tbl_info.inc.php';
153 echo $separator;
154 printf($item,
155 $GLOBALS['cfg']['DefaultTabTable'],
156 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
157 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
158 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
159 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'ic_b_views' : 'ic_s_tbl'));
162 * Displays table comment
164 if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) {
165 if (strstr($show_comment, '; InnoDB free')) {
166 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
168 echo '<span class="table_comment" id="span_table_comment">'
169 .'&quot;' . htmlspecialchars($show_comment)
170 .'&quot;</span>' . "\n";
171 } // end if
173 // add recently used table and reload the navigation
174 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
175 PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
177 } else {
178 // no table selected, display database comment if present
180 * Settings for relations stuff
182 require_once './libraries/relation.lib.php';
183 $cfgRelation = PMA_getRelationsParam();
185 // Get additional information about tables for tooltip is done
186 // in libraries/db_info.inc.php only once
187 if ($cfgRelation['commwork']) {
188 $comment = PMA_getDbComment($GLOBALS['db']);
190 * Displays table comment
192 if (! empty($comment)) {
193 echo '<span class="table_comment"'
194 . ' id="span_table_comment">&quot;'
195 . htmlspecialchars($comment)
196 . '&quot;</span>' . "\n";
197 } // end if
202 echo '</div>';
205 * Sets a variable to remember headers have been sent
207 $GLOBALS['is_header_sent'] = true;
208 } //end if (!$GLOBALS['is_ajax_request'])
209 else {
210 if (empty($GLOBALS['is_header_sent'])) {
211 require_once './libraries/header_http.inc.php';
212 $GLOBALS['is_header_sent'] = true;