$params = self::params2hash(self::$params);
}
- #debug([$params,array_diff($params,$ignore)]);
-# NB 07.01.18 foreach (array_diff($params,$ignore) as $k=>$v) {
foreach ($params as $k=>$v) {
if (!empty($ignore) and in_array($k,$ignore)) continue;
if (isset($v) or $k=='action') {
$out_conf = array_merge($opt,$out_conf);
# Function name should be format
- $this->db()->out->type($format); self::$params += array_values($this->db()->out->types());
+ $this->db()->out->type($format);
+# NB 20.06.18 Why ?????
+# NB 20.06.18 self::$params += array_values($this->db()->out->types());
if (empty($out_conf['enclose'])) $out_conf['enclose'] = ['',''];
debug('Using out module!',3);
if ($limit !== false) return $limit;
if ($limit = $this->p('limit')) return $limit;
- if ($this->page->is('html')) return ($limit = $this->default_limit);
+ if ($this->is_html) return ($limit = $this->default_limit);
}
$bottom[] = 'Database: '.preg_replace(array_keys($r),$r,$this->db->pdo);
}
- if ($bottom and $this->page->is('html')) echo $this->page->tag('div class="block bottom"',join('<br />'.NB_EOL,$bottom));
+ if ($bottom and $this->is_html) echo $this->page->tag('div class="block bottom"',join('<br />'.NB_EOL,$bottom));
$this->page->end();
}
# NB 11.06.18 return $this->db;
} else {
- // Re use
- if (!empty($this->db)) return $this->db;
- require_once(NB_ROOT.'/lib/php/db.php');
+ // Re use
+ if (!empty($this->db)) return $this->db;
+ require_once(NB_ROOT.'/lib/php/db.php');
- // Load confs
- if (empty($DB_CONFS)) {
- require_once(NB_ROOT.'/lib/php/db/config.php');
- } else {
- #debug($DB_CONFS);
- $DB_CONFS = Db::conf_load($DB_CONFS);
- }
+ // Load confs
+ if (empty($DB_CONFS)) {
+ require_once(NB_ROOT.'/lib/php/db/config.php');
+ } else {
+ #debug($DB_CONFS);
+ $DB_CONFS = Db::conf_load($DB_CONFS);
+ }
- $this->db = new Db(['conf'=>$DB_CONFS]);
+ $this->db = new Db(['conf'=>$DB_CONFS]);
}
+ $this->db->is_html = $this->is_html;
$this->db->html_base = $this->base;
#$this->db->base = ($this->base ? $this->base : '/').$this->db->id;
$this->db->base = $this->base . ($this->db->id ? '/' . $this->db->id : '');
}
private function table_rows($fct=null) {
- $this->db->limit = $this->limit();
$ropt = [
#'html_menu' => empty($this->_nopage),
# NB 07.06.18 'is_html' => empty($this->_nopage),
- 'is_html' => $this->page->is('html'),
+# NB 20.06.18 'is_html' => $this->is_html,
+ 'is_html' => ($this->is_html and empty($this->_nopage)),
];
+ $this->db->is_html = $ropt['is_html'];
+ $this->db->limit = $ropt['is_html'] ? $this->limit() : null;
if (!empty($this->_nopage)) {
$this->table->show_url_sort = false;
}
$this->row_parse_pre();
$this->row_parse_post();
- $opt = ($this->page->is('html')
+ $opt = ($this->is_html
and $this->table_rw()
and empty($this->_nopage)
) ? [
# NB 08.12.17 if ($this->format() == 'tmpl') {
#bye($param);
if (preg_match("/^(.*)\.(tmpl)$/",$this->params['table'],$m)) {
-#bye($this->params['table']);
$this->params['table'] = $m[1];
$param['idtemplate'] = $this->format();
$this->format('template');
-# NB 08.12.17 } else {
-# NB 08.12.17 $this->error("Template id is missing");
-# NB 08.12.17 }
}
if (!in_array($this->params['table'],array_keys($this->db->tables()))) {
$this->table = $this->db->table(array_merge([
'name' => $this->params['table'],
'db' => $this->db,
- 'db' => $this->db,
'show_hidden_params' => true,
'show_buttons' => false,
'show_header' => $this->is_html,
if (empty($this->ext)) $this->ext = $format;
$this->method_post_accept_decode();
$this->is_html = strpos($content_type,'html') ? true : false;
- $this->db->is_html = $this->is_html;
}
public function phpinfo_rows() {
- $txt = $this->page->is('html') ? 0 : 1;
-
- if (0 and !$this->page->is('html')) {
- return $this->page->phpinfo();
- #return $this->page($this->page->phpinfo($txt));
- }
+ $txt = $this->is_html ? 0 : 1;
$rows = [];
$row = [];