mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
allow to process real JSON requests with Content-Type: application/json
so far we always send it encoded as form, which is still supported of cause
This commit is contained in:
parent
c69532e7f0
commit
61577b45b1
9
json.php
9
json.php
@ -7,7 +7,6 @@
|
|||||||
* @package api
|
* @package api
|
||||||
* @subpackage ajax
|
* @subpackage ajax
|
||||||
* @author Andreas Stoeckel <as@stylite.de>
|
* @author Andreas Stoeckel <as@stylite.de>
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
@ -116,7 +115,15 @@ if (isset($_GET['menuaction']))
|
|||||||
$json->isJSONRequest(true); // otherwise exception is not send back to client, as we have not yet called parseRequest()
|
$json->isJSONRequest(true); // otherwise exception is not send back to client, as we have not yet called parseRequest()
|
||||||
throw new Json\Exception\ScriptTags("JSON Data contains script tags. Aborting...");
|
throw new Json\Exception\ScriptTags("JSON Data contains script tags. Aborting...");
|
||||||
}
|
}
|
||||||
|
// check if we have a real json request
|
||||||
|
if (strpos($_SERVER['CONTENT_TYPE'], 'application/json') === 0)
|
||||||
|
{
|
||||||
|
$json->parseRequest($_GET['menuaction'], file_get_contents('php://input'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$json->parseRequest($_GET['menuaction'], $_REQUEST['json_data']);
|
$json->parseRequest($_GET['menuaction'], $_REQUEST['json_data']);
|
||||||
|
}
|
||||||
Json\Response::get();
|
Json\Response::get();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user