Header and Footr output is suppressed if it is an Ajax request

This commit is contained in:
ninadsp
2010-05-26 11:38:58 +05:30
parent 0a417e3c2a
commit 5ab3a60612
2 changed files with 147 additions and 136 deletions

View File

@@ -225,10 +225,16 @@ if (! empty($GLOBALS['cfg']['DBG']['php'])
*/ */
} }
/**
* If we are in an AJAX request, we do not need to generate the closing tags for
* body and html.
*/
if (! $GLOBALS['is_ajax_request']) {
?> ?>
</body> </body>
</html> </html>
<?php <?php
}
/** /**
* Stops the script execution * Stops the script execution
*/ */

View File

@@ -14,161 +14,166 @@ if (! defined('PHPMYADMIN')) {
*/ */
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
if (empty($GLOBALS['is_header_sent'])) { /**
* If this is an Ajax request, we do not need to generate all this output.
*/
if (!$GLOBALS['is_ajax_request']) {
if (empty($GLOBALS['is_header_sent'])) {
/** /**
* Gets a core script and starts output buffering work * Gets a core script and starts output buffering work
*/ */
require_once './libraries/ob.lib.php'; require_once './libraries/ob.lib.php';
PMA_outBufferPre(); PMA_outBufferPre();
// For re-usability, moved http-headers and stylesheets // For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by header.inc.php, // to a seperate file. It can now be included by header.inc.php,
// querywindow.php. // querywindow.php.
require_once './libraries/header_http.inc.php'; require_once './libraries/header_http.inc.php';
require_once './libraries/header_meta_style.inc.php'; require_once './libraries/header_meta_style.inc.php';
require_once './libraries/header_scripts.inc.php'; require_once './libraries/header_scripts.inc.php';
?> ?>
<meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" /> <meta name="OBGZip" content="<?php echo ($GLOBALS['cfg']['OBGzip'] ? 'true' : 'false'); ?>" />
<?php /* remove vertical scroll bar bug in ie */ ?> <?php /* remove vertical scroll bar bug in ie */ ?>
<!--[if IE 6]> <!--[if IE 6]>
<style type="text/css"> <style type="text/css">
/* <![CDATA[ */ /* <![CDATA[ */
html { html {
overflow-y: scroll; overflow-y: scroll;
} }
/* ]]> */ /* ]]> */
</style> </style>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<?php <?php
// Include possible custom headers // Include possible custom headers
if (file_exists(CUSTOM_HEADER_FILE)) { if (file_exists(CUSTOM_HEADER_FILE)) {
require 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();
}
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_ltr.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: '; // 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();
} }
$item .= '%3$s</a>' . "\n";
echo '<div id="serverinfo">' . "\n"; if (!defined('PMA_DISPLAY_HEADING')) {
printf($item, define('PMA_DISPLAY_HEADING', 1);
$GLOBALS['cfg']['DefaultTabServer'], }
PMA_generate_common_url(),
htmlspecialchars($server_info),
__('Server'),
's_host.png');
if (strlen($GLOBALS['db'])) { /**
* Display heading if needed. Design can be set in css file.
*/
echo $separator; if (PMA_DISPLAY_HEADING && $GLOBALS['server'] > 0) {
printf($item, $server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
$GLOBALS['cfg']['DefaultTabDatabase'], ? $GLOBALS['cfg']['Server']['verbose']
PMA_generate_common_url($GLOBALS['db']), : $GLOBALS['cfg']['Server']['host'] . (empty($GLOBALS['cfg']['Server']['port'])
htmlspecialchars($GLOBALS['db']), ? ''
__('Database'), : ':' . $GLOBALS['cfg']['Server']['port']
's_db.png'); )
);
if (isset($GLOBALS['action']) && $GLOBALS['action'] == 'tbl_create.php') { $item = '<a href="%1$s?%2$s" class="item">';
/* We're creating a new table */ if ($GLOBALS['cfg']['NavigationBarIconic']) {
echo $separator; $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n";
printf($item, $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n";
$action,
PMA_generate_common_url($GLOBALS['db']),
__('New table'),
'',
's_tbl.png');
} elseif (strlen($GLOBALS['table'])) {
require_once './libraries/tbl_info.inc.php';
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabTable'],
PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
str_replace(' ', '&nbsp;', 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
* @uses $show_comment from libraries/tbl_info.inc.php
* @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
*/
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">'
.'&quot;' . htmlspecialchars($show_comment)
.'&quot;</span>' . "\n";
} // end if
} else { } else {
// no table selected, display database comment if present $separator = ' <span class="separator"> - </span>' . "\n";
/** }
* Settings for relations stuff
*/ if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) {
require_once './libraries/relation.lib.php'; $item .= '%4$s: ';
$cfgRelation = PMA_getRelationsParam(); }
$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 (isset($GLOBALS['action']) && $GLOBALS['action'] == 'tbl_create.php') {
/* We're creating a new table */
echo $separator;
printf($item,
$action,
PMA_generate_common_url($GLOBALS['db']),
__('New table'),
'',
's_tbl.png');
} elseif (strlen($GLOBALS['table'])) {
require_once './libraries/tbl_info.inc.php';
echo $separator;
printf($item,
$GLOBALS['cfg']['DefaultTabTable'],
PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']),
str_replace(' ', '&nbsp;', 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');
// 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 * Displays table comment
* @uses $show_comment from libraries/tbl_info.inc.php
* @uses $GLOBALS['avoid_show_comment'] from tbl_relation.php
*/ */
if (! empty($comment)) { if (!empty($show_comment) && !isset($GLOBALS['avoid_show_comment'])) {
echo '<span class="table_comment"' if (strstr($show_comment, '; InnoDB free')) {
. ' id="span_table_comment">&quot;' $show_comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
. htmlspecialchars($comment) }
. '&quot;</span>' . "\n"; echo '<span class="table_comment" id="span_table_comment">'
.'&quot;' . htmlspecialchars($show_comment)
.'&quot;</span>' . "\n";
} // end if } // end if
} 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">&quot;'
. htmlspecialchars($comment)
. '&quot;</span>' . "\n";
} // end if
}
} }
} }
} echo '</div>';
echo '</div>';
}
/**
* Sets a variable to remember headers have been sent
*/
$GLOBALS['is_header_sent'] = true;
} }
/** } //end if(!$GLOBALS['is_ajax_request'])
* Sets a variable to remember headers have been sent
*/
$GLOBALS['is_header_sent'] = true;
}
?> ?>