From: Nicolas Boisselier Date: Sat, 7 Sep 2024 08:06:15 +0000 (+0200) Subject: www/dbq/dbq.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=a071695933ad01a1b509c308c24fb3a7b8e50301;p=nb.git www/dbq/dbq.php --- diff --git a/lib/php/db/field.php b/lib/php/db/field.php index 1a10a457..19227577 100644 --- a/lib/php/db/field.php +++ b/lib/php/db/field.php @@ -4,6 +4,7 @@ class field extends nb { private $table; public $name; public $type = 'text'; + # NB 07.09.24 public $mime = 'text/plain'; public $null = true; public $key = 0; public $uniq = 0; diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 68285512..eed585bc 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -1102,8 +1102,10 @@ Class Table extends nb { if ($opt['is_html'] and !$opt['use_out']) { foreach ($row as $k=>$v) { if (!isset($this->extras[$k])) $row[$k] = $this->db()->out->format($v); + # NB 07.09.24 $field=$this->field($k); + # NB 07.09.24 if (!$field) continue; + # NB 07.09.24 $row[$k] = $field->htmlValue($row[$k]); } - } // @@ -1251,8 +1253,6 @@ Class Table extends nb { # Function name should be format $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); diff --git a/lib/php/mime.php b/lib/php/mime.php index d299c084..a2897a3e 100644 --- a/lib/php/mime.php +++ b/lib/php/mime.php @@ -1035,6 +1035,7 @@ class Mime { #return $str .= '|'.$mime; if ($default === null) $default = $str; + # NB 07.09.24 if (preg_match('/<\/\w+/',$default)) return $default; # already html if (strpos($mime,'text/')===0) $default = htmlentities($default); return $default; } diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 88d27af3..43cc94dc 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -603,6 +603,8 @@ class DbQ extends nb { .$hidden .'' ); + # NB 07.09.24 $this->table->add_fields([ 'view' ]); + # NB 07.09.24 $this->table->fields('view')->type = 'html'; if ($this->perm < self::DELETE) return; static $delete = 1; @@ -648,12 +650,18 @@ class DbQ extends nb { return $rm; } - public static function form_hidden($r) { + # NB 07.09.24 public static function form_hidden($r) { + public function form_hidden($r) { $h = ''; #debug($r); foreach ($r as $k => $values) { $values = (array)$values; + + # NB 07.09.24: Now html content field + $field = $this->table->field($k); + if ($field and $field->type == 'html') continue; + $suff = count($values)>1 ? '[]' : ''; foreach ($values as $v) { $h .= '';