Fixes for disabling the response
This commit is contained in:
parent
635023c791
commit
07c7b29f48
@ -25,7 +25,6 @@ class PMA_Footer
|
||||
* @var object
|
||||
*/
|
||||
private $_footnotes;
|
||||
|
||||
/**
|
||||
* PMA_Scripts instance
|
||||
*
|
||||
@ -33,7 +32,6 @@ class PMA_Footer
|
||||
* @var object
|
||||
*/
|
||||
private $_scripts;
|
||||
|
||||
/**
|
||||
* Whether we are servicing an ajax request.
|
||||
* We can't simply use $GLOBALS['is_ajax_request']
|
||||
@ -43,6 +41,21 @@ class PMA_Footer
|
||||
* @var bool
|
||||
*/
|
||||
private $_isAjax;
|
||||
/**
|
||||
* Whether to only close the BODY and HTML tags
|
||||
* or also include scripts, footnotes, errors and links
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isMinimal;
|
||||
/**
|
||||
* Whether to display anything
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_isEnabled;
|
||||
|
||||
/**
|
||||
* Cretes a new class instance
|
||||
@ -51,8 +64,10 @@ class PMA_Footer
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_isEnabled = true;
|
||||
$this->_footnotes = new PMA_Footnotes();
|
||||
$this->_scripts = new PMA_Scripts();
|
||||
$this->_isMinimal = false;
|
||||
$this->_addDefaultScripts();
|
||||
}
|
||||
|
||||
@ -241,11 +256,31 @@ class PMA_Footer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->_isEnabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function isAjax($isAjax)
|
||||
{
|
||||
$this->_isAjax = $isAjax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on minimal display mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMinimal()
|
||||
{
|
||||
$this->_isMinimal = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PMA_Footnotes object
|
||||
*
|
||||
@ -264,31 +299,36 @@ class PMA_Footer
|
||||
public function getDisplay()
|
||||
{
|
||||
$retval = '';
|
||||
|
||||
$this->_setHistory();
|
||||
if (! $this->_isAjax) {
|
||||
// Link to itself to replicate windows including frameset
|
||||
if (! isset($GLOBALS['checked_special'])) {
|
||||
$GLOBALS['checked_special'] = false;
|
||||
if ($this->_isEnabled) {
|
||||
if (! $this->_isAjax && ! $this->_isMinimal) {
|
||||
// Link to itself to replicate windows including frameset
|
||||
if (! isset($GLOBALS['checked_special'])) {
|
||||
$GLOBALS['checked_special'] = false;
|
||||
}
|
||||
if (PMA_getenv('SCRIPT_NAME')
|
||||
&& empty($_POST)
|
||||
&& ! $GLOBALS['checked_special']
|
||||
&& ! $this->_isAjax
|
||||
) {
|
||||
$url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
|
||||
$url = PMA_generate_common_url($url_params, 'text', '');
|
||||
$this->_scripts->addCode("
|
||||
// Store current location in hash part
|
||||
// of URL to allow direct bookmarking
|
||||
setURLHash('$url');
|
||||
");
|
||||
$retval .= $this->_getSelfLink($url_params);
|
||||
}
|
||||
$retval .= $this->_getDebugMessage();
|
||||
}
|
||||
if (PMA_getenv('SCRIPT_NAME')
|
||||
&& empty($_POST)
|
||||
&& ! $GLOBALS['checked_special']
|
||||
&& ! $this->_isAjax
|
||||
) {
|
||||
$url_params['target'] = basename(PMA_getenv('SCRIPT_NAME'));
|
||||
$url = PMA_generate_common_url($url_params, 'text', '');
|
||||
$this->_scripts->addCode("
|
||||
// Store current location in hash part
|
||||
// of URL to allow direct bookmarking
|
||||
setURLHash('$url');
|
||||
");
|
||||
$retval .= $this->_getSelfLink($url_params);
|
||||
if (! $this->_isMinimal) {
|
||||
// display Footnotes and error messages even in ajax reqests
|
||||
// FIXME: nootnotes should be sent as JSON
|
||||
$retval .= $this->_footnotes->getDisplay();
|
||||
$retval .= $this->_getErrorMessages();
|
||||
}
|
||||
$retval .= $this->_getDebugMessage();
|
||||
$retval .= $this->_footnotes->getDisplay();
|
||||
$retval .= $this->_getErrorMessages();
|
||||
if (! $this->_isAjax) {
|
||||
if (! $this->_isAjax && ! $this->_isMinimal) {
|
||||
$retval .= $this->_scripts->getDisplay();
|
||||
// Include possible custom footers
|
||||
if (file_exists(CUSTOM_FOOTER_FILE)) {
|
||||
@ -297,8 +337,11 @@ class PMA_Footer
|
||||
$retval .= ob_end_clean();
|
||||
}
|
||||
}
|
||||
$retval .= "</body></html>";
|
||||
if (! $this->_isAjax) {
|
||||
$retval .= "</body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ class PMA_Response
|
||||
|
||||
public static function response()
|
||||
{
|
||||
$response = self::$_instance;
|
||||
$response = PMA_Response::getInstance();
|
||||
$buffer = PMA_OutputBuffering::getInstance();
|
||||
if (empty($response->_content)) {
|
||||
$response->_content = $buffer->getContents();
|
||||
|
||||
@ -66,9 +66,12 @@ class PMA_Scripts
|
||||
*/
|
||||
public function addFile($filename, $conditional_ie = false)
|
||||
{
|
||||
$link = PMA_includeJS($filename, $conditional_ie);
|
||||
if (! in_array($link, $this->_files)) {
|
||||
$this->_files[] = $link;
|
||||
$hash = md5($filename);
|
||||
if (empty($this->_files[$hash])) {
|
||||
$this->_files[$hash] = array(
|
||||
'filename' => $filename,
|
||||
'conditional_ie' => $conditional_ie
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +115,10 @@ class PMA_Scripts
|
||||
$retval = '';
|
||||
|
||||
foreach ($this->_files as $file) {
|
||||
$retval .= $file;
|
||||
$retval .= PMA_includeJS(
|
||||
$file['filename'],
|
||||
$file['conditional_ie']
|
||||
);
|
||||
}
|
||||
$retval .= '<script type="text/javascript">';
|
||||
$retval .= "// <![CDATA[\n";
|
||||
|
||||
@ -84,11 +84,6 @@ if (version_compare(phpversion(), '5.4', 'lt')) {
|
||||
*/
|
||||
define('PHPMYADMIN', true);
|
||||
|
||||
/**
|
||||
* Used to generate the page
|
||||
*/
|
||||
include_once 'libraries/Response.class.php';
|
||||
|
||||
/**
|
||||
* core functions
|
||||
*/
|
||||
@ -134,7 +129,12 @@ require './libraries/Table.class.php';
|
||||
*/
|
||||
require './libraries/Types.class.php';
|
||||
|
||||
if (!defined('PMA_MINIMUM_COMMON')) {
|
||||
if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
/**
|
||||
* Used to generate the page
|
||||
*/
|
||||
include_once 'libraries/Response.class.php';
|
||||
|
||||
/**
|
||||
* common functions
|
||||
*/
|
||||
|
||||
@ -26,9 +26,8 @@ if (!file_exists("./setup/frames/$page.inc.php")) {
|
||||
$action_done = filter_input(INPUT_GET, 'action_done');
|
||||
$action_done = preg_replace('/[^a-z_]/', '', $action_done);
|
||||
|
||||
// send no-cache headers
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getHeader()->sendHttpHeaders();
|
||||
PMA_noCacheHeader();
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user