From 8f19e4662ade4e87b2b163e639d3d77d4ff66c74 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 20 Dec 2016 16:31:10 +0000 Subject: [PATCH] dbq --- lib/php/mime.php | 1 + lib/php/out.php | 5 +++-- src/Docker/nginx/default.conf | 3 ++- www/dbq/dbq.php | 41 +++++++++++++++++++++++++++++++++- www/dbq/etc/nginx/default.conf | 3 ++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/lib/php/mime.php b/lib/php/mime.php index e13183b6..d229e2b3 100644 --- a/lib/php/mime.php +++ b/lib/php/mime.php @@ -412,6 +412,7 @@ class Mime { 'image/x-portable-graymap' => 'pgm', 'application/x-chess-pgn' => 'pgn', 'application/pgp-signature' => 'pgp', +'text/x-php' => 'php', 'image/x-pict' => 'pic', 'application/pkixcmp' => 'pki', 'application/pkix-pkipath' => 'pkipath', diff --git a/lib/php/out.php b/lib/php/out.php index ff81ce9d..468c3500 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -8,7 +8,7 @@ Class Out extends Nb { protected static $type; public static function init() { - self::$types = array( + self::$types = [ 'human' => [ 'sep' => self::p('sep'," | "), @@ -192,8 +192,9 @@ Class Out extends Nb { 'rec' => ',', ), - ); + ]; + #self::$types['html'] = self::$types['table']; self::type(self::client_type()); } diff --git a/src/Docker/nginx/default.conf b/src/Docker/nginx/default.conf index ac59a71a..10aabf51 100644 --- a/src/Docker/nginx/default.conf +++ b/src/Docker/nginx/default.conf @@ -21,7 +21,8 @@ server { client_max_body_size 100m; - location ~ \.php$ { + location ~ /index\.php$ { + #location index.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php:9000; fastcgi_index index.php; diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index d89615cd..ff176027 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -143,6 +143,35 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; } // Write output $this->page_colors(); $this->page->headers_no_cache(); + $this->page->js_code = trim(' +function form_submit_clean(form) { + form_clean(form); + form.submit(); +} +function form_clean(form) { + var e; + for(i=0;ipage->begin(); } @@ -233,14 +262,17 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; } public function table_rows($fct=null) { + if ($this->page->is('html')) { + #debug($this->page->content_type()); + } $opt = ($this->page->is('html') and ($this->perm >= self::VIEW) and $this->table->type() != 'sql' ) ? [ 'buttons' => join(' ',[ '', - #'', '', + '', ]), 'row_parse_pre' => function(&$r){ @@ -471,6 +503,13 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; } if ($format == 'html') $format = 'table'; $this->params['format'] = $format; + $this->db->formats = [ + 'table', + 'csv', + 'json', + 'yaml', + 'sh', + ]; $this->db->format = $format; // Then content type diff --git a/www/dbq/etc/nginx/default.conf b/www/dbq/etc/nginx/default.conf index a30b86a6..fc4db670 100644 --- a/www/dbq/etc/nginx/default.conf +++ b/www/dbq/etc/nginx/default.conf @@ -45,7 +45,8 @@ server { ############################################################### # FastCGI - location ~ \.php$ { + #location ~ \.php$ { + location ~ /index\.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass localhost:9000; fastcgi_pass unix:/var/run/php5-fpm.sock; -- 2.47.3