mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 04:52:14 +09:00
parent
eb17819ce0
commit
07dc7a2311
1 changed files with 42 additions and 29 deletions
|
|
@ -1144,13 +1144,20 @@ class Context
|
||||||
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
|
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pretend that this request is XMLRPC for compatibility with XE third-party.
|
||||||
|
if(isset($_POST['_rx_ajax_compat']) && $_POST['_rx_ajax_compat'] === 'XMLRPC')
|
||||||
|
{
|
||||||
|
self::$_instance->request_method = 'XMLRPC';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check JSON
|
// Check JSON
|
||||||
foreach(array($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_CONTENT_TYPE'], $_SERVER['CONTENT_TYPE']) as $header)
|
foreach(array($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_CONTENT_TYPE'], $_SERVER['CONTENT_TYPE']) as $header)
|
||||||
{
|
{
|
||||||
if(strpos($header, 'json') !== false)
|
if(strpos($header, 'json') !== false)
|
||||||
{
|
{
|
||||||
self::$_instance->request_method = 'JSON';
|
self::$_instance->request_method = 'JSON';
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1158,11 +1165,7 @@ class Context
|
||||||
if(!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
if(!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||||
{
|
{
|
||||||
self::$_instance->request_method = 'XMLRPC';
|
self::$_instance->request_method = 'XMLRPC';
|
||||||
}
|
return;
|
||||||
// Pretend that this request is XMLRPC for compatibility with XE third-party.
|
|
||||||
elseif (isset($_POST['_rx_ajax_compat']) && $_POST['_rx_ajax_compat'] === 'XMLRPC')
|
|
||||||
{
|
|
||||||
self::$_instance->request_method = 'XMLRPC';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1197,13 +1200,11 @@ class Context
|
||||||
self::set($key, $val, $set_to_vars);
|
self::set($key, $val, $set_to_vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set XMLRPC request parameters (Deprecated).
|
// Set deprecated request parameters.
|
||||||
|
if(!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||||
|
{
|
||||||
if(self::getRequestMethod() === 'XMLRPC')
|
if(self::getRequestMethod() === 'XMLRPC')
|
||||||
{
|
{
|
||||||
if($_POST || empty($GLOBALS['HTTP_RAW_POST_DATA']))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!Rhymix\Framework\Security::checkXEE($GLOBALS['HTTP_RAW_POST_DATA']))
|
if(!Rhymix\Framework\Security::checkXEE($GLOBALS['HTTP_RAW_POST_DATA']))
|
||||||
{
|
{
|
||||||
header("HTTP/1.0 400 Bad Request");
|
header("HTTP/1.0 400 Bad Request");
|
||||||
|
|
@ -1225,6 +1226,18 @@ class Context
|
||||||
self::set($key, $val, true);
|
self::set($key, $val, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif(self::getRequestMethod() === 'JSON')
|
||||||
|
{
|
||||||
|
$params = array();
|
||||||
|
parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
|
||||||
|
foreach($params as $key => $val)
|
||||||
|
{
|
||||||
|
$key = escape($key);
|
||||||
|
$val = self::_filterRequestVar($key, $val);
|
||||||
|
self::set($key, $val, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue