Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / libraries / header.inc.php
blob9839c53d62788d3eba983b42fef71589af093f83
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
15 require_once './libraries/common.inc.php';
17 if (empty($GLOBALS['is_header_sent'])) {
19 /**
20 * Gets a core script and starts output buffering work
22 require_once './libraries/ob.lib.php';
23 PMA_outBufferPre();
25 // For re-usability, moved http-headers and stylesheets
26 // to a seperate file. It can now be included by header.inc.php,
27 // querywindow.php.
29 require_once './libraries/header_http.inc.php';
30 require_once './libraries/header_meta_style.inc.php';
31 require_once './libraries/header_scripts.inc.php';
33 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
34 <?php /* remove vertical scroll bar bug in ie */ ?>
35 <!--[if IE 6]>
36 <style type="text/css">
37 /* <![CDATA[ */
38 html {
39 overflow-y: scroll;
41 /* ]]> */
42 </style>
43 <![endif]-->
44 </head>
46 <body>
47 <?php
49 // Include possible custom headers
50 if (file_exists(CUSTOM_HEADER_FILE)) {
51 require CUSTOM_HEADER_FILE;
55 // message of "Cookies required" displayed for auth_type http or config
56 // note: here, the decoration won't work because without cookies,
57 // our standard CSS is not operational
58 if (empty($_COOKIE)) {
59 PMA_Message::notice('strCookiesRequired')->display();
62 if (!defined('PMA_DISPLAY_HEADING')) {
63 define('PMA_DISPLAY_HEADING', 1);
66 /**
67 * Display heading if needed. Design can be set in css file.
70 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
71 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
72 ? $GLOBALS['cfg']['Server']['verbose']
73 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
74 ? ''
75 : ':' . $GLOBALS['cfg']['Server']['port']
78 $item = '<a href="%1$s?%2$s" class="item">';
79 if ($GLOBALS['cfg']['NavigationBarIconic']) {
80 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
81 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
82 } else {
83 $separator = ' <span class="separator"> - </span>' . "\n";
86 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
87 $item .= '%4$s: ';
89 $item .= '%3$s</a>' . "\n";
91 echo '<div id="serverinfo">' . "\n";
92 printf($item,
93 $GLOBALS['cfg']['DefaultTabServer'],
94 PMA_generate_common_url(),
95 htmlspecialchars($server_info),
96 $GLOBALS['strServer'],
97 's_host.png');
99 if (strlen($GLOBALS['db'])) {
101 echo $separator;
102 printf($item,
103 $GLOBALS['cfg']['DefaultTabDatabase'],
104 PMA_generate_common_url($GLOBALS['db']),
105 htmlspecialchars($GLOBALS['db']),
106 $GLOBALS['strDatabase'],
107 's_db.png');
109 if (isset($GLOBALS['action']) && $GLOBALS['action'] == 'tbl_create.php') {
110 /* We're creating a new table */
111 echo $separator;
112 printf($item,
113 $action,
114 PMA_generate_common_url($GLOBALS['db']),
115 __('New table'),
117 's_tbl.png');
118 } elseif (strlen($GLOBALS['table'])) {
119 require_once './libraries/tbl_info.inc.php';
121 echo $separator;
122 printf($item,
123 $GLOBALS['cfg']['DefaultTabTable'],
124 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
125 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
126 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']),
127 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
130 * Displays table comment
131 * @uses $show_comment from libraries/tbl_info.inc.php
132 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
134 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
135 if (strstr($show_comment, '; InnoDB free')) {
136 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
138 echo '<span class="table_comment" id="span_table_comment">'
139 .'&quot;' . htmlspecialchars($show_comment)
140 .'&quot;</span>' . "\n";
141 } // end if
142 } else {
143 // no table selected, display database comment if present
145 * Settings for relations stuff
147 require_once './libraries/relation.lib.php';
148 $cfgRelation = PMA_getRelationsParam();
150 // Get additional information about tables for tooltip is done
151 // in libraries/db_info.inc.php only once
152 if ($cfgRelation['commwork']) {
153 $comment = PMA_getDbComment($GLOBALS['db']);
155 * Displays table comment
157 if (! empty($comment)) {
158 echo '<span class="table_comment"'
159 . ' id="span_table_comment">&quot;'
160 . htmlspecialchars($comment)
161 . '&quot;</span>' . "\n";
162 } // end if
166 echo '</div>';
170 * Sets a variable to remember headers have been sent
172 $GLOBALS['is_header_sent'] = true;