]> git.nbdom.net Git - nb.git/commitdiff
a lot
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 20 Nov 2016 04:19:19 +0000 (04:19 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 20 Nov 2016 04:19:19 +0000 (04:19 +0000)
29 files changed:
bin/dbq
etc/dbq.php
etc/dbq/local.php [new file with mode: 0644]
etc/profile.d/docker.sh
etc/profile.d/functions
etc/profile.d/virtualbox.sh [new file with mode: 0644]
etc/vim/source/html.no
etc/vim/source/vars.vim [new file with mode: 0644]
etc/vim/source/vars.vim.bak [new file with mode: 0644]
etc/vim/stats.TODEL/let.g [new file with mode: 0644]
etc/vim/stats.TODEL/let.v [new file with mode: 0644]
etc/vim/stats.TODEL/set.all [new file with mode: 0644]
etc/vim/stats.TODEL/setglob.all [new file with mode: 0644]
etc/vim/stats.TODEL/setloc.all [new file with mode: 0644]
etc/vim/stats/let.g [deleted file]
etc/vim/stats/let.v [deleted file]
etc/vim/stats/set.all [deleted file]
etc/vim/stats/setglob.all [deleted file]
etc/vim/stats/setloc.all [deleted file]
etc/vim/template.html [deleted file]
etc/vim/templates/template.html [new file with mode: 0644]
etc/vimrc
lib/php/config.php
lib/php/db.php
lib/php/db/table.php
lib/php/db/types/sqlite.php
lib/php/out.php
share/db/local.db [new file with mode: 0644]
share/db/update.sh [new file with mode: 0755]

diff --git a/bin/dbq b/bin/dbq
index e7ff28cead4e6eceff97111e2a2162aa8ca9d4ea..d1533afacbab58cd081e8129c7d24c49586ebeec 100755 (executable)
--- a/bin/dbq
+++ b/bin/dbq
@@ -33,23 +33,6 @@ my %PARAM = (
   'rows_head_char' => "\r",
 );
 
-$PARAM{'format'} = 'csv' unless -t STDOUT;
-%PARAM = map {$_=>$PARAM{$_}} grep {$PARAM{$_} ne ''} keys %PARAM;
-
-# DBQ
-if ($ENV{$UC_NAME}) {
-  for (split(' ',$ENV{$UC_NAME})) {
-    /^(\w+)=(.*?)$/ and $PARAM{$1} = $2;
-  }
-}
-
-# DBQ_PARAMS
-if ($ENV{$UC_NAME.'_PARAMS'}) {
-  for (split(' ',$ENV{$UC_NAME.'_PARAMS'})) {
-    /^(\w+)=(.*?)$/ and $PARAM{$1} = $2;
-  }
-}
-
 my %CMD_ALIASE = (
 # NB 09.04.16   'd' => 'db',
 # NB 09.04.16   't' => 'table',
@@ -100,6 +83,27 @@ get_options(\%Opt,\@CURL_OPT);
 #
 #################################################################################
 
+#
+# Params
+#
+$PARAM{'format'} = 'csv' if $Opt{pipe};
+%PARAM = map {$_=>$PARAM{$_}} grep {$PARAM{$_} ne ''} keys %PARAM;
+
+# DBQ
+if ($ENV{$UC_NAME}) {
+  for (split(' ',$ENV{$UC_NAME})) {
+    /^(\w+)=(.*?)$/ and $PARAM{$1} = $2;
+  }
+}
+
+# DBQ_PARAMS
+if ($ENV{$UC_NAME.'_PARAMS'}) {
+  for (split(' ',$ENV{$UC_NAME.'_PARAMS'})) {
+    /^(\w+)=(.*?)$/ and $PARAM{$1} = $2;
+  }
+}
+
+
 #
 # Get URL
 #
@@ -127,7 +131,7 @@ $url =~ m@^ssh://(.*)$@ and $Opt{ssh} = $1;
 
 #exec('ssh',$Opt{ssh},". /etc/profile && $NAME",map{s/"/\\"/g;'"'.$_.'"'} grep {$_ !~ /^(-+ssh|$Opt{ssh})/} @EXEC) if $Opt{ssh};
 exec('ssh',
-  -t STDOUT ? '-t' : '-q',
+  $Opt{pipe} ? '-q' : '-t',
   #'-q',
   $Opt{ssh},
   '/usr/bin/env',
@@ -178,9 +182,6 @@ while (my ($k,$v) = each %PARAM) {
   $keys{$k} = $v;
 }
 
-# NB 19.04.16 use Data::Dumper; die Dumper(\%keys);
-# NB 19.04.16 $keys{table} = $1 if $keys{db} and $keys{db} =~ s/:(.*)$//;
-
 #################################################################################
 #
 # Parser
@@ -369,7 +370,7 @@ sub help {
        close $in;
 
        # Output
-    open(STDOUT,"|perl -pe 's/\.$$//g'".(($ENV{PAGER}||'') eq 'less' ? "|less -FRi" : ""));
+  open(STDOUT,"|perl -pe 's/\.$$//g'".(($ENV{PAGER}||'') eq 'less' ? "|less -FRi" : ""));
        my $opts = {
                -input => $in_file,
                -ouput => \*STDOUT,
@@ -395,7 +396,7 @@ sub version { print "$NAME: version [$VERSION]\n"; exit 0; }
 #------------------------------------------------------------------------------
 sub get_options {
 
-  my $hash = $_[0]; #shift @_;
+  my $Opt = $_[0]; #shift @_;
   my $default = $_[1]; #shift @_;
        use Getopt::Long qw(:config no_ignore_case no_auto_abbrev);
 
@@ -415,13 +416,15 @@ sub get_options {
                $main::_DATA_ .= $_;
        }
 
-       GetOptions($hash,@Opt) || exit -1;
+       GetOptions($Opt,@Opt) || exit -1;
+
+       help() if $Opt->{'help'} or $_[0]{'man'};
+       version() if $Opt->{'version'};
 
-       help() if $hash->{'help'} or $_[0]{'man'};
-       version() if $hash->{'version'};
+       $main::VERBOSE = $VERBOSE = $Opt->{'verbose'} if defined $_[0]{'verbose'};
+       $main::DEBUG = $DEBUG = $Opt->{'debug'} if defined $_[0]{'debug'};
 
-       $main::VERBOSE = $VERBOSE = $hash->{'verbose'} if defined $_[0]{'verbose'};
-       $main::DEBUG = $DEBUG = $hash->{'debug'} if defined $_[0]{'debug'};
+  $Opt{pipe} = -t STDOUT ? 0 : 1 unless defined $Opt{pipe};
 
 }
 
@@ -467,8 +470,15 @@ Quick usage: $NAME [URL|EXEC] [CURL_OPTIONS] [key=value]...
 
 Curl / Php query wrapper
 
+Value understand patterns:
+
+  - *PATTERN*
+  - ~REGEX
+  - ![PATTERN|REGEX]
+
 =head1 OPTIONS
 
+ option[pipe|p!]    Define pipe context output. Default (dynamic)
  option[cut=s]      Parse output to cut, imply format=csv and header=0
  option[ssh=s]      SERVER Run the script on that server
  option[verbose|v+] Verbose mode: increase the verbosity level.
index be2771a0393907ad8bcdba2131eee93a1cf2d3fd..82c0efd2d6f8512a875aade9383daa013c7f032c 100644 (file)
@@ -65,7 +65,7 @@ if (!empty($DIR_SQLITE)) {
 }
 
 #
-# Sqlite all Attach db type=sqlite
+# ALL - Attach all sqlite databases
 #
 #return;
 $DBQ['all'] = [
@@ -106,6 +106,9 @@ foreach ($DBQ as $id => $db) {
 }
 conf_merge($DBQ['nb'],$DBQ['all']);
 
+#
+# Functions
+#
 function conf_merge(&$c1,&$c2) {
 
   // .*
diff --git a/etc/dbq/local.php b/etc/dbq/local.php
new file mode 100644 (file)
index 0000000..bc08c1a
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+#
+# !!! MANDATORY !!!
+#
+if (1) $DBQ = [
+  'local' => [
+    'type' => 'sqlite',
+    'name' => 'local',
+    'host' => nb::ROOT_DIR.'/share/db/local.db',
+  ],
+];
+?>
index 1d84132a738a16c2cf125fb1dbd72e9bb8f5b7a0..edc10081372f17ae75e3b7dc9dad0c23aff3a75b 100644 (file)
@@ -18,9 +18,9 @@ if [ -z "$MYVIMRC" ]; then
 
 fi
 
-docker_machine_shared() {
-  VBoxManage showvminfo "$DOCKER_MACHINE_NAME" | perl -ne "print qq|\$2\t\$1\n| if /^Name: '(.*?)', Host path: '(.*?)'/"
-}
+if which docker-compose > /dev/null; then
+  true
+fi
 
 docker_build() {
   
index cc0b8eea85c1ae9cb98d2c41f8e8333030941bf1..4fabb36bc7955530461122c5ffd3c07de8c55b05 100644 (file)
@@ -634,3 +634,40 @@ find_sort_mtime() {
   # strftime "%a %b %e %H:%M:%S %Y"
 }
 
+shell_functions2sql() {
+  local t="$1"; shift
+  local f
+  (
+  for f in `shell_functions`; do
+    type "$f" || continue
+  done
+  ) | perl -MData::Dumper -e '
+BEGIN{$t=shift @ARGV and print qq|PRAGMA encoding="UTF-8";\n|
+."DROP TABLE IF EXISTS $t;\n"
+."CREATE TABLE $t (name VARCHAR(255) PRIMARY KEY,code BLOB);\n"
+and $t="INSERT INTO $t ";
+$|=1;
+}
+$_=join("",<>);@_=(map{s/^\s*(.*?)\s*$/$1/m;$_}split(/^(.*?) is a function$/m,$_));
+0&&die Dumper(\\@_);
+0&&die Dumper($_[2]);
+$q=chr(39);
+while (@_) {
+  $k=shift @_;
+  next unless $k;
+  $v=shift @_;
+  $v =~ s/$q/$q.$q/ge;
+  print $t.qq|VALUES ($q$k$q,$q$v$q);\n|;
+}
+' "$t"
+}
+
+shell_replace() {
+  perl -ne 'if (/^.{1,3}>SHELL_REPLACE (.*)$/ .. /^.{1,3}<SHELL_REPLACE.*/){
+$i++;
+if    ($i==1) { print; system($1); }
+elsif (/^.{1,3}<SHELL_REPLACE/) { print; }
+} elsif (/^.{1,3}=SHELL_REPLACE (.*)$/) { print; system($1);
+} else {$i=0;print}
+' $@
+}
diff --git a/etc/profile.d/virtualbox.sh b/etc/profile.d/virtualbox.sh
new file mode 100644 (file)
index 0000000..9d221ae
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# etc/profile.d/virtualbox.sh
+#
+
+which VirtualBox > /dev/null || return 0
+
+virtualbox_shared() {
+  local machine="$1"; shift
+  [ -z "$machine" -a -n "$DOCKER_MACHINE_NAME" ] && machine="$DOCKER_MACHINE_NAME"
+  [ -z "$machine" -o "$machine" = '-h' -o "$machine" = '--help' ] && echo "Usage: $FUNCNAME MACHINE_NAME" 1>&2 && return
+  VBoxManage showvminfo "$machine" | perl -ne "print qq|\$2\t\$1\n| if /^Name: '(.*?)', Host path: '(.*?)'/"
+}
+
+virtualbox_add_shared() {
+  local machine="$1"; shift
+  local path="$1"; shift
+  local share="$1"; shift
+  virtualbox_shared "$machine" | grep -q "^$path" && echo "$path: share already exists!'" 1>&2 && return 1
+
+  if virtualbox_shared "$machine" | grep -q "^$path"; then
+    echo "$path: share already exists!'" 1>&2
+  else
+    docker-machine stop "$machine"
+    VBoxManage sharedfolder add "$machine" --name "$share" --hostpath "$path"--automount 2>/dev/null || :
+    docker-machine start "$machine"
+  fi
+
+  eval $(docker-machine env "$machine") && docker-machine ssh "$machine" \
+    'printf "test -e $path || mkdir -p $path\nmount -t vboxsf -o rw,user $share $path\n | sudo tee /mnt/sda1/var/lib/boot2docker/bootlocal.sh && sudo sh /mnt/sda1/var/lib/boot2docker/bootlocal.sh'
+}
index 485cdd383cbc97cef5c35ecb4bddb53ad2536342..314cd89ed21204cdf9097cd89acd8be1155ba230 100644 (file)
@@ -1,6 +1,6 @@
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 "  NB 04.09.06 HTML plugin
-" :let g:html_authorname = 'Nicolas'
+" :let g:html_authorname = 'Nicolas Boisselier'
 " :let g:html_tag_case = 'l'
-" :let g:html_template = '~/.vim/template.html'
+" :let g:html_template = $VIMHOME . '/templates/template.html'
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
diff --git a/etc/vim/source/vars.vim b/etc/vim/source/vars.vim
new file mode 100644 (file)
index 0000000..2358b04
--- /dev/null
@@ -0,0 +1,18 @@
+"
+">SHELL_REPLACE dbq t=mime orderby=id rows.fields=id,cmd_check out=cust cust="@id@ : @cmd_check@" sep=, preff='  \' quote_escape="'" quote="'" open='let mimeCheck = {\n' close='\}\n'
+let mimeCheck = {
+  \'bash' : 'bash -c'
+  \,'erb' : 'sh -c \"cat | erb -x - | ruby -c\" <'
+  \,'html' : 'xmllint --noout --html'
+  \,'json' : 'ruby -rjson -e ''puts JSON.parse(File.read(ARGV[0]))'''
+  \,'perl' : 'perl -c -w'
+  \,'php' : 'php --define error_reporting=22519 --define display_errors=1 --define log_errors=1 --define html_errors=0'
+  \,'puppet' : 'perl -e ''system qq/puppet parser validate $ARGV[0] && puppet-lint --no-selector_inside_resource-check --no-autoloader_layout-check --no-hard_tabs-check --no-80chars-check $ARGV[0]/'''
+  \,'python' : 'python -m py_compile'
+  \,'ruby' : 'ruby -c'
+  \,'sh' : 'sh -c'
+  \,'yaml' : 'ruby -ryaml -e ''puts YAML.load_file(ARGV[0])'''
+\}
+"<SHELL_REPLACE
+"
+" BYE BYE
diff --git a/etc/vim/source/vars.vim.bak b/etc/vim/source/vars.vim.bak
new file mode 100644 (file)
index 0000000..e97adc9
--- /dev/null
@@ -0,0 +1,11 @@
+"
+
+"
+">SHELL_REPLACE dbq t=mime rows.fields=id,cmd_check out=cust cust="@id@ : @cmd_check@" sep=, preff='  \' open='let mimeCheck = {\n' close='\}\n'
+"
+let mimeCheck = {
+\}
+"
+"<SHELL_REPLACE
+"
+" BYE BYE
diff --git a/etc/vim/stats.TODEL/let.g b/etc/vim/stats.TODEL/let.g
new file mode 100644 (file)
index 0000000..9a4caa1
--- /dev/null
@@ -0,0 +1,19 @@
+
+syntax_on             #1
+stats                  /home/nico/.vimrc/stats
+loaded_getscriptPlugin  v32
+loaded_netrwPlugin     v138
+loaded_zipPlugin       v23
+did_load_filetypes    #1
+Debug                  
+loaded_rrhelper       #1
+Cmd                    /home/nico/.vim/vim-shortcurts
+loaded_spellfile_plugin #1
+FilePath               /home/nico/.vim/plugin/functions.vim
+loaded_vimballPlugin   v31
+File                  {}
+DebugMsgs             ['Start 2012-08-10 08:52:45']
+loaded_tarPlugin       v24
+loaded_matchparen     #1
+ft_ignore_pat          \.\(Z\|gz\|bz2\|zip\|tgz\)$
+vimsyn_embed           mpPr
\ No newline at end of file
diff --git a/etc/vim/stats.TODEL/let.v b/etc/vim/stats.TODEL/let.v
new file mode 100644 (file)
index 0000000..c1e2866
--- /dev/null
@@ -0,0 +1,33 @@
+
+v:version             #702
+v:beval_winnr         #0
+v:lnum                #0
+v:scrollstart          function Stats line 3
+v:oldfiles            ['~/.vimrc', '~/.vim/plugin/functions.vim', '/usr/share/vim/vim72/doc/eval.txt', '~/.vim/plugin/abbreviate.vim', '/home/www/nicolas.boisselier/html/begin.inc.php', '~/.vim/vim-shortcurts', '/usr/share/vim/vim72/doc/filetype.txt', '/usr/share/vim/vim72/doc/options.txt', '~/.vim/plugin/map.vim', '/usr/share/vim/vim72/doc/repeat.txt', '~/.vim/plugin/html.no', '~/.vim/plugin/debian.vim', '/home/www/nicolas.boisselier/map', '/usr/share/vim/vim72/doc/map.txt', '/usr/share/vim/vim72/doc/motion.txt', '/usr/share/vim/vim72/doc/syntax.txt', '~/.vim/plugin/nb.vim', '/usr/share/vim/vim72/doc/starting.txt', '/tmp/zaza.vim', '/usr/share/vim/vim72/doc/usr_05.txt', '/usr/share/vim/vim72/doc/various.txt', '/home/etc/vimrc', '~/.vim/sources/nb.vim', '/usr/share/vim/vim72/doc/insert.txt', '/usr/share/vim/vim72/doc/intro.txt', '/home/www/nicolas.boisselier/echo ''zaza''', '/usr/share/vim/vim72/doc/help.txt', '/usr/share/vim/vim72/doc/autocmd.txt', '/usr/share/vim/vim72/doc/message.txt', '/usr/share/vim/vim72/doc/quickfix.txt', '/usr/share/vim/vim72/doc/digraph.txt', '/usr/share/vim/vim72/doc/pi_netrw.txt', '/home/www/nicolas.boisselier/source', '~/tmp/nb.vim', 'html/begin.inc.php', '/home/www/nicolas.boisselier/rd.txt', '/home/www/nicolas.boisselier/redir', '/usr/share/vim/vim72/doc/windows.txt', '/usr/share/vim/vim72/doc/editing.txt', '/home/www/nicolas.boisselier/^Yset shell ?', '/usr/share/vim/vim72/macros/less.sh', '/usr/share/vim/vim72/doc/quickref.txt', '/usr/share/vim/vim72.', '/usr/share/vim/vim72/doc/usr_41.txt', '/usr/share/vim/vim72/doc/visual.txt', '/usr/share/vim/vim72/doc/usr_10.txt', '/usr/share/vim/vim72/doc/cmdline.txt', '~/tmp/nb.so', '/usr/share/vim/vim72/doc/os_unix.txt', '/home/www/nicolas.boisselier/functions', '/usr/share/vim/vim72/doc/change.txt', '`/.vimrc', '/usr/share/vim/vim72/doc/pattern.txt', '/usr/share/vim/vim72/doc/ft_sql.txt', '/usr/share/vim/vim72/doc/gui_w16.txt', '/~.vimrc', '/home/www/nicolas.boisselier/html/begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/index.php', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config.tips', '/home/www/nicolas.boisselier/html/tips/index.php:', '/home/www/nicolas.boisselier/html/body-begin.inc.php', 'html/body-begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config', '/home/bin/gg-contacts', '~/bin/access.pl', '~/Crypt/LOGIN.INI', '/home/bin/nico-fetchmail', '/home/bin/nico-fetchmail.new', '~/tmp/mutt-big-501-24483-42c9b17ca70db858d', '/home/www/izideal/styles/default/css/search/index.php', '/home/www/izideal/styles/default/css/vendors.php', '/home/www/izideal/styles/default/css/css.inc.php', '~/tmp/mutt-big-501-31354-45758b39168f2ca3a', '/home/www/izideal/bin/vendors/NETAFFILIATION/conf-xls.pm', '/home/www/izideal/bin/izi-get-0.0.1', '~/.cvsignore', '~/tmp/mutt-big-501-25281-23994017f6ecb0c47', '/boot/grub/grub.cfg', '/home/www/izideal/share/rkhunter/install_rkhunter.sh', '/home/www/izideal/bin/izi-search-code', '/home/www/izideal/.izirc.functions']
+v:dying               #0
+v:lang                 en_US.UTF-8
+v:count               #0
+v:progname             vim
+v:cmdbang             #0
+v:foldlevel           #0
+v:operator             d
+v:ctype                en_US.UTF-8
+v:prevcount           #0
+v:register             "
+v:mouse_win           #0
+v:count1              #1
+v:foldstart           #0
+v:foldend             #0
+v:profiling           #0
+v:beval_col           #0
+v:errmsg               E121: Undefined variable: s:
+v:beval_lnum          #0
+v:mouse_lnum          #0
+v:insertmode           i
+v:beval_bufnr         #0
+v:shell_error         #0
+v:lc_time              en_US.UTF-8
+v:searchforward       #1
+v:mouse_col           #0
+v:statusmsg            "~/.vim/plugin/functions.vim" 280L, 6861C written
+v:warningmsg           search hit BOTTOM, continuing at TOP
\ No newline at end of file
diff --git a/etc/vim/stats.TODEL/set.all b/etc/vim/stats.TODEL/set.all
new file mode 100644 (file)
index 0000000..1d7d6e6
--- /dev/null
@@ -0,0 +1,88 @@
+
+--- Options ---
+  aleph=224           columns=181         esckeys           noicon                makeprg=make        printfont=courier noshowcmd             taglength=0       novisualbell
+noarabic            nocompatible          eventignore=        iconstring=         matchtime=5         printmbcharset=   noshowfulltag         tagrelative         warn
+  arabicshape         completefunc=     noexpandtab         noignorecase          maxcombine=2        printmbfont=        showmatch           tagstack          noweirdinvert
+noallowrevins       noconfirm           noexrc                iminsert=0          maxfuncdepth=100    prompt              showmode            term=screen.linux   whichwrap=b,s
+noaltkeymap         nocopyindent          fileformat=unix     imsearch=0          maxmapdepth=1000    pumheight=0         showtabline=1     notermbidi            wildchar=<Tab>
+  ambiwidth=single    cpoptions=aABceFs   filetype=vim        includeexpr=        maxmem=4087002      quoteescape=\       sidescroll=0        termencoding=       wildcharm=0
+noautochdir           cscopepathcomp=0  nofkmap             noincsearch           maxmemtot=4087002 noreadonly            sidescrolloff=0   noterse               wildignore=
+  autoindent          cscopeprg=cscope    foldclose=          indentexpr=         menuitems=25        redrawtime=2000   nosmartcase           textauto            wildmenu
+noautoread            cscopequickfix=     foldcolumn=0        indentkeys=         modeline            remap             nosmartindent       notextmode            wildmode=full
+noautowrite         nocscopetag           foldenable        noinfercase           modelines=5         report=2            smarttab            textwidth=0         wildoptions=
+noautowriteall        cscopetagorder=0    foldexpr=0        noinsertmode          modifiable        norevins              softtabstop=0       thesaurus=          window=48
+  background=dark   nocscopeverbose       foldignore=#        isprint=@,161-255 nomodified          norightleft         nospell             notildeop             winheight=1
+  backspace=2       nocursorcolumn        foldlevel=0         joinspaces        nomore                ruler               spellfile=          timeout           nowinfixheight
+nobackup            nocursorline          foldlevelstart=-1   key=                mouse=              rulerformat=        spelllang=en        timeoutlen=1000   nowinfixwidth
+  backupcopy=auto     debug=              foldmethod=manual   keymap=             mousemodel=popup    scroll=23           spellsuggest=best notitle               winminheight=1
+  backupext=~       nodelcombine          foldminlines=1      keymodel=           mousetime=500     noscrollbind        nosplitbelow          titlelen=85         winminwidth=1
+  backupskip=/tmp/*   dictionary=         foldnestmax=20      keywordprg=man    nonumber              scrolljump=1      nosplitright          titlestring=        winwidth=20
+nobinary            nodiff                formatexpr=         langmap=            numberwidth=4       scrolloff=0         startofline       nottimeout            wrap
+nobomb                diffexpr=           formatoptions=tcq   langmenu=           omnifunc=         nosecure              statusline=         ttimeoutlen=-1      wrapmargin=0
+  bufhidden=          diffopt=filler      formatprg=          laststatus=2        operatorfunc=       selectmode=         suffixesadd=        ttybuiltin          wrapscan
+  buflisted         nodigraph             fsync             nolazyredraw        nopaste               shell=/bin/bash     swapfile            ttyfast             write
+  buftype=            display=          nogdefault          nolinebreak           pastetoggle=        shellcmdflag=-c     swapsync=fsync      ttymouse=xterm    nowriteany
+  cdpath=,,           eadirection=both    helpheight=20       lines=49            patchexpr=          shellquote=         switchbuf=          ttyscroll=999       writebackup
+  cedit=^F          noedcompatible        helplang=en       nolisp                patchmode=          shelltemp           synmaxcol=3000      undolevels=1000     writedelay=0
+  charconvert=        encoding=utf-8    nohidden            nolist              nopreserveindent      shellxquote=        syntax=vim          updatecount=200
+nocindent             endofline           history=20          listchars=eol:$     previewheight=12  noshiftround          tabline=            updatetime=4000
+  cinoptions=         equalalways       nohkmap               loadplugins       nopreviewwindow       shiftwidth=3        tabpagemax=10       verbose=0
+  cmdheight=1         equalprg=         nohkmapp              magic               printdevice=      noshortname           tabstop=3           verbosefile=
+  cmdwinheight=7    noerrorbells        nohlsearch            makeef=             printencoding=      showbreak=          tagbsearch          virtualedit=
+  backupdir=.,~/tmp,~/
+  breakat= ^I!@*-+;:,./?
+  casemap=internal,keepascii
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  completeopt=menu,preview
+  define=^\s*#\s*define
+  directory=.,~/tmp,/var/tmp,/tmp
+  errorfile=errors.err
+  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
+  fileencoding=utf-8
+  fileencodings=ucs-bom,utf-8,default,latin1
+  fileformats=unix,dos
+  fillchars=vert:|,fold:-
+  foldmarker={{{,}}}
+  foldopen=block,hor,mark,percent,quickfix,search,tag,undo
+  foldtext=foldtext()
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  grepformat=%f:%l:%m,%f:%l%m,%f  %l%m
+  grepprg=grep -n $* /dev/null
+  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block
+  helpfile=/usr/share/vim/vim72/doc/help.txt
+  highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine
+  include=^\s*#\s*include
+  isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=
+  isident=@,48-57,_,192-255
+  iskeyword=@,48-57,_,192-255
+  lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object
+  matchpairs=(:),{:},[:]
+  maxmempattern=1000
+  mkspellmem=460000,2000,500
+  nrformats=octal,hex
+  paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
+  path=.,/usr/include,,
+  printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error
+  printheader=%<%f%h%m%=Page %N
+  printoptions=paper:letter
+  rightleftcmd=search
+  runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
+  scrollopt=ver,jump
+  sections=SHNHH HUnhsh
+  selection=inclusive
+  sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
+  shellpipe=2>&1| tee
+  shellredir=>%s 2>&1
+  shortmess=filnxtToO
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
+  suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
+  tags=./tags,./TAGS,tags,TAGS
+  titleold=Thanks for flying Vim
+  ttytype=screen.linux
+  viewdir=~/.vim/view
+  viewoptions=folds,options,cursor
+  viminfo='100,<50,s10,h
\ No newline at end of file
diff --git a/etc/vim/stats.TODEL/setglob.all b/etc/vim/stats.TODEL/setglob.all
new file mode 100644 (file)
index 0000000..d92d750
--- /dev/null
@@ -0,0 +1,31 @@
+
+--- Global option values ---
+noarabic              cinoptions=       noexpandtab           foldmethod=manual noinfercase           modifiable        norightleft           spelllang=en        thesaurus=
+  autoindent          completefunc=       fileencoding=       foldminlines=1      key=              nomodified            scroll=0            statusline=       nowinfixheight
+noautoread          nocopyindent          fileformat=unix     foldnestmax=20      keymap=           nonumber            noscrollbind          suffixesadd=      nowinfixwidth
+nobinary            nocursorcolumn        filetype=           formatexpr=         keywordprg=man      numberwidth=4       shiftwidth=3        swapfile            wrap
+nobomb              nocursorline          foldcolumn=0        iminsert=0        nolinebreak           omnifunc=         noshortname           synmaxcol=3000      wrapmargin=0
+  bufhidden=          dictionary=         foldenable          imsearch=0        nolisp              nopreserveindent    nosmartindent         syntax=help
+  buflisted         nodiff                foldexpr=0          includeexpr=      nolist              nopreviewwindow       softtabstop=0       tabstop=3
+  buftype=            endofline           foldignore=#        indentexpr=         makeprg=make        quoteescape=\     nospell             notextmode
+nocindent             equalprg=           foldlevel=0         indentkeys=         modeline          noreadonly            spellfile=          textwidth=0
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  define=^\s*#\s*define
+  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
+  foldmarker={{{,}}}
+  foldtext=foldtext()
+  formatoptions=tcql
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  grepprg=grep -n $* /dev/null
+  include=^\s*#\s*include
+  iskeyword=@,48-57,_,192-255
+  matchpairs=(:),{:},[:]
+  nrformats=octal,hex
+  path=.,/usr/include,,
+  rightleftcmd=search
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
+  tags=./tags,./TAGS,tags,TAGS
\ No newline at end of file
diff --git a/etc/vim/stats.TODEL/setloc.all b/etc/vim/stats.TODEL/setloc.all
new file mode 100644 (file)
index 0000000..fce24f6
--- /dev/null
@@ -0,0 +1,26 @@
+
+--- Local option values ---
+noarabic              completefunc=     noexpandtab           foldnestmax=20    noinfercase         nomodified            scroll=23           suffixesadd=      nowinfixwidth
+  autoindent        nocopyindent          fileformat=unix     formatexpr=         key=              nonumber            noscrollbind          swapfile            wrap
+--autoread          nocursorcolumn        filetype=vim        formatoptions=tcq   keymap=             numberwidth=4       shiftwidth=3        synmaxcol=3000      wrapmargin=0
+nobinary            nocursorline          foldcolumn=0        grepprg=            keywordprg=         omnifunc=         noshortname           syntax=vim
+nobomb                define=             foldenable          iminsert=0        nolinebreak           path=             nosmartindent         tabstop=3
+  bufhidden=          dictionary=         foldexpr=0          imsearch=0        nolisp              nopreserveindent      softtabstop=0       tags=
+  buflisted         nodiff                foldignore=#        include=          nolist              nopreviewwindow     nospell             notextmode
+  buftype=            endofline           foldlevel=0         includeexpr=        makeprg=            quoteescape=\       spellfile=          textwidth=0
+nocindent             equalprg=           foldmethod=manual   indentexpr=         modeline          noreadonly            spelllang=en        thesaurus=
+  cinoptions=         errorformat=        foldminlines=1      indentkeys=         modifiable        norightleft           statusline=       nowinfixheight
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  fileencoding=utf-8
+  foldmarker={{{,}}}
+  foldtext=foldtext()
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  iskeyword=@,48-57,_,192-255
+  matchpairs=(:),{:},[:]
+  nrformats=octal,hex
+  rightleftcmd=search
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
\ No newline at end of file
diff --git a/etc/vim/stats/let.g b/etc/vim/stats/let.g
deleted file mode 100644 (file)
index 9a4caa1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-
-syntax_on             #1
-stats                  /home/nico/.vimrc/stats
-loaded_getscriptPlugin  v32
-loaded_netrwPlugin     v138
-loaded_zipPlugin       v23
-did_load_filetypes    #1
-Debug                  
-loaded_rrhelper       #1
-Cmd                    /home/nico/.vim/vim-shortcurts
-loaded_spellfile_plugin #1
-FilePath               /home/nico/.vim/plugin/functions.vim
-loaded_vimballPlugin   v31
-File                  {}
-DebugMsgs             ['Start 2012-08-10 08:52:45']
-loaded_tarPlugin       v24
-loaded_matchparen     #1
-ft_ignore_pat          \.\(Z\|gz\|bz2\|zip\|tgz\)$
-vimsyn_embed           mpPr
\ No newline at end of file
diff --git a/etc/vim/stats/let.v b/etc/vim/stats/let.v
deleted file mode 100644 (file)
index c1e2866..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-
-v:version             #702
-v:beval_winnr         #0
-v:lnum                #0
-v:scrollstart          function Stats line 3
-v:oldfiles            ['~/.vimrc', '~/.vim/plugin/functions.vim', '/usr/share/vim/vim72/doc/eval.txt', '~/.vim/plugin/abbreviate.vim', '/home/www/nicolas.boisselier/html/begin.inc.php', '~/.vim/vim-shortcurts', '/usr/share/vim/vim72/doc/filetype.txt', '/usr/share/vim/vim72/doc/options.txt', '~/.vim/plugin/map.vim', '/usr/share/vim/vim72/doc/repeat.txt', '~/.vim/plugin/html.no', '~/.vim/plugin/debian.vim', '/home/www/nicolas.boisselier/map', '/usr/share/vim/vim72/doc/map.txt', '/usr/share/vim/vim72/doc/motion.txt', '/usr/share/vim/vim72/doc/syntax.txt', '~/.vim/plugin/nb.vim', '/usr/share/vim/vim72/doc/starting.txt', '/tmp/zaza.vim', '/usr/share/vim/vim72/doc/usr_05.txt', '/usr/share/vim/vim72/doc/various.txt', '/home/etc/vimrc', '~/.vim/sources/nb.vim', '/usr/share/vim/vim72/doc/insert.txt', '/usr/share/vim/vim72/doc/intro.txt', '/home/www/nicolas.boisselier/echo ''zaza''', '/usr/share/vim/vim72/doc/help.txt', '/usr/share/vim/vim72/doc/autocmd.txt', '/usr/share/vim/vim72/doc/message.txt', '/usr/share/vim/vim72/doc/quickfix.txt', '/usr/share/vim/vim72/doc/digraph.txt', '/usr/share/vim/vim72/doc/pi_netrw.txt', '/home/www/nicolas.boisselier/source', '~/tmp/nb.vim', 'html/begin.inc.php', '/home/www/nicolas.boisselier/rd.txt', '/home/www/nicolas.boisselier/redir', '/usr/share/vim/vim72/doc/windows.txt', '/usr/share/vim/vim72/doc/editing.txt', '/home/www/nicolas.boisselier/^Yset shell ?', '/usr/share/vim/vim72/macros/less.sh', '/usr/share/vim/vim72/doc/quickref.txt', '/usr/share/vim/vim72.', '/usr/share/vim/vim72/doc/usr_41.txt', '/usr/share/vim/vim72/doc/visual.txt', '/usr/share/vim/vim72/doc/usr_10.txt', '/usr/share/vim/vim72/doc/cmdline.txt', '~/tmp/nb.so', '/usr/share/vim/vim72/doc/os_unix.txt', '/home/www/nicolas.boisselier/functions', '/usr/share/vim/vim72/doc/change.txt', '`/.vimrc', '/usr/share/vim/vim72/doc/pattern.txt', '/usr/share/vim/vim72/doc/ft_sql.txt', '/usr/share/vim/vim72/doc/gui_w16.txt', '/~.vimrc', '/home/www/nicolas.boisselier/html/begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/index.php', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config.tips', '/home/www/nicolas.boisselier/html/tips/index.php:', '/home/www/nicolas.boisselier/html/body-begin.inc.php', 'html/body-begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config', '/home/bin/gg-contacts', '~/bin/access.pl', '~/Crypt/LOGIN.INI', '/home/bin/nico-fetchmail', '/home/bin/nico-fetchmail.new', '~/tmp/mutt-big-501-24483-42c9b17ca70db858d', '/home/www/izideal/styles/default/css/search/index.php', '/home/www/izideal/styles/default/css/vendors.php', '/home/www/izideal/styles/default/css/css.inc.php', '~/tmp/mutt-big-501-31354-45758b39168f2ca3a', '/home/www/izideal/bin/vendors/NETAFFILIATION/conf-xls.pm', '/home/www/izideal/bin/izi-get-0.0.1', '~/.cvsignore', '~/tmp/mutt-big-501-25281-23994017f6ecb0c47', '/boot/grub/grub.cfg', '/home/www/izideal/share/rkhunter/install_rkhunter.sh', '/home/www/izideal/bin/izi-search-code', '/home/www/izideal/.izirc.functions']
-v:dying               #0
-v:lang                 en_US.UTF-8
-v:count               #0
-v:progname             vim
-v:cmdbang             #0
-v:foldlevel           #0
-v:operator             d
-v:ctype                en_US.UTF-8
-v:prevcount           #0
-v:register             "
-v:mouse_win           #0
-v:count1              #1
-v:foldstart           #0
-v:foldend             #0
-v:profiling           #0
-v:beval_col           #0
-v:errmsg               E121: Undefined variable: s:
-v:beval_lnum          #0
-v:mouse_lnum          #0
-v:insertmode           i
-v:beval_bufnr         #0
-v:shell_error         #0
-v:lc_time              en_US.UTF-8
-v:searchforward       #1
-v:mouse_col           #0
-v:statusmsg            "~/.vim/plugin/functions.vim" 280L, 6861C written
-v:warningmsg           search hit BOTTOM, continuing at TOP
\ No newline at end of file
diff --git a/etc/vim/stats/set.all b/etc/vim/stats/set.all
deleted file mode 100644 (file)
index 1d7d6e6..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-
---- Options ---
-  aleph=224           columns=181         esckeys           noicon                makeprg=make        printfont=courier noshowcmd             taglength=0       novisualbell
-noarabic            nocompatible          eventignore=        iconstring=         matchtime=5         printmbcharset=   noshowfulltag         tagrelative         warn
-  arabicshape         completefunc=     noexpandtab         noignorecase          maxcombine=2        printmbfont=        showmatch           tagstack          noweirdinvert
-noallowrevins       noconfirm           noexrc                iminsert=0          maxfuncdepth=100    prompt              showmode            term=screen.linux   whichwrap=b,s
-noaltkeymap         nocopyindent          fileformat=unix     imsearch=0          maxmapdepth=1000    pumheight=0         showtabline=1     notermbidi            wildchar=<Tab>
-  ambiwidth=single    cpoptions=aABceFs   filetype=vim        includeexpr=        maxmem=4087002      quoteescape=\       sidescroll=0        termencoding=       wildcharm=0
-noautochdir           cscopepathcomp=0  nofkmap             noincsearch           maxmemtot=4087002 noreadonly            sidescrolloff=0   noterse               wildignore=
-  autoindent          cscopeprg=cscope    foldclose=          indentexpr=         menuitems=25        redrawtime=2000   nosmartcase           textauto            wildmenu
-noautoread            cscopequickfix=     foldcolumn=0        indentkeys=         modeline            remap             nosmartindent       notextmode            wildmode=full
-noautowrite         nocscopetag           foldenable        noinfercase           modelines=5         report=2            smarttab            textwidth=0         wildoptions=
-noautowriteall        cscopetagorder=0    foldexpr=0        noinsertmode          modifiable        norevins              softtabstop=0       thesaurus=          window=48
-  background=dark   nocscopeverbose       foldignore=#        isprint=@,161-255 nomodified          norightleft         nospell             notildeop             winheight=1
-  backspace=2       nocursorcolumn        foldlevel=0         joinspaces        nomore                ruler               spellfile=          timeout           nowinfixheight
-nobackup            nocursorline          foldlevelstart=-1   key=                mouse=              rulerformat=        spelllang=en        timeoutlen=1000   nowinfixwidth
-  backupcopy=auto     debug=              foldmethod=manual   keymap=             mousemodel=popup    scroll=23           spellsuggest=best notitle               winminheight=1
-  backupext=~       nodelcombine          foldminlines=1      keymodel=           mousetime=500     noscrollbind        nosplitbelow          titlelen=85         winminwidth=1
-  backupskip=/tmp/*   dictionary=         foldnestmax=20      keywordprg=man    nonumber              scrolljump=1      nosplitright          titlestring=        winwidth=20
-nobinary            nodiff                formatexpr=         langmap=            numberwidth=4       scrolloff=0         startofline       nottimeout            wrap
-nobomb                diffexpr=           formatoptions=tcq   langmenu=           omnifunc=         nosecure              statusline=         ttimeoutlen=-1      wrapmargin=0
-  bufhidden=          diffopt=filler      formatprg=          laststatus=2        operatorfunc=       selectmode=         suffixesadd=        ttybuiltin          wrapscan
-  buflisted         nodigraph             fsync             nolazyredraw        nopaste               shell=/bin/bash     swapfile            ttyfast             write
-  buftype=            display=          nogdefault          nolinebreak           pastetoggle=        shellcmdflag=-c     swapsync=fsync      ttymouse=xterm    nowriteany
-  cdpath=,,           eadirection=both    helpheight=20       lines=49            patchexpr=          shellquote=         switchbuf=          ttyscroll=999       writebackup
-  cedit=^F          noedcompatible        helplang=en       nolisp                patchmode=          shelltemp           synmaxcol=3000      undolevels=1000     writedelay=0
-  charconvert=        encoding=utf-8    nohidden            nolist              nopreserveindent      shellxquote=        syntax=vim          updatecount=200
-nocindent             endofline           history=20          listchars=eol:$     previewheight=12  noshiftround          tabline=            updatetime=4000
-  cinoptions=         equalalways       nohkmap               loadplugins       nopreviewwindow       shiftwidth=3        tabpagemax=10       verbose=0
-  cmdheight=1         equalprg=         nohkmapp              magic               printdevice=      noshortname           tabstop=3           verbosefile=
-  cmdwinheight=7    noerrorbells        nohlsearch            makeef=             printencoding=      showbreak=          tagbsearch          virtualedit=
-  backupdir=.,~/tmp,~/
-  breakat= ^I!@*-+;:,./?
-  casemap=internal,keepascii
-  cinkeys=0{,0},0),:,0#,!^F,o,O,e
-  cinwords=if,else,while,do,for,switch
-  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
-  commentstring=/*%s*/
-  complete=.,w,b,u,t,i
-  completeopt=menu,preview
-  define=^\s*#\s*define
-  directory=.,~/tmp,/var/tmp,/tmp
-  errorfile=errors.err
-  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
-  fileencoding=utf-8
-  fileencodings=ucs-bom,utf-8,default,latin1
-  fileformats=unix,dos
-  fillchars=vert:|,fold:-
-  foldmarker={{{,}}}
-  foldopen=block,hor,mark,percent,quickfix,search,tag,undo
-  foldtext=foldtext()
-  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
-  grepformat=%f:%l:%m,%f:%l%m,%f  %l%m
-  grepprg=grep -n $* /dev/null
-  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block
-  helpfile=/usr/share/vim/vim72/doc/help.txt
-  highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine
-  include=^\s*#\s*include
-  isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=
-  isident=@,48-57,_,192-255
-  iskeyword=@,48-57,_,192-255
-  lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object
-  matchpairs=(:),{:},[:]
-  maxmempattern=1000
-  mkspellmem=460000,2000,500
-  nrformats=octal,hex
-  paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
-  path=.,/usr/include,,
-  printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error
-  printheader=%<%f%h%m%=Page %N
-  printoptions=paper:letter
-  rightleftcmd=search
-  runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
-  scrollopt=ver,jump
-  sections=SHNHH HUnhsh
-  selection=inclusive
-  sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
-  shellpipe=2>&1| tee
-  shellredir=>%s 2>&1
-  shortmess=filnxtToO
-  spellcapcheck=[.?!]\_[\])'"^I ]\+
-  suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
-  tags=./tags,./TAGS,tags,TAGS
-  titleold=Thanks for flying Vim
-  ttytype=screen.linux
-  viewdir=~/.vim/view
-  viewoptions=folds,options,cursor
-  viminfo='100,<50,s10,h
\ No newline at end of file
diff --git a/etc/vim/stats/setglob.all b/etc/vim/stats/setglob.all
deleted file mode 100644 (file)
index d92d750..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-
---- Global option values ---
-noarabic              cinoptions=       noexpandtab           foldmethod=manual noinfercase           modifiable        norightleft           spelllang=en        thesaurus=
-  autoindent          completefunc=       fileencoding=       foldminlines=1      key=              nomodified            scroll=0            statusline=       nowinfixheight
-noautoread          nocopyindent          fileformat=unix     foldnestmax=20      keymap=           nonumber            noscrollbind          suffixesadd=      nowinfixwidth
-nobinary            nocursorcolumn        filetype=           formatexpr=         keywordprg=man      numberwidth=4       shiftwidth=3        swapfile            wrap
-nobomb              nocursorline          foldcolumn=0        iminsert=0        nolinebreak           omnifunc=         noshortname           synmaxcol=3000      wrapmargin=0
-  bufhidden=          dictionary=         foldenable          imsearch=0        nolisp              nopreserveindent    nosmartindent         syntax=help
-  buflisted         nodiff                foldexpr=0          includeexpr=      nolist              nopreviewwindow       softtabstop=0       tabstop=3
-  buftype=            endofline           foldignore=#        indentexpr=         makeprg=make        quoteescape=\     nospell             notextmode
-nocindent             equalprg=           foldlevel=0         indentkeys=         modeline          noreadonly            spellfile=          textwidth=0
-  cinkeys=0{,0},0),:,0#,!^F,o,O,e
-  cinwords=if,else,while,do,for,switch
-  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
-  commentstring=/*%s*/
-  complete=.,w,b,u,t,i
-  define=^\s*#\s*define
-  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
-  foldmarker={{{,}}}
-  foldtext=foldtext()
-  formatoptions=tcql
-  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
-  grepprg=grep -n $* /dev/null
-  include=^\s*#\s*include
-  iskeyword=@,48-57,_,192-255
-  matchpairs=(:),{:},[:]
-  nrformats=octal,hex
-  path=.,/usr/include,,
-  rightleftcmd=search
-  spellcapcheck=[.?!]\_[\])'"^I ]\+
-  tags=./tags,./TAGS,tags,TAGS
\ No newline at end of file
diff --git a/etc/vim/stats/setloc.all b/etc/vim/stats/setloc.all
deleted file mode 100644 (file)
index fce24f6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
---- Local option values ---
-noarabic              completefunc=     noexpandtab           foldnestmax=20    noinfercase         nomodified            scroll=23           suffixesadd=      nowinfixwidth
-  autoindent        nocopyindent          fileformat=unix     formatexpr=         key=              nonumber            noscrollbind          swapfile            wrap
---autoread          nocursorcolumn        filetype=vim        formatoptions=tcq   keymap=             numberwidth=4       shiftwidth=3        synmaxcol=3000      wrapmargin=0
-nobinary            nocursorline          foldcolumn=0        grepprg=            keywordprg=         omnifunc=         noshortname           syntax=vim
-nobomb                define=             foldenable          iminsert=0        nolinebreak           path=             nosmartindent         tabstop=3
-  bufhidden=          dictionary=         foldexpr=0          imsearch=0        nolisp              nopreserveindent      softtabstop=0       tags=
-  buflisted         nodiff                foldignore=#        include=          nolist              nopreviewwindow     nospell             notextmode
-  buftype=            endofline           foldlevel=0         includeexpr=        makeprg=            quoteescape=\       spellfile=          textwidth=0
-nocindent             equalprg=           foldmethod=manual   indentexpr=         modeline          noreadonly            spelllang=en        thesaurus=
-  cinoptions=         errorformat=        foldminlines=1      indentkeys=         modifiable        norightleft           statusline=       nowinfixheight
-  cinkeys=0{,0},0),:,0#,!^F,o,O,e
-  cinwords=if,else,while,do,for,switch
-  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
-  commentstring=/*%s*/
-  complete=.,w,b,u,t,i
-  fileencoding=utf-8
-  foldmarker={{{,}}}
-  foldtext=foldtext()
-  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
-  iskeyword=@,48-57,_,192-255
-  matchpairs=(:),{:},[:]
-  nrformats=octal,hex
-  rightleftcmd=search
-  spellcapcheck=[.?!]\_[\])'"^I ]\+
\ No newline at end of file
diff --git a/etc/vim/template.html b/etc/vim/template.html
deleted file mode 100644 (file)
index 50dd2e2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-       <head>
-               <title></title>
-               <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
-               <meta name="Copyright" content="Copyright (C) %date% %authorname%"/>
-               <meta name="Author" content="%authorname%" />
-               <meta name="Generator" content="vim (Vi IMproved editor; http://www.vim.org/)" />
-       </head>
-       <body>
-       </body>
-</html>
diff --git a/etc/vim/templates/template.html b/etc/vim/templates/template.html
new file mode 100644 (file)
index 0000000..50dd2e2
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+       <head>
+               <title></title>
+               <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+               <meta name="Copyright" content="Copyright (C) %date% %authorname%"/>
+               <meta name="Author" content="%authorname%" />
+               <meta name="Generator" content="vim (Vi IMproved editor; http://www.vim.org/)" />
+       </head>
+       <body>
+       </body>
+</html>
index 084c960ee9092af6b1fda52ed33d37ccb4b41087..48651051e879bbb70ea3081e5c0bc0a76de8af9a 100644 (file)
--- a/etc/vimrc
+++ b/etc/vimrc
@@ -13,16 +13,6 @@ if filereadable("/etc/vim/vimrc")
   source /etc/vim/vimrc
 endif
 
-" a,b,c,d,b,d,f,e,e
-" let $VIMHOME = $HOME.'/.vimZZ'
-" if !isdirectory($VIMHOME) | let $VIMHOME = expand("%:p:h") | endif
-" if !isdirectory($VIMHOME) | let $VIMHOME = '/opt/nb/etc/vim' | endif
-" NB 21.09.16 let $VIMHOME = '/opt/nb/etc/vim'
-" echo expand("%:p:h")
-" runtime! expand("%:p:h") . '/vim/source/*.vim'
-" runtime! $VIMHOME . '/source/*.vim'
-" runtime! 'source/*.vim'
-
 if &runtimepath !~ $VIMHOME
   let &runtimepath = &runtimepath . ',' . $VIMHOME
 endif
index e6e5c9367510485aee4b42e7e2b4ecb6a3d7bd32..d69b87cc602f9aae13b1fd788a97ede9fe32ff82 100644 (file)
@@ -5,29 +5,27 @@
 *
 * lib/php/config.php
 */
-
 #define('NB_EOL','');
 #define('NB_PROD',true);
 require(dirname(__FILE__).'/nb.php');
+
+if (empty($_SERVER['PROD'])) error_reporting(E_ALL | E_STRICT | E_NOTICE);
+
+// Cli
 if (nb::php_cli()) {
   argv2request();
+  ini_set('display_errors', false);
   if (nb::p('txt_errors')) ini_set('html_errors', false);
 }
-
-ini_set('display_errors',
-  empty($_SERVER['PROD'])
-  or nb::php_cli()
-);
-
-if (!ini_get('UTC')) date_default_timezone_set('UTC');
-if (empty($_SERVER['PROD'])) error_reporting(E_ALL | E_STRICT | E_NOTICE);
+// Web
+else {
+  ini_set('display_errors',empty($_SERVER['PROD']));
+  ini_set('html_errors',empty($_SERVER['PROD']));
+}
 
 // Should be done in php.ini for performance
-#bye(date_default_timezone_get());
-#if (!date_default_timezone_get()) date_default_timezone_set('Europe/London');
-#bye(ini_get('date.timezone'));
+if (!ini_get('UTC')) date_default_timezone_set('UTC');
 
-# NB 05.03.16 ini_set('include_path', realpath(dirname(__FILE__).'/../lib').':'.realpath(dirname(__FILE__)).':'.ini_get('include_path'));
 ini_set('include_path',''
        .':'.realpath(dirname(__FILE__))
        .rtrim(':'.ini_get('include_path'),':')
index 6e014d759862dfb13a1cb105ca01f5c83a4c77f3..0766d972376f194bb9159a3cfda5d57d5fb4c605 100644 (file)
@@ -180,22 +180,30 @@ class Db extends nb {
   }
 
        function connect_init() {
+
     if (empty($this->pdo) and $this->type) $this->pdo = $this->type.':';
+    # Extract args from pdo
+    foreach ($this->pdo2h($this->pdo) as $k=>$v) {
+      $this->$k = $v;
+    }
+
     if (empty($this->type)) $this->type = strtolower(preg_replace('/^([^:]+):.*$/','\1',$this->pdo));
     if (!$this->type) return false;
 
     if ($this->conf_type('use_path')) {
+
       if ($p = $this->p('db.host')) $this->host = $p;
       if (empty($this->host)) $this->host = preg_replace('/^\w+:/','',$this->pdo);
+
       # Add file
       if (trim($this->pdo,'pdo:'.$this->type)=='') $this->pdo .= $this->host;
 
     } else {
 
-      # Extract args from pdo
-      foreach ($this->pdo2h($this->pdo) as $k=>$v) {
-        $this->$k = $v;
-      }
+# NB 19.11.16       # Extract args from pdo
+# NB 19.11.16       foreach ($this->pdo2h($this->pdo) as $k=>$v) {
+# NB 19.11.16         $this->$k = $v;
+# NB 19.11.16       }
 
 # NB 26.10.16       if (preg_match_all("/[:;](\w+)=([^;]+)/",$this->pdo,$m,PREG_SET_ORDER)) {
 # NB 26.10.16         foreach ($m as $param) {
@@ -233,14 +241,8 @@ class Db extends nb {
     if (empty($this->row_parse) and $this->conf_type('row_parse')) {
       $this->row_parse = $this->conf_type('row_parse');
     }
-  }
 
-       public function disconnect() {
-    if (empty($this->conn)) return null;
-    #$this->conn->exec('COMMIT');
-    $this->method('disconnect');
-# NB 09.09.16     return $this->conn->close();
-  }
+  } # < if else 'use_path'
 
        public function connect() {
     if (!empty($this->conn)) return false;
@@ -259,9 +261,11 @@ class Db extends nb {
 
     } catch (PDOException $e) {
       $msg = 'Connection failed:';
+
       foreach(['name','host','file'] as $p) {
         if (!empty($this->$p)) $msg .= " $p=".$this->$p;
       }
+
       $msg .= "\n  ".$e->getMessage();
       #throw new Exception($msg, (int)$e->getCode());
       self::bye($msg);
@@ -286,6 +290,13 @@ class Db extends nb {
     return true;
   }
 
+       public function disconnect() {
+    if (empty($this->conn)) return null;
+    #$this->conn->exec('COMMIT');
+    $this->method('disconnect');
+# NB 09.09.16     return $this->conn->close();
+  }
+
   function exec($sql) {
 
     try {
@@ -484,6 +495,9 @@ class Db extends nb {
       $sql = $this->method('tables');
 
       if ($sql and !empty($this->conn)) {
+#bye([">>",$this->tables,$sql]);
+#$sql = "SELECT 'shell_functions','table';";
+#$sql = "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'";
         foreach ($this->conn->query($sql,PDO::FETCH_ASSOC) as $row) {
           $name = current($row);
 
@@ -723,6 +737,21 @@ class Db extends nb {
     return $dbs;
   }
 
+  /**
+  * @copyright NB 19.11.16
+  * Return a db hash to create a new instance from $conf
+  */
+  public static function conf_param_db($id) {
+    if (!isset($id)) $id = self::p('db');
+
+    if (!$id or !preg_match('/^(\w+):(.*)/',$id,$m)) return [];
+    $conf = [$id => []];
+
+    $conf[$id] = $conf[$id] + self::pdo2h($id);
+
+    return $conf;
+  }
+
   /**
   * @copyright NB 12.08.16
   * Return a db hash to create a new instance from $conf
@@ -734,11 +763,15 @@ class Db extends nb {
     # Load databases
     $conf = self::is_hash($conf) ? $conf : self::conf_load($conf);
 
+    /*
+    # NB 19.11.16: TODEL - replaced with conf_param_db 
     # Check db=pdo
     if ($id and preg_match('/^(\w+):(.*)/',$id,$m)) {
       if (empty($conf[$id])) $conf[$id] = [];
       $conf[$id] = $conf[$id] + self::pdo2h($id);
     }
+    */
+    $conf += self::conf_param_db($id);
 
     if (!$conf) return false;
 
@@ -819,17 +852,25 @@ class Db extends nb {
   */
   public static function pdo2h($pdo) {
     $hash = [];
+
     if (preg_match('/^(\w+):(.*)/',$pdo,$m)) {
       $hash['type'] = $m[1];
       $pdo = $m[2];
     }
 
+    # YES - 'use_path' 
     while (preg_match('/^(\w+)=([^;]*)(?:;?)(.*?)$/',$pdo,$m)) {
       if ($m[1] == 'dbname') $m[1] = 'name';
       $hash[$m[1]] = $m[2];
       $pdo = $m[3];
     }
 
+    # NO - 'use_path' 
+    if ($pdo) {
+      $hash['host'] = $pdo;
+      unset($pdo);
+    }
+
     return $hash;
   }
 
@@ -1089,9 +1130,6 @@ class Db extends nb {
     return $return;
   }
 
-  public function fct() {
-  }
-
   public function databases() {
 
     if (!isset($this->databases)) {
index 2656fc756419c4dd15cf4348623a3818917de86d..1cab6d880268efe99d4537a098c1cfc8790268e6 100644 (file)
@@ -744,8 +744,38 @@ Class Table extends nb {
     return true;
   }
 
+  private function rows_parsers(&$row,&$opt=[]) {
+    $parser = isset($opt['parser']) ? $opt['parser'] : true;
+    $call = null;
+
+    if ($parser) $this->db()->table_row_decrypt($this,$row);
+    if ($parser and !empty($this->db()->row_parse)) {
+      $call = $this->db()->row_parse; $call($row);
+    }
+
+    if ($parser and !empty($this->row_parse_pre)) {
+      $call = $this->row_parse_pre; $call($row);
+    }
+
+    if ($opt['is_html'] and !$opt['use_out']) {
+      foreach ($row as $k=>$v) {
+        if (!isset($this->extras[$k])) $row[$k] = out::format($v);
+      }
+
+    }
+
+    if ($parser and !empty($this->row_parse_post)) {
+      $call = $this->row_parse_post; $call($row);
+    }
+
+    return $call;
+  }
+
   public function rows(&$opt=[],$opt_by_val=null) {
 
+    #
+    # Run query
+    #
     $this->create_temporary();
 
     if ($opt_by_val !== null) $opt = $opt_by_val;
@@ -754,39 +784,43 @@ Class Table extends nb {
     if (!$format) bye("Parameter `format` missing!");
 
     list($sql,$where,$limit,$select_count) = $this->rows_sql($opt);
-    $st = $this->db()->conn->prepare($sql);
+    $st = $this->db()->conn->prepare($sql);#,[PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT]);
     $st->execute();
 
+    #
     # Fields
-    $fields = [];
+    #
     if (!DB_TABLE_QUERY_NAME) {
+      $fields = [];
       foreach ($this->db()->fields($st) as $f) { $fields[$f->name] = $f; }
       $this->fields = $fields;
     }
     #debug($fields);
     #bye($this->name);
 
-    if (!isset($opt['is_html'])) $opt['is_html'] = preg_match('/^(table|div)$/',$format)
-      ? ( $this->p('header')!=="0")
-      : false
-    ;
-
-    if ($opt['is_html'] and !$this->p('action') and !$this->p('inc')) {
-      echo $this->html_menu();
-    }
-
-    if ($opt['is_html']) {
-       echo '<div class="results">'.NB_EOL;
-       if (!$this->p('inc')) echo $this->form_hidden();
+    #
+    # Fields filter
+    #
+    $fields = $this->fields();
+    $fields_filter = [];
+    if ($this->p('rows.fields')) {
+      $fields_filter = preg_split('/[^\w_]/',$this->p('rows.fields'));
+      foreach ($fields as $k => $field) {
+        if (!in_array($k,$fields_filter) and !isset($this->extras[$k])) unset($fields[$k]);
+      }
     }
 
+    #
     # Use the module out when format unknow
+    #
     $out_conf = null;
+    $opt['use_out'] = false;
     if ($this->p('out') or !preg_match('/^('.join('|',
       [ 'table','sql','div','wp','_csv','_xml','_json','_yaml' ] # local
     ).')$/',$format))
     {
 
+      $opt['use_out'] = true;
       if (!($out_conf = out::types($format))) $this->bye("Unknow format `$format`");
       out::type($format);
       self::$params += array_values(out::types());
@@ -796,19 +830,42 @@ Class Table extends nb {
 
     }
 
+    #
+    # Html
+    #
+    if (!isset($opt['is_html'])) $opt['is_html'] = preg_match('/^(table|div)$/',$format)
+      ? ( $this->p('header')!=="0")
+      : false
+    ;
+
+    if ($opt['is_html'] and !$this->p('action') and !$this->p('inc')) {
+      echo $this->html_menu();
+    }
+
+    if ($opt['is_html']) {
+       echo '<div class="results">'.NB_EOL;
+       if (!$this->p('inc')) echo $this->form_hidden();
+    }
+
     if ($opt['is_html']) out::type('html');
-    $count = 0;
+
+    #
+    # Rows
+    #
 
     # Parser on/off (default: on)
     if (!isset($opt['parser'])) $opt['parser'] = true;
     $parser = $opt['parser'];
     #bye($parser);
 
+    $count = 0;
     while ($row = $st->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
 
       $count++;
       $call = null;
 
+      $call = $this->rows_parsers($row,$opt);
+      /*
       if ($parser) $this->db()->table_row_decrypt($this,$row);
       if ($parser and !empty($this->db()->row_parse)) {
         $call = $this->db()->row_parse; $call($row);
@@ -828,12 +885,22 @@ Class Table extends nb {
       if ($parser and !empty($this->row_parse_post)) {
         $call = $this->row_parse_post; $call($row);
       }
+      */
 
       #
       # Close previous
       #
 # NB 27.09.16       if ($out_conf and $count !== 1) out::row_end($out_conf);
 
+      #
+      # Fields filter
+      #
+      if ($fields_filter) {
+        foreach (array_keys($row) as $k) {
+          if (!in_array($k,$fields_filter)) unset($row[$k]);
+        }
+      }
+
       #
       # Preffix
       #
@@ -847,20 +914,22 @@ Class Table extends nb {
 
         if ($call) {
           foreach (array_keys($row) as $name) {
-            if (!$this->fields($name)) {
-              $this->fields[$name] = new Field($name);
-              $this->fields[$name]->dyn = true;
-              #$fields[$name] = $this->fields[$name];
+# NB 19.11.16             if (!$this->fields($name)) {
+            if (!isset($fields[$name])) {
+              $fields[$name] = new Field($name);
+              $fields[$name]->dyn = true;
+# NB 19.11.16               $this->fields[$name] = $fields[$name];
             }
           }
         }
 
         if ($out_conf) {
-          out::head($out_conf,array_keys($this->fields()),[$row]);
+# NB 19.11.16           out::head($out_conf,array_keys($this->fields()),[$row]);
+          out::head($out_conf,array_keys($fields),[$row]);
 
         } else {
-          #bye([$this->fields(),$row]);
-          echo $this->{"rows_begin_$format"}($this->fields(),$opt);
+# NB 19.11.16           echo $this->{"rows_begin_$format"}($this->fields(),$opt);
+          echo $this->{"rows_begin_$format"}($fields,$opt);
         }
 
       }
@@ -870,8 +939,11 @@ Class Table extends nb {
       #
       $count_fields = 0;
 
-      foreach ($this->fields() as $f => $field) {
+# NB 19.11.16       foreach ($this->fields() as $f => $field) {
+# NB 19.11.16         $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
+      foreach ($fields as $f => $field) {
         $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
+# NB 19.11.16         $row[$f] = $this->field($f)->out(isset($row[$f]) ? $row[$f] : '');
         $count_fields++;
       }
 
@@ -925,7 +997,8 @@ Class Table extends nb {
     } # < is_html
 
     if ($count === 0 and $this->p('header') === 'force') {
-      echo $this->{"rows_begin_$format"}($this->fields());
+# NB 19.11.16       echo $this->{"rows_begin_$format"}($this->fields());
+      echo $this->{"rows_begin_$format"}($fields);
     }
 
     if ($out_conf) {
@@ -1160,7 +1233,7 @@ Class Table extends nb {
     return $html;
   }
 
-  public function rows_end_table($opt=[]) {
+  public function rows_end_table() {
     $html = '';
     $html .= '</tbody>'.NB_EOL;
     $html .= '</table>'.NB_EOL;
@@ -1198,7 +1271,7 @@ Class Table extends nb {
     return $html;
   }
 
-  public function rows_end_div($opt=[]) {
+  public function rows_end_div() {
     return '</div>'.NB_EOL;
   }
 
index 48d95ac3cfbc738ab13654f04086598589160dcd..5edb1b943d9556900f8ef5de9245d6875919f87d 100644 (file)
@@ -71,7 +71,7 @@ $DB_TYPES['sqlite'] = array (
   $sql = "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'";
 
   $dbs = $Db->databases();
-  if (count($dbs)<2) return $sql;
+  if (count($dbs)<=1) return $sql;
 
   # Handle attach mechnisum
   $all = '';
index 6b76e8a2e0f0d7a27c930908e728fc1f1b5656df..e2ef91eb77e96df514618be4b2cc0602f965e67a 100644 (file)
@@ -20,9 +20,61 @@ Class Out extends Nb {
         'end' => 'out_human_end',
       ],
 
-      'sql' => array(), # Code still in db/table.php !
+      'sql' => [], # Code still in db/table.php !
 
-      'shell' => array(
+      'cust' => [
+        'cust' => self::p('cust',"CHANGE ME"),
+        'at' => self::p('at','@'),
+        'open' => self::p('open',''),
+        'close' => self::p('close',''),
+
+        'quote' => self::p('quote',"'"),
+        'quote_escape' => self::p('quote_escape','\\'),
+
+        'eol' => self::p('eol',"\n"),
+        'sep' => self::p('sep',''),
+        'preff' => self::p('preff',''),
+        'suff' => self::p('suff',''),
+
+        'end' => function($o) { if (isset($o['count']) and $o['close']) echo $o['close']; },
+        'row' => function(&$o,&$r) {
+            static $count=0;
+            if (!$count) {
+              foreach ($o as $k=>$v) {
+                if (is_scalar($v)) $o[$k] = str_replace('\n',"\n",$v);
+              }
+              if ($o['open']) echo $o['open'];
+            }
+            $count++; $o['count'] = $count;
+            echo $o['preff']
+              .($count>1 ? $o['sep'] : '')
+              .preg_replace_callback('/'.$o['at'].'([\w_]+)(?::([-\+]?\d+))?'.$o['at'].'/',function($m) use ($o,$r,$count){
+
+                #bye($m);
+                $k = $m[1];
+                $size = empty($m[2]) ? 0 : (int)$m[2];
+                $v = $r[$k];
+
+                if (!empty($o['quote'])) $v = $o['quote'] .
+                  str_replace($o['quote'],$o['quote_escape'].$o['quote'],$v) . $o['quote']
+                ;
+
+                if ($size) {
+                  $align = $size>0 ? STR_PAD_LEFT : STR_PAD_RIGHT;
+                  $size = abs($size);
+                  if ($count>1) $size -= mb_strlen($o['sep'],out::$charset);
+                  $v = out::mb_str_pad($v, $size, ' ',$align);
+                }
+
+                return $v;
+
+              },$o['cust'])
+              .$o['suff']
+            ;
+        }
+      ],
+
+      'shell' => [
         'preff' => self::p('preff',''),
         'suff' => self::p('suff',''),
         'row' => function(&$o,&$r) {
@@ -33,7 +85,7 @@ Class Out extends Nb {
           }
           if ($line) echo join(' ',$line)."\n";
         }
-      ),
+      ],
 
       'sh' => array(
         'preff' => self::p('preff',""),
diff --git a/share/db/local.db b/share/db/local.db
new file mode 100644 (file)
index 0000000..c138a64
Binary files /dev/null and b/share/db/local.db differ
diff --git a/share/db/update.sh b/share/db/update.sh
new file mode 100755 (executable)
index 0000000..32fec4f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash --login
+set -e
+cd "$(dirname "$0")"
+
+(
+
+cat << EOF
+PRAGMA foreign_keys=OFF;
+BEGIN TRANSACTION;
+EOF
+
+shell_functions2sql shell_function
+
+cat << EOF
+COMMIT;
+EOF
+) | sqlite3 local.db.tmp && mv local.db.tmp local.db
+