The branch, master has been updated
via 67339bab2aa1cc20b0ba0d55d7d6b5feb538607d (commit)
from 60f85e193449f02cb81550be8dc3476d0b04e812 (commit)
- Log -----------------------------------------------------------------
commit 67339bab2aa1cc20b0ba0d55d7d6b5feb538607d
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sat Feb 19 07:49:49 2011 -0500
Current code has problems with Ajax, for example when creating a user.
There are missing headers and this commit is an attempt to fix this
situation.
-----------------------------------------------------------------------
Summary of changes:
libraries/common.lib.php | 14 +++++++++-----
libraries/header.inc.php | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 95aaae6..a4c6a71 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2935,11 +2935,15 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array())
$response = array_merge($response, $extra_data);
}
- // Set the Content-Type header to JSON so that jQuery parses the response correctly
- if(!isset($GLOBALS['is_header_sent'])) {
- header('Cache-Control: no-cache');
- header("Content-Type: application/json");
- }
+ // Set the Content-Type header to JSON so that jQuery parses the
+ // response correctly.
+ //
+ // At this point, other headers might have been sent;
+ // even if $GLOBALS['is_header_sent'] is true,
+ // we have to send these additional headers.
+ header('Cache-Control: no-cache');
+ header("Content-Type: application/json");
+
echo json_encode($response);
exit;
}
diff --git a/libraries/header.inc.php b/libraries/header.inc.php
index 1720e80..807ec0a 100644
--- a/libraries/header.inc.php
+++ b/libraries/header.inc.php
@@ -15,7 +15,7 @@ require_once './libraries/common.inc.php';
/**
- * If this is an Ajax request, we do not need to generate all this output.
+ * This is not an Ajax request so we need to generate all this output.
*/
if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) {
hooks/post-receive
--
phpMyAdmin