From cbf708176dd2f3a9976ee40a6b44e095fe554f14 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 20 Jul 2018 03:32:57 +0100 Subject: [PATCH] www/dbq/dbq.php --- www/dbq/dbq.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index ca168547..de158b03 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -703,23 +703,25 @@ class DbQ extends nb { return [array_values($title),$nav]; } - public function method_post_accept_decode($type=null) { + public function method_post_accept_decode($content_type=null) { if ( empty($_SERVER['REQUEST_METHOD']) or $_SERVER['REQUEST_METHOD'] != 'POST' ) return; - if (empty($type)) $type = self::client_content_type(); + if (empty($content_type)) $content_type = self::client_content_type(); $raw = null; + #debug([self::client_header('Accept'),$content_type]); foreach (['json','yaml'] as $type) { - if (!strpos($type,'/'.$type)) continue; - if ($raw) $_POST = [ $type => $raw ]; - if (empty($_POST[$type])) continue; - #bye($_POST); - $post = $_POST; - - unset($post[$type]); + if (!strpos($content_type,'/'.$type)) continue; +# NB 20.07.18 if ($raw) $_POST = [ $type => $raw ]; +# NB 20.07.18 if (empty($_POST[$type])) continue; +# NB 20.07.18 #bye($_POST); +# NB 20.07.18 $post = $_POST; +# NB 20.07.18 +# NB 20.07.18 unset($post[$type]); $fct = $type . '_decode'; - $_POST = array_merge((array)$this->$fct($_POST[$type]),$post); + $_POST = $this->$fct(file_get_contents("php://input")); +# NB 20.07.18 $_POST = array_merge((array)$this->$fct($_POST[$type]),$post); break; } @@ -1190,6 +1192,9 @@ EOF; } elseif ($action == 'conf') { $this->page($this,'conf'); #} elseif ($action == 'html_video') { $this->page($arg); } elseif ($action == 'html_video') { $this->page(Mime::html_video($arg)); + } elseif ($action == '_post') { $this->page($_POST); + } elseif ($action == '_get') { $this->page($_GET); + } elseif ($action == 'types') { $types = []; foreach (array_keys($this->db->out->types()) as $type) { -- 2.47.3