From 290bb2d6d776eca20106763f8edac0e45999d147 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 2 Jan 2018 22:23:44 +0000 Subject: [PATCH] www/dbq/dbq.php --- www/dbq/dbq.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index c28a8281..39a9bcb4 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -554,13 +554,14 @@ class DbQ extends nb { return [array_values($title),$nav]; } - public function method_post_accept_decode() { + public function method_post_accept_decode($type=null) { if ( empty($_SERVER['REQUEST_METHOD']) or $_SERVER['REQUEST_METHOD'] != 'POST' ) return; + if (empty($type)) $type = self::client_content_type(); $raw = null; foreach (['json','yaml'] as $type) { - if (!strpos(self::client_content_type(),'/'.$type)) continue; + if (!strpos($type,'/'.$type)) continue; if ($raw) $_POST = [ $type => $raw ]; if (empty($_POST[$type])) continue; #bye($_POST); @@ -578,7 +579,6 @@ class DbQ extends nb { } private function uri_init() { - $this->method_post_accept_decode(); # # Parse path, respect params order @@ -801,8 +801,8 @@ EOF; if ($this->params['format']) { $format = $this->params['format']; - } else if ($content_type = self::client_content_type() and ( $format=Mime::toExt($content_type) )) { - #$format = $format; + } else if ($content_type = self::client_content_type() and ( $format = Mime::toExt($content_type) )) { + # Not empty ! } else { $format = @@ -828,6 +828,7 @@ EOF; // Affect values to objects if ($format == 'html') $format = $this->format_html; $this->format($format); + $this->method_post_accept_decode(); $this->is_html = strpos($content_type,'html') ? true : false; $this->db->is_html = $this->is_html; -- 2.47.3