Improve backward compatibility with AXUpload5 and other third-party AJAX apps

This commit is contained in:
Kijin Sung 2016-01-26 10:32:59 +09:00
parent 8ee5e8c4b0
commit 3a419d586d
5 changed files with 33 additions and 15 deletions

View file

@ -232,6 +232,7 @@ class Context
$this->setRequestMethod('');
$this->_setXmlRpcArgument();
$this->_setJSONRequestArgument();
$this->_setRequestArgument();
$this->_setUploadedArgument();
@ -1386,7 +1387,16 @@ class Context
*/
private function _setJSONRequestArgument()
{
if(count($_POST) || self::getRequestMethod() != 'JSON')
{
return;
}
$params = array();
parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
foreach($params as $key => $val)
{
self::set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
}
}
/**

View file

@ -91,7 +91,10 @@ class DisplayHandler extends Handler
{
if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
{
self::_printJSONHeader();
if(strpos($_SERVER['HTTP_ACCEPT'], 'json') !== false)
{
self::_printJSONHeader();
}
}
else if(Context::getResponseMethod() != 'HTML')
{