]> git.nbdom.net Git - nb.git/commitdiff
dbq fix ext bug
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 20 Dec 2016 10:30:19 +0000 (10:30 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 20 Dec 2016 10:30:19 +0000 (10:30 +0000)
www/dbq/dbq.php

index 16dd16c2889f9e3bafae0fa76ad8eff175cb98c4..7e01fd26cbeb2d10d581f6d0e4b04fda1cda0059 100644 (file)
@@ -91,9 +91,6 @@ class DbQ extends nb {
     parent::__construct($opt);
     if (!$this->params['db']) $this->not_implemented('Db missing');
 
-    // Post defaults values
-    if (empty($this->ext)) $this->ext = $this->params['format'];
-
     //
     // Page
     require_once(NB_ROOT.'/lib/php/page.php');
@@ -143,7 +140,10 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; }
   public function page($obj,$meth=null,$head=[],$fct=null) {
 
     if (empty($this->_nopage)) {
-      $this->init();
+      // Write output
+      $this->page_colors();
+      $this->page->headers_no_cache();
+      $this->page->begin();
     }
 
     #die($obj);
@@ -464,6 +464,9 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; }
 
     }
 
+    // Post defaults values
+    if (empty($this->ext)) $this->ext = $format;
+
     if ($format == 'html') $format = 'table';
     $this->params['format'] = $format;
     $this->db->format = $format;
@@ -472,10 +475,6 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; }
     if (empty($content_type)) $content_type = Mime::fromExt($format=='human' ? 'txt' : $format);
     if ($content_type) $this->page->content_type($content_type);
 
-    // Write output
-    $this->page_colors();
-    $this->page->headers_no_cache();
-    $this->page->begin();
   }
 
   public function run() {
@@ -484,6 +483,7 @@ table.rows th, table.rows td { border-color: '.$this->colors['body-border'].'; }
     # Db Init
     #
     $this->db();
+    $this->init();
 
     #
     # Root actions pre conn