#debug($attributes[$j]);
$values = ldap_get_values_len($connect, $entry,$attributes[$j]);
unset($values['count']);
- if (false) for ($v=0; $v<count($values); $v++) {
- $values[$v] = unpack("H*hex",$values[$v]);
+ if ($attributes[$j] == 'jpegPhoto') for ($v=0; $v<count($values); $v++) {
+ #$values[$v] = unpack("H*hex",$values[$v]);
+ #$values[$v] = base64_decode($values[$v]);
}
#array_pop($values);
if (isset($values) and count($values) == 1) $values = $values[0];
return $date . '.' . $date_array[0];
}
+
+ public static function is_binary($v) {
+ return (preg_match('~[^\x20-\x7E\t\r\n]~', $v) > 0 ? true : false);
+ }
+
} # < Class 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);
}
# 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) {
}
-# NB 27.09.16 if ($count>0) self::row_end($conf);
$count++;
self::row($conf,$row);
$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'];
} 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);
?>
'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);