From: Nicolas Boisselier Date: Sat, 3 Sep 2016 02:42:03 +0000 (+0100) Subject: Bed X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=76373490052b10a36a6c2ac30fa612dce28a3a84;p=nb.git Bed --- diff --git a/etc/dbs.php b/etc/dbs.php index 11a7c7e7..7fc09237 100644 --- a/etc/dbs.php +++ b/etc/dbs.php @@ -22,6 +22,12 @@ if ($DIR_SQLITE) $DIR_SQLITE .= '/var/lib/sqlite'; # Includes $dir = dirname(__FILE__).'/dbs'; +#debug(nb::ls_dir($dir,'\.php$')); +foreach (nb::ls_dir($dir,'\.php$') as $file) { + require_once("$dir/$file"); + #if (file_exists("$dir/$file.php")) echo("$dir/$file.php\n"); +} +return; foreach (array( 'postfix', 'nb', @@ -31,6 +37,7 @@ foreach (array( 'wp', ) as $file) { if (file_exists("$dir/$file.php")) require_once("$dir/$file.php"); + #if (file_exists("$dir/$file.php")) echo("$dir/$file.php\n"); } ?> diff --git a/etc/dbs/nb.php b/etc/dbs/nb.php index e3a442d9..50bdbad5 100644 --- a/etc/dbs/nb.php +++ b/etc/dbs/nb.php @@ -6,17 +6,129 @@ $CONF['nb'] = array( 'name' => 'nb', #'order' => ($LOCAL_DB ? null : 1), 'order' => 1, - '_import' => array('_rent','_nico'), + '_import' => array('_nb','_nico'), ); $CONF['nb-sqlite'] = array ( 'host' => "$DIR_SQLITE/nb.db", 'type' => 'sqlite', - '_import' => '_rent', + '_import' => '_nb', ); if ($LOCAL_DB and !empty($CONF['nb-sqlite'])) { $CONF['nb-sqlite']['order'] = isset($CONF['nb']['order']) ? $CONF['nb']['order'] : 1; unset($CONF['nb']['order']); } +/***************************************************************************** +*****************************************************************************/ +#die(print_r(posix_getpwnam('nico'),true)); +#die(print_r(posix_getpwuid(posix_getuid()),true)); +#die(print_r(pathinfo('~/.gitconfig'),true)); +#die(file_exists(realpath('~/.gitconfig')) ? 'yes' : 'no'); +$CONF['_nb'] = array( + 'title' => 'Nb', + 'notice' => 'Micro foncier 4BE', + 'default_table' => 'rent', + + 'tables' => array( + + 'agency' => [ 'row_parse_post' => function(&$r) { return rent_doc('agency',$r); }, ], + + 'place' => array( + #'replace' => [ 'id' => 'addr.addr' ], + 'row_parse_post' => 'place_doc', + ), + + 'tenant' => array( + 'row_parse_post' => 'tenant_doc', + ), + + 'test' => array( + 'sql' => "SELECT 'Test sql table'", + ), + + 'rent' => array( + 'orderby' => 'start desc, end desc', + #'replace' => [ 'idtenant' => 'tenant.name', 'idplace' => 'addr.addr' ], + + 'row_parse_pre' => function(&$r) { + $r['month'] = $r['rent'] + $r['charge']; + + $start_month = date('m',strtotime($r['start'])); + $end_month = date('m',strtotime($r['end'])); + if (date('Y',strtotime($r['end'])) > date('Y',strtotime($r['start']))) $end_month = 12; + $r['months'] = (1 + $end_month - $start_month); + + $r['total'] = sprintf('%d',$r['rent'] * $r['months']); + }, + + 'row_parse_post' => ((empty($GLOBALS['Db']) or Db::php_cli()) ? null : function(&$r) { + static $templates; + if (!isset($templates)) { + $templates = $GLOBALS['Db']->rows("SELECT id FROM template",PDO::FETCH_NUM); + foreach ($templates as $k=>$t) { + $templates[$k] = ''.preg_replace('/\.\w+$/','',$t[0]).''; + } + } + + tenant_doc($r); + $revision = ''; + foreach ($templates as $t) { + $revision .= preg_replace_callback('/:(\w+)/',function($m) use(&$r) {return $r[$m[1]];},$t).' '; + } + $r['doc'] = preg_replace('@^(?:]+>)?(.*?)(?:)?$@','
'.trim($revision).'\1
',$r['doc']); + + }), + ), + + ), +); + +return 1; + +function tenant_doc(&$r) { return rent_doc('tenant',$r); } +function place_doc(&$r) { return rent_doc('place',$r); } + +function rent_doc($table,&$r) { + if (empty($_SERVER['DOCUMENT_ROOT'])) return; + + #if (!empty($r['end']) and date('Ymd') > $r['end']) return $r['doc'] = isset($r['doc']) ? $r['doc'] : ''; + + $url = ''; + foreach (['id'.$table,'id'] as $k) { + if (isset($r[$k])) { + $url = '/data/'.$table.'/'.$r[$k]; + break; + } + } + if (!$url) return; + + if (!isset($r['doc'])) $r['doc'] = ''; +#debug($_SERVER['DOCUMENT_ROOT'].$url); + if ( + + # Web url + ( + empty($r['doc']) and file_exists( $dir = $_SERVER['DOCUMENT_ROOT'].$url ) + ) + + # Absolute path + or ( + ( $dir = nb::untilde($r['doc']) ) + and file_exists($dir) and is_dir($dir) + and ($url='' or 1) + ) + + ) { + + foreach (ls_dir($dir,true) as $p) { + $r['doc'] .= sprintf('%s ',"$url/$p", + nb::prettyText(preg_replace('@^.*?([^/\.]+).*?$@','\1',$p)) + ); + } + + } + + if (!empty($r['doc'])) $r['doc'] = '
'.$r['doc'].'
'; +} ?> diff --git a/etc/dbs/owncloud.php b/etc/dbs/owncloud.php index d36d8f85..0fdb37f2 100644 --- a/etc/dbs/owncloud.php +++ b/etc/dbs/owncloud.php @@ -1,7 +1,16 @@ '/home/owncloud/data/owncloud.db', + 'host' => "$DIR_SQLITE/owncloud.db", 'type' => 'sqlite', 'default_table' => 'oc_users', + 'default_table' => 'last_files', + 'tables' => [ + 'last_files' => [ + 'sql' => "SELECT path,mtime FROM oc_filecache WHERE path NOT LIKE 'files_versions/%' ORDER BY fileid DESC LIMIT 10", + 'row_parse_pre' => function(&$r) { + $r['mtime'] = date ("Y-m-d H:i:s",$r['mtime']); + } + ], + ], ]; ?> diff --git a/etc/dbs/rent.php b/etc/dbs/rent.php deleted file mode 100644 index b3c09644..00000000 --- a/etc/dbs/rent.php +++ /dev/null @@ -1,113 +0,0 @@ - 'Rent', - 'notice' => 'Micro foncier 4BE', - 'default_table' => 'rent', - - 'tables' => array( - - 'agency' => [ 'row_parse_post' => function(&$r) { return rent_doc('agency',$r); }, ], - - 'place' => array( - #'replace' => [ 'id' => 'addr.addr' ], - 'row_parse_post' => 'place_doc', - ), - - 'tenant' => array( - 'row_parse_post' => 'tenant_doc', - ), - - 'test' => array( - 'sql' => "SELECT 'Test sql table'", - ), - - 'rent' => array( - 'orderby' => 'start desc, end desc', - #'replace' => [ 'idtenant' => 'tenant.name', 'idplace' => 'addr.addr' ], - - 'row_parse_pre' => function(&$r) { - $r['month'] = $r['rent'] + $r['charge']; - - $start_month = date('m',strtotime($r['start'])); - $end_month = date('m',strtotime($r['end'])); - if (date('Y',strtotime($r['end'])) > date('Y',strtotime($r['start']))) $end_month = 12; - $r['months'] = (1 + $end_month - $start_month); - - $r['total'] = sprintf('%d',$r['rent'] * $r['months']); - }, - - 'row_parse_post' => ((empty($GLOBALS['Db']) or Db::php_cli()) ? null : function(&$r) { - static $templates; - if (!isset($templates)) { - $templates = $GLOBALS['Db']->rows("SELECT id FROM template",PDO::FETCH_NUM); - foreach ($templates as $k=>$t) { - $templates[$k] = ''.preg_replace('/\.\w+$/','',$t[0]).''; - } - } - - tenant_doc($r); - $revision = ''; - foreach ($templates as $t) { - $revision .= preg_replace_callback('/:(\w+)/',function($m) use(&$r) {return $r[$m[1]];},$t).' '; - } - $r['doc'] = preg_replace('@^(?:]+>)?(.*?)(?:)?$@','
'.trim($revision).'\1
',$r['doc']); - - }), - ), - - ), -); - -return 1; - -function tenant_doc(&$r) { return rent_doc('tenant',$r); } -function place_doc(&$r) { return rent_doc('place',$r); } - -function rent_doc($table,&$r) { - if (empty($_SERVER['DOCUMENT_ROOT'])) return; - - #if (!empty($r['end']) and date('Ymd') > $r['end']) return $r['doc'] = isset($r['doc']) ? $r['doc'] : ''; - - $url = ''; - foreach (['id'.$table,'id'] as $k) { - if (isset($r[$k])) { - $url = '/data/'.$table.'/'.$r[$k]; - break; - } - } - if (!$url) return; - - if (!isset($r['doc'])) $r['doc'] = ''; -#debug($_SERVER['DOCUMENT_ROOT'].$url); - if ( - - # Web url - ( - empty($r['doc']) and file_exists( $dir = $_SERVER['DOCUMENT_ROOT'].$url ) - ) - - # Absolute path - or ( - ( $dir = nb::untilde($r['doc']) ) - and file_exists($dir) and is_dir($dir) - and ($url='' or 1) - ) - - ) { - - foreach (ls_dir($dir,true) as $p) { - $r['doc'] .= sprintf('%s ',"$url/$p", - nb::prettyText(preg_replace('@^.*?([^/\.]+).*?$@','\1',$p)) - ); - } - - } - - if (!empty($r['doc'])) $r['doc'] = '
'.$r['doc'].'
'; -} - -?> diff --git a/lib/php/db.php b/lib/php/db.php index bfec2396..e1b9a5e6 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -10,7 +10,7 @@ require_once(realpath(dirname(__FILE__).'/nb.php')); require_once(realpath(dirname(__FILE__).'/out.php')); require_once(realpath(dirname(__FILE__).'/db/table.php')); require_once(realpath(dirname(__FILE__).'/db/field.php')); -$DB_TYPES = array(); # See db/types/*.php +$DB_TYPES = []; # See db/types/*.php #$arr = ['rent'=>'Rent','nb'=>'Nb']; #if (!empty($argv) and $argv[1] == 'zaza') bye($arr); @@ -44,23 +44,17 @@ class Db extends nb { function __construct($opt = '') { - # Args - if ($opt==='') $opt = array(); - $opt = is_scalar($opt) ? array('pdo' => $opt) : $opt; + # Args defaults + if ($opt==='') $opt = []; + $opt = is_scalar($opt) ? ['pdo' => $opt] : $opt; - # Tables - We dont want to affect $this + # Tables if (isset($opt['tables'])) { foreach ($opt['tables'] as $name=>$param) $this->table($name,$param); unset($opt['tables']); } - # Statics - #$this->type = null; - if (isset($opt['Ztype'])) { - $this->type = $opt['type']; - unset($opt['type']); - } - # Args + # Args into this foreach ($opt as $k=>$v) $this->$k = $v; # id @@ -151,10 +145,6 @@ class Db extends nb { if (!$this->type(null)) $this->bye("Unknow type = `".$this->type."`"); # Connect - if ($this->type('use_path') and ($this->host!=':memory:') and !is_readable($this->host)) { - $this->bye("Can't read database path `".$this->host."` type=`".$this->type."`",false); - } - try { $this->conn = new PDO($this->pdo,$this->user,$this->password,$this->options); #$this->conn = new PDO($this->pdo,$this->user,$this->password,$this->pdo_error); @@ -272,10 +262,15 @@ class Db extends nb { * @author NB 12.08.16 * Return a table instance */ - public function table($name,$params=array()) { - if (!array_key_exists($name,$this->tables)) $this->tables[$name] = new Table($name,['db'=>$this]+$params); - elseif ($params) $this->tables[$name]->__construct($name,$params); + public function table($name,$params=[]) { + #if (!array_key_exists($name,$this->tables)) { + if (empty($this->tables[$name])) { + $this->tables[$name] = new Table($name,['db'=>$this]+$params); + } elseif ($params) { + $this->tables[$name]->__construct($name,$params); + } + #if (empty($this->tables[$name]->type)) debug($this->tables[$name]); return $this->tables[$name]; } @@ -285,9 +280,9 @@ class Db extends nb { $config[1] = str_replace('',($name ? $name : $this->name),$config[1]); - if (!file_exists($config[0])) return array(); + if (!file_exists($config[0])) return []; - $return = array(); + $return = []; foreach (explode("\n",file_get_contents($config[0])) as $line) { #bye($line); if (!preg_match('/'.($config[1]).'/',$line,$m)) continue; @@ -314,13 +309,19 @@ class Db extends nb { return str_replace(array_keys($replace),array_values($replace),$value); } + public function info($key=null,$die=false,$type=null) { + $info = $this->type($key,$die,$type); + if (is_callable($info)) return $info($this); + return $this->unvar($info); + } + public function type($key=null,$die=false,$type=null) { global $DB_TYPES; if (!$type) $type = $this->type; if ($key == 'type') return $type; # Load php file - static $require = array(); + static $require = []; if (empty($require[$type])) { if (empty($type)) self::bye('Db::$type is required'); require_once(dirname(__FILE__).'/db/types/'.$type.'.php'); @@ -367,6 +368,7 @@ class Db extends nb { if (is_callable($sql)) $sql = $sql($this); foreach ($this->conn->query($sql,PDO::FETCH_ASSOC) as $row) { + #debug($row); $name = current($row); $this->table($name,$row); } @@ -396,7 +398,7 @@ class Db extends nb { return '"'.$value.'"'; } - public function out($rows,$head=array()) { + public function out($rows,$head=[]) { out::rows($this->p('format',out::php_cli() ? 'csv' : 'table'),$rows,$head); return true; } @@ -419,7 +421,7 @@ class Db extends nb { ]; $actions = explode(',',$action); $this->pdef('format',($this->php_cli() ? 'csv' : '')); - $rows = array(); + $rows = []; $return = false; foreach($actions as $action) { @@ -476,12 +478,12 @@ class Db extends nb { * @param [FILES] $files Files to load * @return ARRAY the new/existing value of $this->db */ - public static function conf_dbs($files=array(),&$first=false) { - if (empty($files)) return array(); + public static function conf_dbs($files=[],&$first=false) { + if (empty($files)) return []; # Load all files into a $h if #files is not a hash - $h = array(); + $h = []; if (is_scalar($files)) $files = array($files); foreach ($files as $file) { @@ -755,7 +757,7 @@ class Db extends nb { public function status() { - $status = $new = array(); + $status = $new = []; $new = [] #+( empty($this->id) ? [] : ['id' => $this->id]) @@ -768,7 +770,7 @@ class Db extends nb { #'conf' => count(array_keys($this->conf)), 'tables' => count($this->tables()), ] - +($this->type('use_path') ? array() : array( + +($this->type('use_path') ? [] : array( 'port' => $this->port, 'user' => $this->user, )) @@ -812,7 +814,7 @@ class Db extends nb { public function fields($st) { # See: http://php.net/manual/en/pdostatement.getcolumnmeta.php - $fields = array(); + $fields = []; #debug($st->columnCount()); #debug($st->getColumnMeta(0)); diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 03038b0b..32de0541 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -146,7 +146,7 @@ Class Table extends nb { if ($from_sql) return $sql_replace($this->sql()); - if ($this->type == 'view') { + if ($this->type() == 'view') { return $sql_replace('CREATE VIEW '.$this->sql_name().' AS SELECT'.preg_replace('/^CREATE\s+.*?\s+AS\s+.*?SELECT/i','',$this->sql())); } @@ -164,7 +164,7 @@ Class Table extends nb { ; }; - $sql = 'CREATE '.strtoupper($this->type).' '.$this->sql_name() + $sql = 'CREATE '.strtoupper($this->type()).' '.$this->sql_name() .' (' .join(",",array_map(function($f) use ($_create) {return $_create($f);},array_values($this->fields()))) # done at the end for primary keys .')' @@ -459,7 +459,7 @@ Class Table extends nb { public function url_sort($name) { - if ($this->p('buttons')==='0' or !($f=$this->fields($name)) or !empty($f->dyn)) return self::prettyText($name); + if (!$this->buttons() or !($f=$this->fields($name)) or !empty($f->dyn)) return self::prettyText($name); #debug($f); # See: http://dev.w3.org/html5/html-author/charref @@ -720,15 +720,20 @@ Class Table extends nb { // Get results // # NB 28.03.16 $this->sql = $sql; - $this->debug(preg_replace('/(,|FROM|WHERE|HAVING|GROUP|ORDER)/i',"\n\\1",$sql),1); + $this->debug(preg_replace('/[\r\n]+[ ]*/',' ',$sql),1); +# NB 03.09.16 $this->debug(preg_replace('/(,|FROM|WHERE|HAVING|GROUP|ORDER)/i',"\n\\1",$sql),1); return array($sql,$where,$limit,$select_count); } + public function buttons() { + if ($this->type() != 'table') return false; + return true; + } + public function rows(&$opt=array(),$opt_by_val=null) { $this->create_temporary(); - if (empty($this->type) or $this->type != 'table') $this->pset('buttons','0');; if ($opt_by_val !== null) $opt = $opt_by_val; $format = $this->p('format'); @@ -772,7 +777,7 @@ Class Table extends nb { self::$params += array_values(out::$types); if (empty($out_conf['enclose'])) $out_conf['enclose'] = array('',''); - debug('Using out module!',1); + debug('Using out module!',3); } @@ -1100,13 +1105,12 @@ Class Table extends nb { if ($this->p('header')!=="0") { $html .= ''.NB_EOL.''.NB_EOL; - if ($this->p('buttons')!=='0' and DB_HTML_EDIT) $html .= ''.NB_EOL; + if ($this->buttons() and DB_HTML_EDIT) $html .= ''.NB_EOL; foreach ($fields as $name => $f) { - #$html .= ''.($this->p('buttons')==='0' ? $f : $this->url_sort($f)).''.NB_EOL; $html .= ''.$this->url_sort($name).''.NB_EOL; } - if ($this->p('buttons')!=='0' and DB_HTML_DELETE) $html .= ''.NB_EOL; + if ($this->buttons() and DB_HTML_DELETE) $html .= ''.NB_EOL; $html .= ''.NB_EOL.''.NB_EOL; } @@ -1120,14 +1124,14 @@ Class Table extends nb { $html = ''.NB_EOL; - if ($this->p('buttons')!=='0') $html .= ''.$buttons[0].''.NB_EOL; + if ($this->buttons()) $html .= ''.$buttons[0].''.NB_EOL; foreach ($row as $k => $v) { if (isset($this->extras[$k])) $k .= " extra"; $html .= ''.$v.''.NB_EOL; } - if ($this->p('buttons')!=='0') $html .= ''.$buttons[1].''.NB_EOL; + if ($this->buttons()) $html .= ''.$buttons[1].''.NB_EOL; $html .= ''.NB_EOL; @@ -1154,7 +1158,7 @@ Class Table extends nb { $html .= '
    '.NB_EOL; - if ($this->p('buttons')!=='0') { + if ($this->buttons()) { $html .= '
  • '.NB_EOL; $html .= join('',$this->html_row_buttons($row)); $html .= '
  • '.NB_EOL; @@ -1348,6 +1352,7 @@ Class Table extends nb { public function out($v,$head=array()) { return $this->db()->out($v,$head); } public function infos() { + $this->type(); return array( "name" => $this->name, @@ -1659,5 +1664,26 @@ Class Table extends nb { return var_export($o,true); } + public function type() { + if (isset($this->type)) return $this->type; + return $this->type = $this->status('type'); + } + + public function status($key=null) { + if (!isset($this->status)) { + $this->status = []; + + $sql = $this->db()->type('tables'); + if (is_callable($sql)) $sql = $sql($this); + #$sql .= ' AND name='.$this->db()->quote($this->name); + $sql = "SELECT * FROM ($sql) t WHERE name=".$this->db()->quote($this->name); + + $this->status = $this->db()->conn->query($sql,PDO::FETCH_ASSOC); + if (!empty($this->status)) $this->status = $this->status->fetch(); + } + if (!empty($key)) return ( empty($this->status[$key]) ? '' : $this->status[$key] ); + return $this->status; + } + } # < Class ?> diff --git a/lib/php/db/types/sqlite.php b/lib/php/db/types/sqlite.php index ee32fc60..cef379a8 100644 --- a/lib/php/db/types/sqlite.php +++ b/lib/php/db/types/sqlite.php @@ -65,8 +65,8 @@ $DB_TYPES['sqlite'] = array ( ,2), ), -#'tables' => "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'", -'tables' => function($Db) { +'tables' => "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'", +'_tables' => function($Db) { #debug($Db->databases()); $sql = "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'"; $dbs = $Db->databases(); diff --git a/lib/php/functions.php b/lib/php/functions.php index dfadfb08..7366c378 100644 --- a/lib/php/functions.php +++ b/lib/php/functions.php @@ -29,41 +29,6 @@ function file_write($file,$data,$mode='w') { } -function ls_dir($path,$recurse=false,$exp='') { - - $ls = array(); - $rep = opendir($path); - #die(">>>".$exp); - - while($file = readdir($rep)) { - - if ($file == '.' or $file == '..') continue; - - if (!$exp or preg_match('#\.('.$exp.')$#',$file)) { - $ls[] = $file; - } - - if ($recurse and is_dir("$path/$file")) { -#print ">>>$path/$file\n"; - - foreach (ls_dir("$path/$file",$recurse,$exp) as $l) { -#print ">>>$path/$file << $l\n"; - $ls[] = "$file/$l"; - } - - } - - #echo "
    $file
    \n"; - - } - - closedir($rep); - -#print ">>>$path: ".print_r($ls,true)."\n"; - return $ls; - -} - function ar_first($ar) { return (is_array($ar) and count($ar)) ? $ar[0] : false; } function ar_map($return,$array,$as_hash=false) { diff --git a/lib/php/nb.php b/lib/php/nb.php index 0c4d8ba3..e242ec63 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -676,5 +676,56 @@ class NB { return strtolower(php_uname('s')); return strtolower(preg_replace('/\s+.*$/','', php_uname())); } + + public static function ls_dir($path,$exp='',$recurse=false) { + + $ls = array(); + $rep = opendir($path); + #die(">>>".$exp); + + while($file = readdir($rep)) { + + if ($file == '.' or $file == '..') continue; + + if (!$exp or preg_match('#'.$exp.'#',$file)) { + $ls[] = $file; + #$ls[] = "$path/$file"; + } + + if ($recurse and is_dir("$path/$file")) { + #print ">>>$path/$file\n"; + + foreach (ls_dir("$path/$file",$recurse,$exp) as $l) { + #print ">>>$path/$file << $l\n"; + $ls[] = "$file/$l"; + #$ls[] = $l; + } + + } + + #echo "
    $file
    \n"; + + } + + closedir($rep); + + #print ">>>$path: ".print_r($ls,true)."\n"; + return $ls; + + } + + public static function http_user() { + if (!empty($_SERVER['REMOTE_USER'])) return $_SERVER['REMOTE_USER']; # empty since jessie + if (!empty($_SERVER['PHP_AUTH_USER'])) return $_SERVER['PHP_AUTH_USER']; + return ''; + } + + public static function http_login_header($msg_box='My Realm',$msg_cancel='Please login!') { + header('WWW-Authenticate: Basic realm="'.$msg_box.'"'); + header('HTTP/1.0 401 Unauthorized'); + echo $msg_cancel; + exit; + } + } # < Class ?> diff --git a/lib/php/out.php b/lib/php/out.php index 6b5d2edc..d7fb5247 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -315,7 +315,7 @@ Class Out extends Nb { $new = array(); $i = 0; foreach ($head as $k => $h) { - $new[$h] = $row[$i]; + $new[$h] = isset($row[$i]) ? $row[$i] : null; $i++; } $row = $new;