]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jul 2018 02:32:57 +0000 (03:32 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 20 Jul 2018 02:32:57 +0000 (03:32 +0100)
www/dbq/dbq.php

index ca16854714ae5b53c5d3972539b467a14bd2cfff..de158b03e585be04eba11eae92eb0899c945dae1 100644 (file)
@@ -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) {