Merge branch 'blinky/master' into gsoc2010-blinky
[phpmyadmin.git] / libraries / header.inc.php
blobea159a3c8139fb45fb38d28910634f73e34486b1
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
14 require_once './libraries/common.inc.php';
16 if (empty($GLOBALS['is_header_sent'])) {
18 /**
19 * Gets a core script and starts output buffering work
21 require_once './libraries/ob.lib.php';
22 PMA_outBufferPre();
24 // if database storage for user preferences is transient, offer to load
25 // exported settings from localStorage (detection will be done in JavaScript)
26 $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
27 && !isset($_SESSION['userprefs_autoload']);
28 if ($userprefs_offer_import) {
29 $GLOBALS['js_include'][] = 'config.js';
32 // For re-usability, moved http-headers and stylesheets
33 // to a seperate file. It can now be included by header.inc.php,
34 // querywindow.php.
36 require_once './libraries/header_http.inc.php';
37 require_once './libraries/header_meta_style.inc.php';
38 require_once './libraries/header_scripts.inc.php';
40 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
41 <?php /* remove vertical scroll bar bug in ie */ ?>
42 <!--[if IE 6]>
43 <style type="text/css">
44 /* <![CDATA[ */
45 html {
46 overflow-y: scroll;
48 /* ]]> */
49 </style>
50 <![endif]-->
51 </head>
53 <body>
54 <?php
56 // Include possible custom headers
57 if (file_exists(CUSTOM_HEADER_FILE)) {
58 require CUSTOM_HEADER_FILE;
62 // message of "Cookies required" displayed for auth_type http or config
63 // note: here, the decoration won't work because without cookies,
64 // our standard CSS is not operational
65 if (empty($_COOKIE)) {
66 PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
69 // offer to load user preferences from localStorage
70 if ($userprefs_offer_import) {
71 require_once './libraries/user_preferences.lib.php';
72 PMA_userprefs_autoload_header();
75 if (!defined('PMA_DISPLAY_HEADING')) {
76 define('PMA_DISPLAY_HEADING', 1);
79 /**
80 * Display heading if needed. Design can be set in css file.
83 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
84 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
85 ? $GLOBALS['cfg']['Server']['verbose']
86 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
87 ? ''
88 : ':' . $GLOBALS['cfg']['Server']['port']
91 $item = '<a href="%1$s?%2$s" class="item">';
92 if ($GLOBALS['cfg']['NavigationBarIconic']) {
93 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
94 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
95 } else {
96 $separator = ' <span class="separator"> - </span>' . "\n";
99 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
100 $item .= '%4$s: ';
102 $item .= '%3$s</a>' . "\n";
104 echo '<div id="serverinfo">' . "\n";
105 printf($item,
106 $GLOBALS['cfg']['DefaultTabServer'],
107 PMA_generate_common_url(),
108 htmlspecialchars($server_info),
109 __('Server'),
110 's_host.png');
112 if (strlen($GLOBALS['db'])) {
114 echo $separator;
115 printf($item,
116 $GLOBALS['cfg']['DefaultTabDatabase'],
117 PMA_generate_common_url($GLOBALS['db']),
118 htmlspecialchars($GLOBALS['db']),
119 __('Database'),
120 's_db.png');
122 if (isset($GLOBALS['action']) && $GLOBALS['action'] == 'tbl_create.php') {
123 /* We're creating a new table */
124 echo $separator;
125 printf($item,
126 $action,
127 PMA_generate_common_url($GLOBALS['db']),
128 __('New table'),
130 's_tbl.png');
131 // if the table is being dropped, $_REQUEST['purge'] is set
132 // (it always contains "1")
133 // so do not display the table name in upper div
134 } elseif (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
135 require_once './libraries/tbl_info.inc.php';
137 echo $separator;
138 printf($item,
139 $GLOBALS['cfg']['DefaultTabTable'],
140 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
141 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
142 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
143 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
146 * Displays table comment
147 * @uses $show_comment from libraries/tbl_info.inc.php
148 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
150 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
151 if (strstr($show_comment, '; InnoDB free')) {
152 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
154 echo '<span class="table_comment" id="span_table_comment">'
155 .'&quot;' . htmlspecialchars($show_comment)
156 .'&quot;</span>' . "\n";
157 } // end if
158 } else {
159 // no table selected, display database comment if present
161 * Settings for relations stuff
163 $cfgRelation = PMA_getRelationsParam();
165 // Get additional information about tables for tooltip is done
166 // in libraries/db_info.inc.php only once
167 if ($cfgRelation['commwork']) {
168 $comment = PMA_getDbComment($GLOBALS['db']);
170 * Displays table comment
172 if (! empty($comment)) {
173 echo '<span class="table_comment"'
174 . ' id="span_table_comment">&quot;'
175 . htmlspecialchars($comment)
176 . '&quot;</span>' . "\n";
177 } // end if
181 echo '</div>';
185 * Sets a variable to remember headers have been sent
187 $GLOBALS['is_header_sent'] = true;