From: Nicolas Boisselier Date: Mon, 11 Dec 2017 02:18:15 +0000 (+0000) Subject: www/dbq/dbq.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=b8773de90e6810b5b887ac5b469a6fe16007236e;p=nb.git www/dbq/dbq.php --- diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 4eba3434..1b50030f 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -491,20 +491,32 @@ class DbQ extends nb { } public function method_post_accept() { - if ( !empty($_SERVER['REQUEST_METHOD']) and $_SERVER['REQUEST_METHOD'] == 'POST' ) { - foreach (['json','yaml'] as $type) { - if (empty($_POST[$type]) or !strpos(self::client_content_type(),'/'.$type)) continue; + if ( empty($_SERVER['REQUEST_METHOD']) or $_SERVER['REQUEST_METHOD'] != 'POST' ) return; + #bye($_POST); + $raw = null; +# NB 11.12.17 $keys = array_keys($_POST); +# NB 11.12.17 if (count($keys) == 1 and empty($_POST[$keys[0]])) { +# NB 11.12.17 $raw = $keys[0]; +# NB 11.12.17 bye($raw); +# NB 11.12.17 } + + foreach (['json','yaml'] as $type) { + + if (!strpos(self::client_content_type(),'/'.$type)) continue; + if ($raw) $_POST = [ $type => $raw ]; + if (empty($_POST[$type])) continue; + #bye($_POST); + $post = $_POST; - $post = $_POST; - unset($post[$type]); + unset($post[$type]); - $fct = $type . '_decode'; - $_POST = array_merge((array)$this->$fct($_POST[$type]),$post); + $fct = $type . '_decode'; + $_POST = array_merge((array)$this->$fct($_POST[$type]),$post); - break; - } - #bye($_POST); + break; } + + #bye($_POST); } public function parse_uri() {