]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Aug 2018 21:42:58 +0000 (22:42 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Aug 2018 21:42:58 +0000 (22:42 +0100)
lib/lua/nb.lua
lib/php/db/table.php
lib/php/mime.php

index 41a59edc9dd9e7c6e287e93ce9d50d8f0f2df4b3..175eba1be2484e67ac282efcbb2c547efbe9da6a 100644 (file)
@@ -26,11 +26,11 @@ function nb:ngx_rows(url)
        if not rows then rows = {} end
        
        local count = 0 for _,row in pairs(rows) do count = count+1 end
-       local langs = {}
-       local count = 0 for _,row in pairs(rows) do
+       --local langs = {} langs["eng"] = 1
+       local count = 0
+       for _,row in pairs(rows) do
                count = count + 1
-               local lang = rows.lang
-               --langs[lang] = rows.lang
+               --langs[rows.lang] = 1
        end
 
        return {
index 8a60887a78d5542cd1266ecc3a49cd0253cf61a0..cbfa10a6851b7a5e46c4ec812e736bf052a76708 100644 (file)
@@ -1206,7 +1206,7 @@ Class Table extends nb {
                $opt['use_out'] = false;
 
                if ($this->p('out') or !preg_match('/^('.join('|',
-                       [ '','template','table','sql','_div','wp' ] # local
+                       [ '','template','table','_div','sql','wp' ] # local
                ).')$/',$format))
                {
 
@@ -1296,7 +1296,12 @@ Class Table extends nb {
 
                        foreach ($fields as $f => $field) {
                                if (!$this->field($f)) continue;
+                               #
+                               # Mime content
+                               $row[$f] = $field->htmlValue($row[$f]);
+
                                $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
+
                                $count_fields++;
                        }
 
@@ -1634,9 +1639,6 @@ Class Table extends nb {
                if ($this->buttons() and !empty($buttons[0])) $html .= '<td class="action">'.$buttons[0].'</td>'.NB_EOL;
 
                foreach ($row as $k => $v) {
-                       if ( !empty($this->field($k)) ) {
-                               $v = $this->field($k)->htmlValue($v);
-                       }
                        $html .= '<td'.$this->_rows_table_class($this->field($k)).'>'.$v.'</td>'.NB_EOL;
                }
 
index 3f724045f4229de6408af929d5b529c1a4909338..1650dbeb48536281318386f1d80c594248beb39a 100644 (file)
@@ -831,7 +831,7 @@ class Mime {
 
        }
 
-       public static function html_img_data($str) {
+       private static function html_img_jpeg($str) {
                $v = self::is_base64($str) ? $v : base64_encode($str);
                return '<img src="data:image/jpeg;base64,'.$v.'" />';
        }
@@ -860,7 +860,7 @@ class Mime {
                        },$str) and $str != $v) return $v;
 
                } elseif (preg_match('@^image/@',$mime)) {
-                       return self::html_img_data($str);
+                       return self::html_img_jpeg($str);
 
                }
                #return $str .= '|'.$mime;