2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 if (! defined('PHPMYADMIN')) {
11 require_once './libraries/common.inc.php';
12 require_once './libraries/RecentTable.class.php';
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>';
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'])) {
40 * Gets a core script and starts output buffering work
42 require_once './libraries/ob.lib.php';
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,
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 */ ?
>
64 <style type
="text/css">
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'])
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";
123 $separator = ' <span class="separator"> - </span>' . "\n";
126 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
129 $item .= '%3$s</a>' . "\n";
131 echo '<div id="serverinfo">' . "\n";
133 $GLOBALS['cfg']['DefaultTabServer'],
134 PMA_generate_common_url(),
135 htmlspecialchars($server_info),
139 if (strlen($GLOBALS['db'])) {
143 $GLOBALS['cfg']['DefaultTabDatabase'],
144 PMA_generate_common_url($GLOBALS['db']),
145 htmlspecialchars($GLOBALS['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';
155 $GLOBALS['cfg']['DefaultTabTable'],
156 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
157 str_replace(' ', ' ', 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 .'"' . htmlspecialchars($show_comment)
170 .'"</span>' . "\n";
173 // add recently used table and reload the navigation
174 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
175 PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
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">"'
195 . htmlspecialchars($comment)
196 . '"</span>' . "\n";
205 * Sets a variable to remember headers have been sent
207 $GLOBALS['is_header_sent'] = true;
208 } //end if (!$GLOBALS['is_ajax_request'])
210 if (empty($GLOBALS['is_header_sent'])) {
211 require_once './libraries/header_http.inc.php';
212 $GLOBALS['is_header_sent'] = true;