]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Dec 2017 01:41:56 +0000 (01:41 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Dec 2017 01:41:56 +0000 (01:41 +0000)
etc/git/hooks/pre-commit
etc/vimrc [new file with mode: 0644]
lib/php/nb.php
www/dbq/dbq.php

index 15e7585db458000098625d668c7cd642c2693c7a..73e94459eed67b633e57f58e11353ceaa6e1e54c 100755 (executable)
@@ -1,9 +1,8 @@
 #!/bin/bash -l
 echo DEBUG: pre-commit $* 1>&2
 #. /etc/profile
-# NB 11.12.17 [ -x www/dbq/update.sh ] && echo www/dbq/update.sh && www/dbq/update.sh
 [ -d www/dbq/ ] && cd www/dbq/ && minify_dir | while read -r f; do
-       echo "$f"
+       echo "Minify $f"
        git add "$f"
 done
 
diff --git a/etc/vimrc b/etc/vimrc
new file mode 100644 (file)
index 0000000..0545cf5
--- /dev/null
+++ b/etc/vimrc
@@ -0,0 +1,23 @@
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" ~/.vimrc
+" ln -s /opt/nb/etc/vimrc ~/.vimrc
+"
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let $VIMHOME = fnamemodify(resolve(fnamemodify(expand('<sfile>'),':p')),':h').'/vim'
+if empty(glob($VIMHOME)) && filereadable(expand('~/.vim'))
+  let $VIMHOME =  resolve(expand('~/.vim'))
+endif
+
+" NB 08.03.17: infinite loop when link on /etc/vim/vimrc.local 
+" NB 08.03.17 if filereadable("/etc/vim/vimrc")
+" NB 08.03.17   source /etc/vim/vimrc
+" NB 08.03.17 endif
+
+if &runtimepath !~ $VIMHOME
+  let &runtimepath = &runtimepath . ',' . $VIMHOME
+endif
+
+for file in split(globpath($VIMHOME . '/source/', '*.vim'), '\n')
+  execute 'source' fnameescape(file)
+endfor
index 6642f78eb0f2facdb70f55ef6c1b9d49779d4b83..6f0963657834faf200d4d3a89984b0c39dca4fc3 100644 (file)
@@ -469,6 +469,7 @@ class NB {
   }
 
   public static function yaml_decode($str) {
+    self::yaml_init();
     return yaml_parse($str);
   }
 
index ca03d8b40a615fb7c17cfb6f2ae424d9ace11222..4eba3434c43528f8bf0c6a3b239526830a38b27d 100644 (file)
@@ -490,7 +490,25 @@ class DbQ extends nb {
                return [array_values($title),$nav];
        }
 
+       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;
+
+                               $post = $_POST;
+                               unset($post[$type]);
+
+                               $fct = $type . '_decode';
+                               $_POST = array_merge((array)$this->$fct($_POST[$type]),$post);
+
+                               break;
+                       }
+                       #bye($_POST);
+               }
+       }
+
        public function parse_uri() {
+               $this->method_post_accept();
                #
                # Parse path, respect params order
                #
@@ -746,7 +764,7 @@ EOF;
                if ( $format == 'json' and isset($_POST['json']) ) {
                        #bye($_POST['json']);
                        #$this->pset($this->json_decode($_POST['json']));
-                       $_POST = $this->json_decode($_POST['json']);
+                       $_POST = $_POST + $this->json_decode($_POST['json']);
                        #bye($this->p());
                }