From: Nicolas Boisselier Date: Wed, 13 Dec 2017 16:05:22 +0000 (+0000) Subject: lib/php/out.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=4c5f12dd944da23916c12eb2fb47ebdc1ee91388;p=nb.git lib/php/out.php --- diff --git a/lib/php/nb.php b/lib/php/nb.php index 847ddfe2..c6a8102c 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -1105,8 +1105,9 @@ class NB { #debug($attributes[$j]); $values = ldap_get_values_len($connect, $entry,$attributes[$j]); unset($values['count']); - if (false) for ($v=0; $v 0 ? true : false); + } + } # < Class NB /* diff --git a/lib/php/out.php b/lib/php/out.php index e93c4288..2a573d22 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -214,9 +214,6 @@ Class Out extends Nb { unset($opt[$k]); } -# NB 05.12.16 if (isset($opt['format'])) self::type($opt['format']); -# NB 05.12.16 unset($opt['format']); - if (self::type() and !empty($data)) return self::rows(self::type(),$data,$head); return parent::__construct($opt); } @@ -446,7 +443,7 @@ Class Out extends Nb { # Transform simple array into hash if (isset($row[0]) and $head) { #bye($conf); - if (is_scalar($row)) $row = array($row); + if (is_scalar($row)) $row = [$row]; $new = array(); $i = 0; foreach ($head as $k => $h) { @@ -457,7 +454,6 @@ Class Out extends Nb { } -# NB 27.09.16 if ($count>0) self::row_end($conf); $count++; self::row($conf,$row); @@ -601,6 +597,10 @@ Class Out extends Nb { $values = []; foreach (array_values($row) as $k=>$v) { + if (self::is_binary($v)) { + $values[] = $v; + break; + } if (!empty($o['quote'])) $v = $o['quote'] . str_replace($o['quote'],$o['quote_escape'].$o['quote'],$v) . $o['quote']; @@ -811,26 +811,4 @@ Class Out extends Nb { } Out::init() ; # < Class /****************************************************************************/ -#die("A NB_EOL B \n"); -if (empty($argv) or count($argv) < 2 or $argv[1] != 'test') return true; -$data = array( - 'name' => 'Name 1', - 'value' => 'Value 1', -); -/* -$data = array( 'a', 'b', 'c' ); -$data = array( - array('a1','b1','c1'), - array('a2','b2','c2'), - array('a3','b3','c3'), -); -$field = array('A','B','C'); -$data = array( - array('a' => 'a1', 'b' => 'b1'), - array('a' => 'a2', 'b' => 'b2'), -); -*/ -#$data = array( array('a'=>'A'), array('b'=>'B'), array('c'=>'C') ); -$field = array(); -$o = self::rows(!empty($argv[2]) ? $argv[2] : 'csv',$data,$field); ?> diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 5be7fd43..c2846726 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -1014,6 +1014,8 @@ EOF; 'filter' => ($this->params['table'] ? $this->params['table'] : ''), 'attrs' => ($this->params['action'] ? explode(',',$this->params['action']) : []), ]); + #echo $rows[0]['jpegPhoto']; exit; + #$rows = [ 'jpegPhoto' => $rows[0]['jpegPhoto'] ]; if ($this->is_html) $rows = $this->array_fill_assoc($rows); $this->page($rows);