Remove the content when AJAX dialog closes
[phpmyadmin/crack.git] / libraries / header.inc.php
bloba6ed8edc45964a449c311c47c829afd93546940d
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) {
22 $tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
23 if ($tmp_result === true) {
24 echo '<span class="hide" id="update_recent_tables"></span>';
25 } else {
26 $error = $tmp_result;
27 $error->display();
31 /**
32 * This is not an Ajax request so we need to generate all this output.
34 if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
36 if (empty($GLOBALS['is_header_sent'])) {
38 /**
39 * Gets a core script and starts output buffering work
41 require_once './libraries/ob.lib.php';
42 PMA_outBufferPre();
44 // if database storage for user preferences is transient, offer to load
45 // exported settings from localStorage (detection will be done in JavaScript)
46 $userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
47 && ! isset($_SESSION['userprefs_autoload']);
48 if ($userprefs_offer_import) {
49 $GLOBALS['js_include'][] = 'config.js';
52 // For re-usability, moved http-headers and stylesheets
53 // to a seperate file. It can now be included by header.inc.php,
54 // querywindow.php.
56 require_once './libraries/header_http.inc.php';
57 require_once './libraries/header_meta_style.inc.php';
58 require_once './libraries/header_scripts.inc.php';
60 <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
61 <?php /* remove vertical scroll bar bug in ie */ ?>
62 <!--[if IE 6]>
63 <style type="text/css">
64 /* <![CDATA[ */
65 html {
66 overflow-y: scroll;
68 /* ]]> */
69 </style>
70 <![endif]-->
71 </head>
73 <body>
74 <?php
76 // Include possible custom headers
77 if (file_exists(CUSTOM_HEADER_FILE)) {
78 require CUSTOM_HEADER_FILE;
82 // message of "Cookies required" displayed for auth_type http or config
83 // note: here, the decoration won't work because without cookies,
84 // our standard CSS is not operational
85 if (empty($_COOKIE)) {
86 PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
89 // offer to load user preferences from localStorage
90 if ($userprefs_offer_import) {
91 require_once './libraries/user_preferences.lib.php';
92 PMA_userprefs_autoload_header();
95 if (!defined('PMA_DISPLAY_HEADING')) {
96 define('PMA_DISPLAY_HEADING', 1);
99 /**
100 * Display heading if needed. Design can be set in css file.
103 if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
104 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
105 ? $GLOBALS['cfg']['Server']['verbose']
106 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
107 ? ''
108 : ':' . $GLOBALS['cfg']['Server']['port']
111 $item = '<a href="%1$s?%2$s" class="item">';
112 if ($GLOBALS['cfg']['NavigationBarIconic']) {
113 $separator = ' <span class="separator"><img class="icon ic_item_' . $GLOBALS['text_dir'] . '" src="themes/dot.gif" alt="-" /></span>' . "\n";
114 $item .= ' <img class="icon %5$s" src="themes/dot.gif" alt="" /> ' . "\n";
115 } else {
116 $separator = ' <span class="separator"> - </span>' . "\n";
119 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
120 $item .= '%4$s: ';
122 $item .= '%3$s</a>' . "\n";
124 echo '<div id="serverinfo">' . "\n";
125 printf($item,
126 $GLOBALS['cfg']['DefaultTabServer'],
127 PMA_generate_common_url(),
128 htmlspecialchars($server_info),
129 __('Server'),
130 'ic_s_host');
132 if (strlen($GLOBALS['db'])) {
134 echo $separator;
135 printf($item,
136 $GLOBALS['cfg']['DefaultTabDatabase'],
137 PMA_generate_common_url($GLOBALS['db']),
138 htmlspecialchars($GLOBALS['db']),
139 __('Database'),
140 'ic_s_db');
141 // if the table is being dropped, $_REQUEST['purge'] is set to '1'
142 // so do not display the table name in upper div
143 if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']) && $_REQUEST['purge'] == '1')) {
144 require_once './libraries/tbl_info.inc.php';
146 echo $separator;
147 printf($item,
148 $GLOBALS['cfg']['DefaultTabTable'],
149 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
150 str_replace(' ', '&nbsp;', htmlspecialchars($GLOBALS['table'])),
151 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
152 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'ic_b_views' : 'ic_s_tbl'));
155 * Displays table comment
157 if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) {
158 if (strstr($show_comment, '; InnoDB free')) {
159 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
161 echo '<span class="table_comment" id="span_table_comment">'
162 .'&quot;' . htmlspecialchars($show_comment)
163 .'&quot;</span>' . "\n";
164 } // end if
166 // add recently used table and reload the navigation
167 if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
168 PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
170 } else {
171 // no table selected, display database comment if present
173 * Settings for relations stuff
175 require_once './libraries/relation.lib.php';
176 $cfgRelation = PMA_getRelationsParam();
178 // Get additional information about tables for tooltip is done
179 // in libraries/db_info.inc.php only once
180 if ($cfgRelation['commwork']) {
181 $comment = PMA_getDbComment($GLOBALS['db']);
183 * Displays table comment
185 if (! empty($comment)) {
186 echo '<span class="table_comment"'
187 . ' id="span_table_comment">&quot;'
188 . htmlspecialchars($comment)
189 . '&quot;</span>' . "\n";
190 } // end if
195 echo '</div>';
198 * Sets a variable to remember headers have been sent
200 $GLOBALS['is_header_sent'] = true;
201 } //end if (!$GLOBALS['is_ajax_request'])
202 else {
203 if (empty($GLOBALS['is_header_sent'])) {
204 require_once './libraries/header_http.inc.php';
205 $GLOBALS['is_header_sent'] = true;