patch for Copy set of tables to new name pattern.
[phpmyadmin/dennischen.git] / libraries / header.inc.php
blob807ec0af208a3aedadd11aecde41f29836c635a6
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';
17 /**
18 * This is not an Ajax request so we need to generate all this output.
20 if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
22 if (empty($GLOBALS['is_header_sent'])) {
24 /**
25 * Gets a core script and starts output buffering work
27 require_once './libraries/ob.lib.php';
28 PMA_outBufferPre();
30 // if database storage for user preferences is transient, offer to load
31 // exported settings from localStorage (detection will be done in JavaScript)
32 $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
33 && !isset($_SESSION['userprefs_autoload']);
34 if ($userprefs_offer_import) {
35 $GLOBALS['js_include'][] = 'config.js';
38 // For re-usability, moved http-headers and stylesheets
39 // to a seperate file. It can now be included by header.inc.php,
40 // querywindow.php.
42 require_once './libraries/header_http.inc.php';
43 require_once './libraries/header_meta_style.inc.php';
44 require_once './libraries/header_scripts.inc.php';
46 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
47 <?php /* remove vertical scroll bar bug in ie */ ?>
48 <!--[if IE 6]>
49 <style type="text/css">
50 /* <![CDATA[ */
51 html {
52 overflow-y: scroll;
54 /* ]]> */
55 </style>
56 <![endif]-->
57 </head>
59 <body>
60 <?php
62 // Include possible custom headers
63 if (file_exists(CUSTOM_HEADER_FILE)) {
64 require CUSTOM_HEADER_FILE;
68 // message of "Cookies required" displayed for auth_type http or config
69 // note: here, the decoration won't work because without cookies,
70 // our standard CSS is not operational
71 if (empty($_COOKIE)) {
72 PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
75 // offer to load user preferences from localStorage
76 if ($userprefs_offer_import) {
77 require_once './libraries/user_preferences.lib.php';
78 PMA_userprefs_autoload_header();
81 if (!defined('PMA_DISPLAY_HEADING')) {
82 define('PMA_DISPLAY_HEADING', 1);
85 /**
86 * Display heading if needed. Design can be set in css file.
89 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
90 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
91 ? $GLOBALS['cfg']['Server']['verbose']
92 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
93 ? ''
94 : ':' . $GLOBALS['cfg']['Server']['port']
97 $item = '<a href="%1$s?%2$s" class="item">';
98 if ($GLOBALS['cfg']['NavigationBarIconic']) {
99 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png" width="5" height="9" alt="-" /></span>' . "\n";
100 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
101 } else {
102 $separator = ' <span class="separator"> - </span>' . "\n";
105 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
106 $item .= '%4$s: ';
108 $item .= '%3$s</a>' . "\n";
110 echo '<div id="serverinfo">' . "\n";
111 printf($item,
112 $GLOBALS['cfg']['DefaultTabServer'],
113 PMA_generate_common_url(),
114 htmlspecialchars($server_info),
115 __('Server'),
116 's_host.png');
118 if (strlen($GLOBALS['db'])) {
120 echo $separator;
121 printf($item,
122 $GLOBALS['cfg']['DefaultTabDatabase'],
123 PMA_generate_common_url($GLOBALS['db']),
124 htmlspecialchars($GLOBALS['db']),
125 __('Database'),
126 's_tbl.png');
127 // if the table is being dropped, $_REQUEST['purge'] is set
128 // (it always contains "1")
129 // so do not display the table name in upper div
130 if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
131 require_once './libraries/tbl_info.inc.php';
133 echo $separator;
134 printf($item,
135 $GLOBALS['cfg']['DefaultTabTable'],
136 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
137 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
138 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
139 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
142 * Displays table comment
143 * @uses $show_comment from libraries/tbl_info.inc.php
144 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
146 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
147 if (strstr($show_comment, '; InnoDB free')) {
148 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
150 echo '<span class="table_comment" id="span_table_comment">'
151 .'&quot;' . htmlspecialchars($show_comment)
152 .'&quot;</span>' . "\n";
153 } // end if
154 } else {
155 // no table selected, display database comment if present
157 * Settings for relations stuff
159 require_once './libraries/relation.lib.php';
160 $cfgRelation = PMA_getRelationsParam();
162 // Get additional information about tables for tooltip is done
163 // in libraries/db_info.inc.php only once
164 if ($cfgRelation['commwork']) {
165 $comment = PMA_getDbComment($GLOBALS['db']);
167 * Displays table comment
169 if (! empty($comment)) {
170 echo '<span class="table_comment"'
171 . ' id="span_table_comment">&quot;'
172 . htmlspecialchars($comment)
173 . '&quot;</span>' . "\n";
174 } // end if
179 echo '</div>';
182 * Sets a variable to remember headers have been sent
184 $GLOBALS['is_header_sent'] = true;
185 } //end if(!$GLOBALS['is_ajax_request'])
186 else {
187 if (empty($GLOBALS['is_header_sent'])) {
188 require_once './libraries/header_http.inc.php';
189 $GLOBALS['is_header_sent'] = true;