]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Dec 2017 02:18:15 +0000 (02:18 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Dec 2017 02:18:15 +0000 (02:18 +0000)
www/dbq/dbq.php

index 4eba3434c43528f8bf0c6a3b239526830a38b27d..1b50030fe43b9312efd06398217f7afcb590f834 100644 (file)
@@ -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() {