openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 1100345e685fe0beb740364a3bbef165d23beef7
parent fe63a49159a92008b159750453f833fdd41f4252
Author: dankert <openrat@jandankert.de>
Date:   Mon,  7 Feb 2022 19:48:06 +0100

New: Support for YAML in request body.

Diffstat:
Mmodules/cms/action/RequestParams.class.php | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/cms/action/RequestParams.class.php b/modules/cms/action/RequestParams.class.php @@ -7,6 +7,7 @@ use util\json\JSON; use util\mail\Mail; use util\Text; use util\XML; +use util\YAML; class RequestParams @@ -62,12 +63,14 @@ class RequestParams $this->parameter = &$_GET; else switch( $contenttype ) { + // These content-types are known by PHP, so we do NOT have to parse them: case 'application/x-www-form-urlencoded': // the most used form url encoding case 'multipart/form-data': // Multipart-Formdata for File uploads case '': $this->parameter = &$_POST; // Using builtin POST data parsing break; + // The request body contains a JSON document case 'text/json': case 'application/json': // parsing the JSON data @@ -79,6 +82,10 @@ class RequestParams $this->parameter = (array)simplexml_load_string(file_get_contents("php://input")); break; + case 'application/yaml': + $this->parameter = YAML::parse(file_get_contents("php://input")); + break; + default: // Unknown content type throw new \LogicException('HTTP-POST with unknown content type: ' . $contenttype);