2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 if (! defined('PHPMYADMIN')) {
14 require_once './libraries/common.inc.php';
16 if (empty($GLOBALS['is_header_sent'])) {
19 * Gets a core script and starts output buffering work
21 require_once './libraries/common.inc.php';
22 require_once './libraries/ob.lib.php';
25 // garvin: For re-usability, moved http-headers and stylesheets
26 // to a seperate file. It can now be included by header.inc.php,
29 require_once './libraries/header_http.inc.php';
30 require_once './libraries/header_meta_style.inc.php';
32 // Cross-framing protection
33 if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
35 <script type
="text/javascript">
37 // can't access this if on a different domain
38 var topdomain
= top
.document
.domain
;
39 // double-check just for sure
40 if (topdomain
!= self
.document
.domain
) {
41 alert("Redirecting...");
42 top
.location
.replace(self
.document
.URL
.substring(0, self
.document
.URL
.lastIndexOf("/")+
1));
46 alert("Redirecting... (error: " + e
);
47 top
.location
.replace(self
.document
.URL
.substring(0, self
.document
.URL
.lastIndexOf("/")+
1));
65 PMA_getenv('HTTP_HOST') ?
PMA_getenv('HTTP_HOST') : '',
66 isset($GLOBALS['cfg']['Server']['host']) ?
$GLOBALS['cfg']['Server']['host'] : '',
67 isset($GLOBALS['cfg']['Server']['verbose']) ?
$GLOBALS['cfg']['Server']['verbose'] : '',
68 !empty($GLOBALS['cfg']['Server']['verbose']) ?
$GLOBALS['cfg']['Server']['verbose'] : (isset($GLOBALS['cfg']['Server']['host']) ?
$GLOBALS['cfg']['Server']['host'] : ''),
71 'phpMyAdmin ' . PMA_VERSION
,
73 !empty($GLOBALS['table']) ?
$GLOBALS['cfg']['TitleTable'] :
74 (!empty($GLOBALS['db']) ?
$GLOBALS['cfg']['TitleDatabase'] :
75 (!empty($GLOBALS['cfg']['Server']['host']) ?
$GLOBALS['cfg']['TitleServer'] :
76 $GLOBALS['cfg']['TitleDefault']))
78 // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0;
79 $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
81 <script type
="text/javascript">
83 // Updates the title of the frameset if possible (ns4 does not allow this)
84 if (typeof(parent
.document
) != 'undefined' && typeof(parent
.document
) != 'unknown'
85 && typeof(parent
.document
.title
) == 'string') {
86 parent
.document
.title
= '<?php echo PMA_sanitize(str_replace('\'
', '\\\'
', $title)); ?>';
89 // Add some javascript instructions if required
90 if (isset($js_to_run) && $js_to_run == 'functions.js') {
93 // js form validation stuff
94 var errorMsg0
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strFormEmpty
']); ?>';
95 var errorMsg1
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotNumber
']); ?>';
96 var noDropDbMsg
= '<?php echo (!$is_superuser && !$GLOBALS['cfg
']['AllowUserDropDatabase
'])
97 ? str_replace('\'
', '\\\'
', $GLOBALS['strNoDropDatabases
']) : ''; ?>';
98 var confirmMsg
= '<?php echo(($GLOBALS['cfg
']['Confirm
']) ? str_replace('\'
', '\\\'
', $GLOBALS['strDoYouReally
']) : ''); ?>';
99 var confirmMsgDropDB
= '<?php echo(($GLOBALS['cfg
']['Confirm
']) ? str_replace('\'
', '\\\'
', $GLOBALS['strDropDatabaseStrongWarning
']) : ''); ?>';
102 <script src
="./js/functions.js" type
="text/javascript"></script
>
104 } elseif (isset($js_to_run) && $js_to_run == 'user_password.js') {
107 // js form validation stuff
108 var jsHostEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strHostEmpty
']); ?>';
109 var jsUserEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strUserEmpty
']); ?>';
110 var jsPasswordEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordEmpty
']); ?>';
111 var jsPasswordNotSame
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordNotSame
']); ?>';
114 <script src
="./js/user_password.js" type
="text/javascript"></script
>
116 } elseif (isset($js_to_run) && $js_to_run == 'server_privileges.js') {
119 // js form validation stuff
120 var jsHostEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strHostEmpty
']); ?>';
121 var jsUserEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strUserEmpty
']); ?>';
122 var jsPasswordEmpty
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordEmpty
']); ?>';
123 var jsPasswordNotSame
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strPasswordNotSame
']); ?>';
126 <script src
="./js/server_privileges.js" type
="text/javascript"></script
>
127 <script src
="./js/functions.js" type
="text/javascript"></script
>
129 } elseif (isset($js_to_run) && $js_to_run == 'indexes.js') {
132 // js index validation stuff
133 var errorMsg0
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strFormEmpty
']); ?>';
134 var errorMsg1
= '<?php echo str_replace('\'
', '\\\'
', $GLOBALS['strNotNumber
']); ?>';
137 <script src
="./js/indexes.js" type
="text/javascript"></script
>
139 } elseif (isset($js_to_run) && $js_to_run == 'tbl_change.js') {
144 <script src
="./js/tbl_change.js" type
="text/javascript"></script
>
155 // Reloads the navigation frame via JavaScript if required
156 PMA_reloadNavigation();
158 <script src
="./js/tooltip.js" type
="text/javascript"></script
>
159 <meta name
="OBGZip" content
="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
160 <?php
/* remove vertical scroll bar bug in ie */ ?
>
162 <style type
="text/css">
173 <div id
="TooltipContainer" onmouseover
="holdTooltip();" onmouseout
="swapTooltip('default');"></div
>
176 // Include possible custom headers
177 if (file_exists('./config.header.inc.php')) {
178 require './config.header.inc.php';
182 // message of "Cookies required" displayed for auth_type http or config
183 // note: here, the decoration won't work because without cookies,
184 // our standard CSS is not operational
185 if (empty($_COOKIE)) {
186 echo '<div class="notice">' . $GLOBALS['strCookiesRequired'] . '</div>' . "\n";
189 if (!defined('PMA_DISPLAY_HEADING')) {
190 define('PMA_DISPLAY_HEADING', 1);
194 * Display heading if needed. Design can be set in css file.
197 if (PMA_DISPLAY_HEADING
) {
198 $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
199 ?
$GLOBALS['cfg']['Server']['verbose']
200 : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
202 : ':' . $GLOBALS['cfg']['Server']['port']
205 $item = '<a href="%1$s?%2$s" class="item">';
206 if ($GLOBALS['cfg']['NavigationBarIconic']) {
207 $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
208 $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
210 $separator = ' <span class="separator"> - </span>' . "\n";
213 if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
216 $item .= '%3$s</a>' . "\n";
218 echo '<div id="serverinfo">' . "\n";
220 $GLOBALS['cfg']['DefaultTabServer'],
221 PMA_generate_common_url(),
222 htmlspecialchars($server_info),
223 $GLOBALS['strServer'],
226 if (strlen($GLOBALS['db'])) {
230 $GLOBALS['cfg']['DefaultTabDatabase'],
231 PMA_generate_common_url($GLOBALS['db']),
232 htmlspecialchars($GLOBALS['db']),
233 $GLOBALS['strDatabase'],
236 if (strlen($GLOBALS['table'])) {
237 require_once './libraries/tbl_info.inc.php';
241 $GLOBALS['cfg']['DefaultTabTable'],
242 PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
243 str_replace(' ', ' ', htmlspecialchars($GLOBALS['table'])),
244 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ?
$GLOBALS['strView'] : $GLOBALS['strTable']),
245 (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ?
'b_views' : 's_tbl') . '.png');
248 * Displays table comment
249 * @uses $show_comment from libraries/tbl_info.inc.php
250 * @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
252 if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
253 if (strstr($show_comment, '; InnoDB free')) {
254 $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
256 echo '<span class="table_comment" id="span_table_comment">'
257 .'"' . htmlspecialchars($show_comment)
258 .'"</span>' . "\n";
261 // no table selected, display database comment if present
263 * Settings for relations stuff
265 require_once './libraries/relation.lib.php';
266 $cfgRelation = PMA_getRelationsParam();
268 // Get additional information about tables for tooltip is done
269 // in libraries/db_info.inc.php only once
270 if ($cfgRelation['commwork']) {
271 $comment = PMA_getComments($GLOBALS['db']);
274 * Displays table comment
276 if (is_array($comment) && ! empty($comment)) {
277 echo '<span class="table_comment"'
278 .' id="span_table_comment">"'
279 .htmlspecialchars(implode(' ', $comment))
280 .'"</span>' . "\n";
289 * Sets a variable to remember headers have been sent
291 $GLOBALS['is_header_sent'] = true;