forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.inc.php
209 lines (184 loc) · 8.38 KB
/
header.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package phpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
require_once './libraries/common.inc.php';
require_once './libraries/RecentTable.class.php';
/**
* Add recently used table and reload the navigation.
*
* @param string $db Database name where the table is located.
* @param string $table The table name
*/
function PMA_addRecentTable($db, $table) {
$tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
if ($tmp_result === true) {
echo '<span class="hide" id="update_recent_tables"></span>';
} else {
$error = $tmp_result;
$error->display();
}
}
/**
* This is not an Ajax request so we need to generate all this output.
*/
if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
if (empty($GLOBALS['is_header_sent'])) {
/**
* Gets a core script and starts output buffering work
*/
require_once './libraries/ob.lib.php';
PMA_outBufferPre();
// if database storage for user preferences is transient, offer to load
// exported settings from localStorage (detection will be done in JavaScript)
$userprefs_offer_import = $GLOBALS['PMA_Config']->get('user_preferences') == 'session'
&& ! isset($_SESSION['userprefs_autoload']);
if ($userprefs_offer_import) {
$GLOBALS['js_include'][] = 'config.js';
}
// For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by header.inc.php,
// querywindow.php.
require_once './libraries/header_http.inc.php';
require_once './libraries/header_meta_style.inc.php';
require_once './libraries/header_scripts.inc.php';
?>
<meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
<?php /* remove vertical scroll bar bug in ie */ ?>
<!--[if IE 6]>
<style type="text/css">
/* <![CDATA[ */
html {
overflow-y: scroll;
}
/* ]]> */
</style>
<![endif]-->
</head>
<body>
<?php
// Include possible custom headers
if (file_exists(CUSTOM_HEADER_FILE)) {
require CUSTOM_HEADER_FILE;
}
// message of "Cookies required" displayed for auth_type http or config
// note: here, the decoration won't work because without cookies,
// our standard CSS is not operational
if (empty($_COOKIE)) {
PMA_Message::notice(__('Cookies must be enabled past this point.'))->display();
}
// offer to load user preferences from localStorage
if ($userprefs_offer_import) {
require_once './libraries/user_preferences.lib.php';
PMA_userprefs_autoload_header();
}
if (!defined('PMA_DISPLAY_HEADING')) {
define('PMA_DISPLAY_HEADING', 1);
}
/**
* Display heading if needed. Design can be set in css file.
*/
if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
$server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
? $GLOBALS['cfg']['Server']['verbose']
: $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
? ''
: ':' . $GLOBALS['cfg']['Server']['port']
)
);
$item = '<a href="%1$s?%2$s" class="item">';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_' . $GLOBALS['text_dir'] . '.png" width="5" height="9" alt="-" /></span>' . "\n";
$item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
} else {
$separator = ' <span class="separator"> - </span>' . "\n";
}
if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
$item .= '%4$s: ';
}
$item .= '%3$s</a>' . "\n";
echo '<div id="serverinfo">' . "\n";
printf($item,
$GLOBALS['cfg']['DefaultTabServer'],
PMA_generate_common_url(),
htmlspecialchars($server_info),
__('Server'),
's_host.png');
if (strlen($GLOBALS['db'])) {
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabDatabase'],
PMA_generate_common_url($GLOBALS['db']),
htmlspecialchars($GLOBALS['db']),
__('Database'),
's_db.png');
// if the table is being dropped, $_REQUEST['purge'] is set
// (it always contains "1")
// so do not display the table name in upper div
if (strlen($GLOBALS['table']) && ! (isset($_REQUEST['purge']))) {
require_once './libraries/tbl_info.inc.php';
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabTable'],
PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
str_replace(' ', ' ', htmlspecialchars($GLOBALS['table'])),
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? __('View') : __('Table')),
(isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png');
/**
* Displays table comment
*/
if (!empty($show_comment) && ! isset($GLOBALS['avoid_show_comment'])) {
if (strstr($show_comment, '; InnoDB free')) {
$show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
}
echo '<span class="table_comment" id="span_table_comment">'
.'"' . htmlspecialchars($show_comment)
.'"</span>' . "\n";
} // end if
// add recently used table and reload the navigation
if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']);
}
} else {
// no table selected, display database comment if present
/**
* Settings for relations stuff
*/
require_once './libraries/relation.lib.php';
$cfgRelation = PMA_getRelationsParam();
// Get additional information about tables for tooltip is done
// in libraries/db_info.inc.php only once
if ($cfgRelation['commwork']) {
$comment = PMA_getDbComment($GLOBALS['db']);
/**
* Displays table comment
*/
if (! empty($comment)) {
echo '<span class="table_comment"'
. ' id="span_table_comment">"'
. htmlspecialchars($comment)
. '"</span>' . "\n";
} // end if
}
}
}
}
echo '</div>';
}
/**
* Sets a variable to remember headers have been sent
*/
$GLOBALS['is_header_sent'] = true;
} //end if(!$GLOBALS['is_ajax_request'])
else {
if (empty($GLOBALS['is_header_sent'])) {
require_once './libraries/header_http.inc.php';
$GLOBALS['is_header_sent'] = true;
}
}
?>